Sponsored Content
Top Forums UNIX for Advanced & Expert Users Linux - Persistent routes not working Post 302221874 by ynilesh on Tuesday 5th of August 2008 12:47:55 PM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
ROUTE6D(8)						    BSD System Manager's Manual 						ROUTE6D(8)

NAME
route6d -- RIP6 routing daemon SYNOPSIS
route6d [-adDhlnqsS] [-R routelog] [-A prefix/preflen,if1[,if2...]] [-L prefix/preflen,if1[,if2...]] [-N if1[,if2...]] [-O prefix/preflen,if1[,if2...]] [-T if1[,if2...]] [-t tag] DESCRIPTION
The route6d is a routing daemon which supports RIP over IPv6. Options are: -a Enables aging of the statically defined routes. With this option, any statically defined routes will be removed unless corresponding updates arrive as if the routes are received at the startup of route6d. -R routelog This option makes route6d log route changes (add/delete) to the file routelog. -A prefix/preflen,if1[,if2...] This option is used for aggregating routes. prefix/preflen specifies the prefix and the prefix length of the aggregated route. When advertising routes, route6d filters specific routes covered by the aggregate and advertises the aggregated route prefix/preflen to the interfaces specified in the comma-separated interface list if1[,if2...]. route6d creates a static route to prefix/preflen, with the RTF_REJECT flag set, into the kernel routing table. -d Enables output of debugging messages. This option also instructs route6d to run in foreground mode (i.e., it does not become a daemon process). -D Enables extensive output of debugging messages. This option also instructs route6d to run in foreground mode (i.e., it does not become a daemon process). -h Disables split horizon processing. -l By default, route6d will not exchange site local routes for safety reasons. This is because the semantics of site local address space are rather vague, as the specification is still being worked on, and there is no good way to define the site local boundary. With -l, route6d will exchange site local routes as well. It must not be used on site boundary routers, since -l assumes that all interfaces are in the same site. -L prefix/preflen,if1[,if2...] Filter incoming routes from interfaces if1,[if2...]. route6d will accept incoming routes that are in prefix/preflen. If multiple -L options are specified, all routes that match any of the options are accepted. ::/0 is treated specially as default route, not ``any route that has longer prefix length than, or equal to 0''. If you would like to accept any route, specify no -L option. For exam- ple, with ``-L 3ffe::/16,if1 -L ::/0,if1'' route6d will accept the default route and routes in the 6bone test address range, but no others. -n Do not update the kernel routing table. -N if1[,if2...] Do not listen to, or advertise, route from/to interfaces specified by if1,[if2...]. -O prefix/preflen,if1[,if2...] Restrict route advertisement toward interfaces specified by if1,[if2...]. With this option route6d will only advertise routes that match prefix/preflen. -q Makes route6d use listen-only mode. No advertisement is sent. -s Makes route6d advertise the statically defined routes which exist in the kernel routing table when route6d is invoked. Announcements obey the regular split horizon rule. -S This option is the same as -s, except that the split horizon rule does apply. -T if1[,if2...] Advertise only the default route toward if1,[if2...]. -t tag Attach the route tag tag to originated route entries. tag can be decimal, octal prefixed by 0, or hexadecimal prefixed by 0x. Upon receipt of signal SIGINT or SIGUSR1, route6d will dump the current internal state into /var/run/route6d_dump. FILES
/var/run/route6d_dump contains the internal state dumps created if route6d receives a SIGINT or SIGUSR1 signal SEE ALSO
G. Malkin and R. Minnear, RIPng for IPv6, RFC 2080, January 1997. NOTES
route6d uses the advanced IPv6 API, defined in RFC 3542, for communicating with peers using link-local addresses. Internally route6d embeds interface identifiers into bits 32 to 63 of link-local addresses (fe80::xx and ff02::xx) so they will be visible in the internal state dump file (/var/run/route6d_dump). Routing table manipulation differs from IPv6 implementation to implementation. Currently route6d obeys the WIDE Hydrangea/KAME IPv6 kernel, and will not be able to run on other platforms. Currently, route6d does not reduce the rate of the triggered updates when consecutive updates arrive. BSD
May 25, 2006 BSD
All times are GMT -4. The time now is 09:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy