Modifying the IP address and gateway is a very common operation, when doing related experiments, if not set up, will bring a lot of unnecessary trouble.
1. Modify the IP address
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
Bootproto=none
broadcast=192.168.1.255
ipaddr=192.168.1.33
netmask=255.255.255.0
network=192.168.1.0
Onboot=yes
Userctl=no
Peerdns=no
Type=ethernet
If there are 2 network cards, the second information is saved in the Ifcfg-eth1 file.
Vi/etc/sysconfig/network-scripts/ifcfg-eth1
Device=eth1
Onboot=yes
Bootproto=none
ipaddr=192.168.2.34
netmask=255.255.255.0
Userctl=no
Peerdns=no
Type=ethernet
network=192.168.2.0
broadcast=192.168.2.255
2. Modify the Gateway
Vi/etc/sysconfig/network
Networking=yes
Hostname=aaron
gateway=192.168.1.1
3. Restart the network configuration: After you modify the IP and gateway, you must restart the Network service before it takes effect.
/etc/init.d/network restart
From: http://blog.csdn.net/tianlesoftware/article/details/5312646
Linux modifies IP addresses and gateways