Describe:
The virtual machine installed CentOS, the installation network is configured to fixed IP, the system installed and added a network card port, and positioning as a bridge mode, and the original network card is changed to DHCP to obtain the IP address, and as a public network export.
The problem comes, the network card configuration is correct, but also commented on the fixed IP gateway, but after restarting the Network service, found unable to access the Internet, then thought it might be the default route does not change over
#route -nDestination Gateway Genmask Flags Metric Ref Use Iface192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1192.168.192.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0169.254.0.0 0.0.0.0 255.255.0.0 u 1002 0 0 eth0169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth10.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
Look at the next routing table, the reason for the default route, delete it, add the static route again
#route del-net 0.0.0.0 netmask 0.0.0.0 GW 192.168.1.1#route add-net 0.0.0.0 netmask 0.0.0.0 GW 192.168.192.1
This change came, but the problem is not completely resolved, after restarting the network service, the default route is changed back
Best of all, in order to use the time, think of the system inside there is a location is set the default route, that is,/etc/sysconfig/network file, a view, sure enough in the definition of the default gateway, delete, fix
#cat/etc/sysconfig/network networking=yeshostname=nagios#gateway=192.168.1.1
This article is from the "Morrowind" blog, make sure to keep this source http://morrowind.blog.51cto.com/1181631/1696138
CentOS Delete default route