« Joomla / PleskTurn on register_globals on Plesk site. »

Static Routes On RedHat

07/06/06

Permalink 11:31:00 am, by admin Email , 237 words   English (US)
Categories: RedHat

Static Routes On RedHat

Here's the docs from redhat on how to setup static routes:

/etc/sysconfig/network-scripts/route-<interface-namegt;

  Contains lines that specify additional routes that should be added when the
  associated interface is brought up.

  The files are processed by the ifup-routes script and uses the /sbin/ipcalc
  utility for all network masks and numbers. Routes are specified using the
  syntax:

    ADDRESSn=<network>
    NETMASKn=<network/prefix mask>
    GATEWAYn=<next-hop router/gateway IP address>

  The "n" can be any integer number, but is expected to be monotonically
  increasing and counting starts from 0. For example:

    ADDRESS0=192.168.2.0
    NETMASK0=255.255.255.0
    GATEWAY0=192.168.1.1

  adds a network route to the 192.168.2.0 network via the gateway at
  192.168.1.1. Since you must already have a route to the network of the
  gateway, there is no need to specify a device.

  Note: The ifup-routes script also supports an older syntax designed to be
  used directly as an argument to "/sbin/ip route add". This syntax is
  deprecated, but if no "ADDRESSn" lines are found the following will still
  work:

  192.168.2.0/24 dev ppp0

  adds a network route to the 192.168.2.0 network through ppp0.

Let's say you want to add two static routes to eth1. The first routes 10.10.10.0/255.255.255.0 to 10.10.10.1 and the second routes traffic from 10.10.11.0/255.255.255.0 to 10.10.11.1. To accomplish this create a file at:

/etc/sysconfig/network-scripts/route-eth1

And place the following lines in the file:

    ADDRESS0=10.10.10.0
    NETMASK0=255.255.255.0
    GATEWAY0=10.10.10.1
    ADDRESS1=10.10.11.0
    NETMASK1=255.255.255.0
    GATEWAY1=10.10.11.1

Then restart networking with:

    /sbin/service network restart
July 2010
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Reliable Penguin offers Linux Server Migrations, Systems Administration & Programming. Visit our main website at:

http://www.reliablepenguin.com

Search

Bookmark and Share

XML Feeds

powered by b2evolution free blog software