centos 7 修改ip centos
cd /etc/sysconfig/network-scripts/ spa
vi ifcfg-lo ip
從行IPADDRO以後的,都須要手工添加。須要配置的就是ipaddr0=Ip地址,GATWAY0=網關、DNS1=DNS。最好把onboot改爲yes。 it
- # ]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
- HWADDR="00:15:5D:07:F1:02"
- TYPE="Ethernet"
- BOOTPROTO="static" #dhcp改成static
- DEFROUTE="yes"
- PEERDNS="yes"
- PEERROUTES="yes"
- IPV4_FAILURE_FATAL="no"
- IPV6INIT="yes"
- IPV6_AUTOCONF="yes"
- IPV6_DEFROUTE="yes"
- IPV6_PEERDNS="yes"
- IPV6_PEERROUTES="yes"
- IPV6_FAILURE_FATAL="no"
- NAME="eth0"
- UUID="bb3a302d-dc46-461a-881e-d46cafd0eb71"
- ONBOOT="yes" #開機啓用本配置
- IPADDR=192.168.7.106 #靜態IP
- GATEWAY=192.168.7.1 #默認網關
- NETMASK=255.255.255.0 #子網掩碼
- DNS1=192.168.7.1 #DNS 配置