User Tools

Site Tools


Note that for a route to work, each endpoint needs to have a route to the other.

These examples show adding a route to a simple subnet that exists on the same network segment as the local machine (e.g. connected by a switch).

Routes in Linux (change interface name as needed)

sudo route add -net netmask dev eth0
sudo route add -net netmask dev eth0
netstat -rn # to list routes

Making Persistent (Red Hat)


To make persistent ( in /etc/sysconfig/network-scripts/route-eth0, add a line like this: dev eth0


When adding a route in system-config-network, some versions may generate an error when reopening: "Static routes file {interface_name} is invalid." To work around this, make sure to always fill in the gateway field (in this case, make it This is a bug (which has since been fixed): see Red Hat Bug 153062.

Making Persistent (Debian/Ubuntu)

This is if you're not using Network Manager.

For the examples above, I added these lines to /etc/network/interfaces:

up route add -net netmask dev eth0
up route add -net netmask dev eth0

Routes in Windows

route ADD <DEST> MASK <IP>

where <DEST> is e.g. and <IP> is your local IP address.

To make persistent, use the -p option.

To list routes, run route PRINT.

info/routes.txt · Last modified: 2010-04-13 22:00 by sam