Server Routing

From Braindisconnect
Jump to navigationJump to search

When we think of routing, we almost always think of routers on the network. The network does do routing, however almost all devices that interact with Layer 3 of the OSI Layer Model perform fundamental routing. Even if the device only has one NIC it is still performing routing functions.

Servers are pretty easy to configure for routing when they only have have one NIC, but adding another NIC to a server will complicate the network configuration on the server.

Important Points

There can only be one NIC per subnet or VLAN, unless Link Aggregation is being configured. There is one more exception, but involves setting up detailed routing tables for the subnet and the interfaces.

There can only be one default gateway.


In SuSE, there are two ways to set up persistent routes. You can either add routes to the a file called route or a route file based on the interface. It doesn't matter since the network services script will read both files. It is usually easier to maintain the main route file then keeping track of each interface routing table. Either way, the result is the same.

Adding routes to the route file

The route file is located in the /etc/sysconfig/network/ directory.


The basic syntax:

Destination Mask    Gateway Mask     Interface

An example for static CorpNet:     eth0               eth0     eth1                eth1    

An example for DHCP CorpNet:

default - -     eth1                eth1    

The first line sets up the network for eth0.
The second line sets up the default route, meaning if there is no route defined, then it sends it out eth0 to
The third line sets up the network for eth1.
The fourth line sets up the main route for the Cisco lab.

Red Hat Enterprise

You will need to edit the route file for the NIC. route-ethX where X = the NIC.

You can also echo it into the file.


echo ' via' >> /etc/sysconfig/network-scripts/route-eth1

You will need to bounce the interface or reboot the server/VM for the route to take effect.

Windows XP, Vista, and 7

For a temporary route that will go away on the next reboot:

route add mask

For a persistent route, simply add a /p at the end of the command

route add mask /p