Modifying IP addresses and gateways is a common operation. It may cause a lot of unnecessary trouble if you do not set the IP addresses and gateways ..
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 NICs, 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 modifying the IP address and gateway, you must restart the network service to make the configuration take effect.
/Etc/init. d/network restart