First, temporary modification
Command: ifconfig eth0 192.168.1.147
After restarting or shutting down, the IP address will revert to the state before the change.
Second, permanent modification
Command:
vi/etc/sysconfig/network-scripts/ifcfg-eth0device=eth0 # Nic type=ethernet # Ethernet Type Code Onboot=yes # boot load nm_controlled=no #Network Manger parameters bootproto= None # nic type ipaddr=10.10.51.241PREFIX=24GATEWAY=10.10.51.254 DNS1=202.106.0.60DNS2=114.114.114.114
Then restart the Network service:
/etc/rc.d/init.d/network Restart # Restart Network Service
If your virtual machine is cloned, you also need to clear the following information:
>/etc/udev/rules.d/70-persistent-net.rules #/etc/sysconfig/network-service/ifcfg-eth0 #
--Solemn statement: This article is only for the author's personal notes, please do not reprint! ——
"Original" Modify the CentOS IP address