Temporarily modify IP
Enter the command in Linux: ifconfig eth0 192.168.1.1 netmask 255.255.255.0 Enter
Here the 192.168.1.1 is the temporary ip,netmask is the subnet mask, this temporary IP will be changed after you restart the network card to the previous IP
Permanently modify IP
Entering commands in Linux
# Vim/etc/sysconfig/network-scripts/ifcfg-eth0, new or modified in Ifcfg-eth0 file
ipaddr=192.168.1.1
netmask=255.255.255.0
# wq!
Restart the NIC after saving
# Service Network Restart
# ifconfig
Now that the IP address is 192.168.1.1, if you find that your IP address is still unchanged, go to the Ifcfg-eth0 file to view
bootproto= ' DHCP ' dynamic acquisition of IP
Revision changed to
bootproto= ' static ' to obtain IP statically
# Service Network Restart
# ifconfig
At this time the IP address should already be 192.168.1.1
Note the point:
The temporary IP will restart the network card, the IP is restored to the previous
Permanent IP modification requires a network card restart
This article is from the "12779418" blog, please be sure to keep this source http://12789418.blog.51cto.com/12779418/1914635
Temporary, permanent modification of IP in Linux