Linux - Persistent routes not working


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Linux - Persistent routes not working
# 1  
Old 08-05-2008
Bug Linux - Persistent routes not working

Hello,

I'm having problems with persistent routes.
I have the route added to route-eth1.

But when I run the 'route' command to display the routes, it does not show the newly added route.
I did restart the network service. That did not help.
I also rebooted the server, but still did not help.

I'm able to add route via command line, but they are not persistent. They go away once the network service is restarted or the server is rebooted.

Any help is appreciated.
Thanks.
# 2  
Old 08-05-2008
When you set route with route command, it sets temporary and restarting network service will brush up all your temporary set routes.

In case of linux, permanent static routes are added on a per interface basis in files located in the /etc/sysconfig/network-scripts directory. The filename format is route-interface-name so the filename for interface wlan0 would be route-wlan0.

The format of the file is quite intuitive with the target network coming in the first column followed by the word via and then the gateway's IP address. In our routing example, to set up a route to network 10.0.0.0 with a subnet mask of 255.0.0.0 (a mask with the first 8 bits set to 1) via the 192.168.1.254 gateway, we would have to configure file /etc/sysconfig/network-scripts/route-wlan0 to look like this:

Quote:
#
# File /etc/sysconfig/network-scripts/route-wlan0
#
10.0.0.0/8 via 192.168.1.254
Note: The /etc/sysconfig/network-scripts/route-* filename is very important. Adding the wrong interface extension at the end will result in the routes not being added after the next reboot. There will also be no reported errors on the screen or any of the log files in the /var/log/ directory.

You can test the new file by running the
Code:
/etc/sysconfig/network-scripts/ifup-routes

You can try this too..
Code:
 netstat -nr

- nilesh
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Simple sed command not working; could be a Mac/Linux vs. PC/Linux issue

Hello, I am on a Mac and trying to clean up some monthly files with a very simple SED: sed '3,10d;/<ACROSS>/,$d' input.txt > output.txt (from the input, delete lines 3 - 10; then delete from the line containing <ACROSS> to the end of the file) then output to output.txt Even when I try... (2 Replies)
Discussion started by: verbatim
2 Replies

2. Red Hat

Centos-quick way to check if static routes are persistent

Hi All, Is there a quick way to check whether the current routes on my centos are persistent or not before rebooting ? i can take a route -n output but i may completely lost access to my server if the routes are gone. thanks. (1 Reply)
Discussion started by: coolatt
1 Replies

3. UNIX for Dummies Questions & Answers

kcore and a live persistent linux usb distro

I have 2 computers, from now on i shall call these computers A and B. Made a live linux distro (bodhi) on A which has 1GB internal memory , because windows is unstable on B, which has 512MB internal memory. I mean with memory the internal memory of the computer, not the memory of the usb... (0 Replies)
Discussion started by: anno
0 Replies

4. Linux

FTP not working under Linux but working under any other OS ??? Very strange

Dear all, I am totally despaired and puzzled. Using Filezilla under Windows under the same network as our Linux servers is working. Using FTP command-line client under any of our Linux debian servers is not working ! I tried with different FTP servers -> same problem ! All commands are... (12 Replies)
Discussion started by: magix_ch
12 Replies

5. Solaris

adding routes in Solaris

Solaris Guru's What is the proper way to add routes in the routing table so after a node reboot the routes will not be lost. I understand the /etc/defaultrouter for the default router and the <route add> command but using this command routes will be removed once the node reboots. Thanks (7 Replies)
Discussion started by: Brad_52000
7 Replies

6. Solaris

Where are routes stored ?

Hi there When adding a route (or indeed deleting a route) which file is amended ? I am moving a box from one network to another and when it starts up it tries to connect run 'add net 192.x.x.x' etc etc ...but i dont want it to do that where do I edit these route additions cheers (5 Replies)
Discussion started by: hcclnoodles
5 Replies

7. AIX

Multiple Default routes

Hi All, I have a AIX server running v5.2 and its having multiple default routes configured to two seperate gateway. Here's the output of -- netstat -rn Routing tables Destination Gateway Flags Refs Use If PMTU Exp Groups Route Tree for Protocol Family 2... (2 Replies)
Discussion started by: rramanuj
2 Replies

8. Debian

Setting Routes and such

Ok, I made changes to my routing tables..... which file do I modify to make the routes initialize correctly when the machine boots up? I work with all flavours of Unix/Linux... but this is an older box... Linux, Release 2.2.14-5.0. I did a grep for the default route in /etc, but didnt find... (2 Replies)
Discussion started by: djsal
2 Replies

9. IP Networking

Multiple Interfaces and Routes

I have a Unix box with 2 network interfaces on the same IP subnet and would like to add a host route via a specific interface. Any assistance would be greatly appreciated. (3 Replies)
Discussion started by: diemos
3 Replies
Login or Register to Ask a Question