Skip to content

Add a Persistent Gateway Route in Ubuntu for vlan

by Jon on December 9th, 2009

Many times it is necessary to manually add a route into a Ubuntu box and i found this was the best way to have the route add every time the network service or operating system is restarted.

Edit the /etc/network/interfaces file and add this down at the bottom.

up route add -net 192.168.1.0/24 gw 10.253.8.254
up route add -net 192.168.2.0/24 gw 10.253.8.254

Now every time the machine is restarted the vlan routes will be added and network connectivity will not be down.

So your whole interfaces file might look like this.

iface eth1 inet static
address 209.1.2.3
netmask 255.255.255.0
gateway 209.1.2.1

auto eth0
iface eth0 inet static
address 10.253.8.50
netmask 255.255.255.0

up route add -net 192.168.1.0/24 gw 10.253.8.254
up route add -net 192.168.2.0/24 gw 10.253.8.254

From → Linux

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

%d bloggers like this: