Ubuntu 10.04‎ > ‎

Adding Static Routes to Ubuntu 10.04

Static routes can be set in Ubuntu 10.04 using the “ip route” command. The usage is as follows:

ip route add [network address]/[CIDR block] via [router ip] dev [network interface]

Example: ip route add via dev eth0

A route added as shown above is good only until the next restart. To make a permanent route that persists even through restarts, create a new file in /etc/network/if-up.d/, set it as executable, and add the ip route line to it. The contents of the file should be:

ip route add via dev eth0
exit 0

At the next restart, running the route command should display the newly added static route.