Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Configuration of IP address in Linux

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Set the IP address of Linux

1. Understand three network card modes: bridge, NAT, stand-alone mode

two。 Select NAT mode

1). Vi / etc/sysconfig/network-script/ifcfg-eth0 is set to obtain the IP address automatically.

DEVICE=eth0

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=dhcp

2)。 Execute ip an or ifconfig to get the IP address, and route-n to get the routing information and get the gateway

DEVICE=eth0

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=static

IPADDR=192.168.128.128

NETMASK=255.255.255.0

GATEWAY=192.168.128.2

DNS1=114.114.114.114

3)。 Restart the network card service network restart

3. Name or Service not know error occurred during ping www.baidu.com, after troubleshooting

1) .IP address binds hostname

Cat / etc/hosts

192.168.128.128 Linux

2). Cat / etc/sysconfig/network

NETWORKING=yes

HOSTNAME=Linux

GATEWAY=192.168.128.2

NOZEROCONF=yes

3)。 Add a DNS server

Nameserver 114.114.114.114

Nameserver 114.114.114.115

4)。 Turn off the firewall

The following are versions prior to Cetos 7:

Temporarily Closed

Service iptables stop

Permanent shutdown

Chkconfig iptables off

View firewall status

Chkconfig-- list | grep iptables

The following is the version after Centos 7

Systemctl stop firewalld

Systemctl status firewalld

Systemctl disable firewalld

Systemctl enable firewalld

Systemctl start firewalld

5)。 Turn off security policy

View

Getenforce

Set up

Setenforce

Permanent shutdown

Vi / etc/selinux/config

SELINUX=disabled

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report