Tuesday 8 October 2013

How to Configure Static Routing




Direction-finding is going to be constructed on redirecting units, therefore it must not be needed to configure static routes on Crimson Loath Company Linux hosts as well as buyers. Even so, when static routes are important they can be constructed for each interface. This is helpful for those who have many interfaces in different subnets. Utilize way order to produce the IP redirecting desk.

Static route configuration is stored in a /etc/sysconfig/network-scripts/route-interface file. For example, static routes for the eth0 interface would be stored in the /etc/sysconfig/network-scripts/route-eth0 file. The route-interface file has two formats: IP command arguments and network/netmask directives.

IP Command Arguments Format:

Define a default gateway on the first line. This is only required if the default gateway is not set via DHCP.

default x.x.x.x dev interface

x.x.x.x is the IP tackle from the default entrance. The actual software is the software that may be attached to, or maybe can easily attain, the actual default entrance.


Determine some sort of static course. Each range is parsed just as one person course.

x.x.x.x/x will be the circle variety and netmask for your static way.x.x.x.x and software will be the IP address and interface for your default portal respectively. This x.x.x.x address doesn't have to be the actual default portal IP address. Typically,x.x.x.x will probably be a IP address in a very different subnet, and interface would be the interface that may be associated with, or perhaps may attain, that subnet. Include as numerous static channels because required.

The following is a simple router-eth0 file useing the command argument format. The default gateway
is 192.168.0.1,interface eth0.The two static router are for the 10.10.10.0/24 subnet,172.16.1.0/24 network.

default 192.168.0.1 dev eth0
10.10.10.0/24 via 192.168.0.1 dev eth0
172.16.1.0/24 via 192.168.0.1 dev eth0

Static tracks should simply always be set up intended for additional subnets. The above mentioned case in point is not necessary, considering that packets planning to this 10. 10. 10. 0/24 in addition to 172. of sixteen. 1. 0/24 sites uses this default gateway at any rate. Underneath is usually a good example of placing static tracks to another subnet, over a machine within a 192. 168. 0. 0/24 subnet. Your case in point machine has an eth0 software within the 192. 168. 0. 0/24 subnet, in addition to a eth1 software (10. 10. 10. 1) within the 10. 10. 10. 0/24 subnet:

Network/Netmask Directives Format:

You can even utilize the network/netmask directives file format intended for route-interface data. The subsequent is really a template to the network/netmask file format, having recommendations next after:

ADDRESS0=x.x.x.x
NETMASK0=x.x.x.x
GATEWAY0=x.x.x.x

DDRESS0=x.x.x.x is the network number for the static route.
NETMASK0=x.x.x.x is the netmask for the network number defined with
GATEWAY0=x.x.x.x is the default gateway, or an IP address that can be used to reach ADDRESS0=x.x.x.x

The following is a sample routing eth0 file using the network / subnet mask instruction formats. The default gateway is 192.168.0.1, the interface eth0. Two static routing is 10.10.10.0/24, 172.16.1.0/24 network. However, as mentioned before, this example is not necessary because the 10.10.10.0/24, 172.16.1.0/24 network default gateway will be used anyway:

ADDRESS0=10.10.10.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.0.1
ADDRESS1=172.16.1.0
NETMASK1=255.255.255.0
GATEWAY1=192.168.0.1

Subsequent static routes must be numbered sequentially, and must not skip any values. For example, ADDRESS0, ADDRESS1, ADDRESS2, and so on.

Below is an example of setting static routes to a different subnet, on a machine in the 192.168.0.0/24 subnet. The example machine has an eth0 interface in the 192.168.0.0/24 subnet, and an eth1 interface (10.10.10.1) in the 10.10.10.0/24 subnet.

0 comments:

Post a Comment