Modify IP permanent effect as follows
Vi/etc/sysconfig/network-scripts/ifcfg-eth0 (eth0, first Nic, if the second block is eth1)
Modify the IP as follows:
device=eth0 #如果是第二块刚为eth1BOOTPROTO=static #网卡获得ip地址的方式, static and DHCP two ways ipaddr=192.168. 1.122 #改成要设置的IPNETMASK=255.255. 255.0 #子网掩码GATEWAY=192.168. 1.1 #网关地址HWADDR=:xx: +:8c:ad #网卡物理地址ONBOOT= Yes #系统启动时是否设置此网络接口, when set to Yes, activates the device when the system starts. The default setting is Yes
Then the restart takes effect:
Service Network restart
The IP address is in effect and does not change after rebooting the system
If you are restoring the original IP after temporarily modifying the IP restart system, use the following command
Ifconfig network card device IP address netmask subnet mask
ifconfig 192.168. 1.122 255.255. 255.0
Problems you may encounter:
1.service Network Restart Error
Eth0: Error: Activation Connection failed: Device not managed by NetworkManager
Workaround:
1 . Service Network Restart #查看报错信息 2. ifconfig eth0 #查看eth0配置是否正常 3. Service NetworkManager Stop #停掉NetworkManager服务 4 the. Service Network restart Restart the networking validation is normal #重启网络验证是否正常
2.service Network Restart Error
eth0:determining If IP address 192.168.1.122 is already on use for device eth0 ...
This prompt appears because:Linux network adapter configuration ARP check caused, turn this off
Workaround:
#在网卡配置文件里面添加 vi /etc/sysconfig/network-scripts/ifcfg-eth0arpcheck=no# When set, save the changes. Restart the network Card Services service network restart
Linux centos6.x IP settings (network card settings)