How can I change my default gateway in Linux?
Your machine needs to have a single default gateway. DHCP servers will automatically assign a default gateway to DHCP configured NICs, but NICs with configured static IP addresses will need to have a manually configured default gateway. This can be done with a simple command.
[root@linux etc]# route add default gw 192.168.1.1 eth0
In this case, make sure that the router/firewall with IP address 192.168.1.1 is connected to the same network as interface eth0!
Once done, you’ll need to update your /etc/sysconfig/network file to reflect the change. This file is used to configure your default gateway each time Linux boots.
NETWORKING=yesHOSTNAME=linux
GATEWAY=192.168.1.1