centos modify the static IP address under 7

1. Modify the ip address
edit / etc / sysconfig / network-scripts

[root@localhost /]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
UUID=a0fe90c4-019c-40e5-bb00-de65b4ebd42c
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.31.161
NETMASK=255.255.255.0
GATEWAY=192.168.31.1

 

Run service network restart

 

2. Modify the dns address
edit /etc/resolv.conf
modify the contents of the file

nameserver 114.114.114.114

nameserver fe80::ee41:18ff:fe0b:31c3%eth0

nameserver 240e:3a1:2c4e:d140::1

nameserver 114.114.114.114

Common dns address
114.114.114.114
114.114.115.115
223.5.5.5 Ali
223.6.6.6 Ali
180.76.76.76 Baidu

Guess you like

Origin www.cnblogs.com/ykblogs/p/12598117.html