Default gateway changing
To temporarily change the default route you can use an ip command like this:
$ sudo ip route change default via 192.168.1.1 dev eth0
If you have a static ip configuration in /etc/network/interfaces
you can add a gateway statement to make this permanent.
iface eth0 inet static
gateway 192.168.1.1
[…]
Using DHCP to configure networking you have to adjust another file instead. Add the supersede statement in /etc/dhcp/dhclient.conf
.
supersede routers 192.168.1.1;
Open the file /etc/network/interfaces
find desired interface and add following:
gateway 192.x.x.x
Restart network:
sudo /etc/init.d/networking restart