Networking Forums

Networking Forums > Computer Networking > Linux Networking > How to create static routes?

Reply
Thread Tools Display Modes

How to create static routes?

 
 
Matthew Connor
Guest
Posts: n/a

 
      08-09-2006, 04:28 PM
Hi all.

I am not well versed in Linux so please speak simply for my simple
mind. Every time I reboot one of our RedHat Linux servers (due to
power outages), I lose the routes that I had setup and it no longer
communicates properly on the network. I have to delete the routing
table and re-add my routes from scratch. How do I get the routes I add
and ONLY those routes to stay through reboots? Some IPs are marked
through for privacy but here is what the routing table SHOULD look
like:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
65.xx.xx.224 * 255.255.255.224 U 0 0 0
eth0
172.16.80.0 * 255.255.255.0 U 0 0 0
eth1
127.0.0.0 * 255.0.0.0 U 0 0 0
lo
default host254.raisogl 0.0.0.0 UG 0 0 0
eth0

 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      08-09-2006, 05:02 PM
On 2006-08-09, Matthew Connor <(E-Mail Removed)> wrote:
> How do I get the routes I add and ONLY those routes to stay through
> reboots?


In the new version of RedHat, the route are configured through
/etc/sysconfig/network-scripts/route-DEVICE
where 'DEVICE' is the network interface for which the routes apply.
I'm sure you can find a lot more infos on the net about how to write
such config files.

An alternative would be to make your own script and 'attach' it in
the boot sequence *after* the networking script so it can wipe clean the
routing table and refill it with your contents.

Davide

--
Linux: The OS people choose without $200,000,000 of persuasion
 
Reply With Quote
 
Moe Trin
Guest
Posts: n/a

 
      08-10-2006, 08:00 PM
On 9 Aug 2006, in the Usenet newsgroup comp.os.linux.networking, in article
<(E-Mail Removed). com>, Matthew Connor wrote:

>I am not well versed in Linux so please speak simply for my simple mind.


What would have helped is more details - specifically what release of Red
Hat (cat /etc/redhat-release), and how networking is set up (DHCP, static,
something else).

>Every time I reboot one of our RedHat Linux servers (due to power outages),


Servers? Why no UPS?

>I lose the routes that I had setup and it no longer communicates properly
>on the network. I have to delete the routing table and re-add my routes
>from scratch.


Where is it getting the "other" or wrong routes? Is this a screwed up
configuration on the DHCP server, or wrong information in static
networking files?

>How do I get the routes I add and ONLY those routes to stay through reboots?


If the routing setup is configured by DHCP, kick the guy who owns the DHCP
server. If the network setup is static, fix the configuration files. Start
by looking at /etc/sysconfig/network-scripts/ifcfg-* and you'll see a line
that says "BOOTPROTO=" - none means static configuration, bootp means to use
the ancient BOOTP protocol, while dhcp uses DHCP (kick the guy who owns the
DHCP server).

>Kernel IP routing table
>Destination Gateway Genmask Flags Metric Ref Use Iface
>65.xx.xx.224 * 255.255.255.224 U 0 0 0 eth0
>172.16.80.0 * 255.255.255.0 U 0 0 0 eth1
>127.0.0.0 * 255.0.0.0 U 0 0 0 lo
>default host254.raisogl 0.0.0.0 UG 0 0 0 eth0


For a _STATIC_ configuration, there are three or four files involved.

/etc/sysconfig/network-scripts/ifcfg-eth0 should have the correct IP,
network, netmask, and broadcast addresses. This MIGHT look something like

DEVICE=eth0
IPADDR=65.xx.xx.yyyy
NETMASK=255.255.255.224
NETWORK=65.xx.xx.224
BROADCAST=65.xx.xx.255
ONBOOT=yes
BOOTPROTO=none

/etc/sysconfig/network-scripts/ifcfg-eth0 and ifcfg-lo would look similar
with the appropriate substitutions. The gateway address along with primary
hostname and the parameter 'NETWORKING=yes' goes in /etc/sysconfig/network.

For a DHCP or BOOTP setup, the ifcfg-eth? file for that interface ONLY would
contain only the DEVICE, ONBOOT, and BOOTPROTO lines (the other lines either
missing or nothing after the equal signs).

There could be a file named /etc/sysconfig/network-scripts/route-ethN (the
ethN specific to the interface), but with this simple routing table, it
shouldn't be needed.

Old guy
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static routes...? Geir Network Routers 0 01-09-2008 06:42 AM
Static routes Mike Spike Windows Networking 2 04-02-2007 07:10 PM
128 static ip routes? Jeff Wells Windows Networking 1 09-26-2006 11:39 AM
DOD and static routes Tom K Windows Networking 0 08-30-2005 09:04 PM
static routes paolo Linux Networking 3 08-25-2003 04:30 PM



1 2 3 4 5 6 7 8 9 10 11