LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-01-2006, 10:55 PM   #1
Zepiroth
Member
 
Registered: May 2003
Location: Surabaya, Jawa Timur, Indonesia
Distribution: Debian x64 and Ubuntu LTS Servers
Posts: 56

Rep: Reputation: 15
Unhappy Permanent Routing changes using "ip route".


Dear Experts,

I am trying to implement a complex policy routing using
"ip route" command. My problem is the changes could not
be saved permanently.
I have change and experimenting to change the (policy) routing tables. But every reboot will reset the
routing table to its default state.

I already search this forum for the same case.
my found reference is :
http://www.linuxquestions.org/questi...+routing+table

But it is still using "route" command, not "ip route".

for policy routing, I have read and study from :
http://linux-ip.net/
( Policy Routing tables is in chapter 4.8 )

Is there any command to save the changes into the routing table ? or Is there something I miss from my references ?

Thank you in advance.
I am looking forward to hear from you.
 
Old 08-03-2006, 07:05 AM   #2
r0b0
Member
 
Registered: Aug 2004
Location: Europe
Posts: 608

Rep: Reputation: 50
Well, if you can't figure out how to save these settings "your distro's way", then you can just write all the commands you use to a file and have this file executed as a script on machine boot. Put this file somewhere in /etc/init.d/ or /etc/rc*.d/ depending on your distribution.
 
Old 08-03-2006, 08:59 AM   #3
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Mandrake & Redhat have directories for pre-up and post-up scripts.
You will have to decide how much to split the files so that the routing is still correct if you manually bring an interface down. If that's not going to ever happen, add it to the runlevel startup scripts at an approprite position.

Make sure any script that runs has the last line "ip route flush cache" or you'll get stale routing info making some interesting problems.

Last edited by peter_robb; 08-03-2006 at 09:00 AM.
 
Old 08-30-2006, 08:06 PM   #4
Zepiroth
Member
 
Registered: May 2003
Location: Surabaya, Jawa Timur, Indonesia
Distribution: Debian x64 and Ubuntu LTS Servers
Posts: 56

Original Poster
Rep: Reputation: 15
Smile

Dear r0b0 and Peter Robb,

Thank you for replying.
I am using Fedora Core 3 for this case.
As a temporary solution, I just modify the default routing table with a script added into /etc/rc.d/rc.local.

dear Peter Robb :
regarding the initial startup script you mentioned,
is it : /etc/sysconfig/network-scripts/ifcfifup-routes ?
or /etc/sysconfig/network-scripts/ifup-routes ?

Should I modify this file ?

Thank you in advance.
 
Old 09-01-2006, 12:44 PM   #5
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
In rc.local is fine if the interfaces are not expected to go up and down during a normal day..

Open ifup-routes and read the script it contains. You will see references to either $1-route or route-$1. In this case $1 is the interface that is being set.

They are designed to make dynamic changes for interfaces that go up & down regularly, eg vpn, ppp, ipsec, dsl etc.
If yours don't, it's safer to use rc.local and set it once.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
a/p connected, route correct, ping router: "Destination Host Unreachable". DebianEtch shinyblue Linux - Wireless Networking 1 08-29-2006 09:34 PM
Need to make bus mastering setting permanent using "setpci". Zombie13 Fedora 0 09-01-2005 08:01 AM
Route to subnet exists but I get "Network unreachable" when adding default route fciuffani Linux - Networking 4 08-18-2004 02:11 PM
could "no route to host" be caused by non-crossover cable? brandonweinberg Linux - Networking 13 01-31-2004 09:47 AM
Permanently set "route add" -host and default gw sacants Linux - Newbie 1 07-18-2003 04:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration