LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 05-10-2005, 09:06 AM   #1
jbako
LQ Newbie
 
Registered: May 2005
Posts: 3

Rep: Reputation: 0
where to put routing entries


I have the following routing entries that I want to make them permanent.

ip rule add from 192.168.0.0/24 table Ops
ip route add 192.168.1.0/24 via 3.25.236.29 dev ipsec0 table Ops
ip route add default via 3.25.236.29 dev eth2 table Ops

Do you have an idea where to put them?
 
Old 05-10-2005, 09:31 AM   #2
camorri
Senior Member
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1
Posts: 4,839

Rep: Reputation: 431Reputation: 431Reputation: 431Reputation: 431Reputation: 431
The route command will add routes. See man route or route --help
 
Old 05-10-2005, 09:33 AM   #3
orgcandman
Member
 
Registered: May 2002
Location: dracut MA
Distribution: Ubuntu; PNE-LE; LFS (no book)
Posts: 594

Rep: Reputation: 102Reputation: 102
I have a file /etc/rc.d/routes.rc that I use to put them. An example would look like:

-----------------------------
#!/bin/bash
#
# Route entries for the local site

ROUTE=/sbin/route
IP=/sbin/ip

if [ -e /etc/sysconfig/route-addr ]
then
. /etc/sysconfig/route-addr
else
echo "Could not load routing addresses"
exit 0
fi

$IP rule add from $NETWORKADDR1 table $NETTABLE
$IP route add $NETWORKADDR2 via $GATEADDR dev $IPSECDEV table $NETTABLE
$IP route add default via $GATEADDR dev $ETHDEV table $NETTABLE

echo "Passed addition of routes"

exit 0
------------------------------

And you'll need to add a file called /etc/sysconfig/route-addr which looks like

-------------------------------
NETWORKADDR1=192.168.0.0/24
NETWORKADDR2=192.168.1.0/24
GATEADDR=3.25.236.29
NETTABLE=Ops
IPSECDEV=ipsec0
ETHDEV=eth2
--------------------------------


Note: I haven't actually put this particular script to a test, as my script uses an array, and the route command. This should work though. Just make sure you debug any problems. Also, the routes.rc file needs to be chmod 0755. Also, add it to your init scipt process somewhere. The way to do this under sysV init is to make links in rc{0,1,2,3,4,5,6}.d to either S99routes.rc or K99routes.rc

It will ignore whatever arguments are passed in, but you can fiddle with that more if you really want to.

Aaron
 
Old 05-23-2005, 07:14 AM   #4
jbako
LQ Newbie
 
Registered: May 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Thumbs up

Works very well . Thanks for your help.

John
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
entries in securitylog pippet Linux - Security 1 08-05-2004 05:51 AM
what entries to put into fstab for new hard disk? chuck_notorious Linux - Hardware 1 04-21-2004 03:37 AM
No entries in iptables? PenguinPwrdBox Linux - Networking 9 02-18-2004 06:58 PM
real routing under nat routing nothingmuch Linux - Networking 4 10-27-2003 03:11 PM
How to save routing table entries? drgowans Linux - Networking 6 09-23-2003 02:35 PM


All times are GMT -5. The time now is 09:24 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration