Static Routing

What is a Route
A 'route' is a rule, set in your kernel, to determine which physical network interface or which gateway to use, to reach a particular network. There are many types of routed protocols this article simply covers routing of the IP protocol. IP routes are stored in the kernel. To see the current routing table on your system use as root:

or as a regular system user use:

Both commands will produce output similar to this:

Adding a Static Route
To add a route you must first know the IP and the subnet mask of a network you wish to route, and the gateway to that network.

In this example we route the network with the netmask  to the gateway

To accomplish this use the following command:

Our route table now looks like this:

The routing table is sorted from most specific routes to more general, and this is how it is read by the routing process. Longest prefix match - means the the smallest network, or the network with the largest netmask f.e. is at first position in a  routing table.

Adding a Permanent Static Route
To add a permanent static route, open your favorite text editor to and adjust accordingly. Make sure to refer to your current routing table for help.

Both statements above means:
 * 1) IP packets destined to the  network are send to
 * 2) IP packets destined to all  other networks are send to

The default route is used if the host has to send IP Packets outside of his own network, and there is no specific route to a certain network in the routing table, then the IP packets are send to the the default gateway.