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 09-05-2003, 01:28 PM   #1
piratebiter
Member
 
Registered: Aug 2003
Location: desert
Distribution: RH 8, Debian
Posts: 61

Rep: Reputation: 15
how do you make the route table/defaults stick on reboot?


After several days i've managed to get my firewall box routed some. It has three NICs... i use RH8.
eth0 is the Inet_iface
eth1 is the Lan_iface
eth_2 is the DMZ_iface

I robbed an IPtables file from my other rh8 box and got the darned thing to the net finally... so the Iptables will sort later.. but for now...
iptables -L yields a nice long list of standard medium RH firewall rules... and it goes to the net... who cares how secure for now... no use sending me three pages of fancy three legged IPtable rules unless the network works? Right now Iptables is installed and works as does ip-forward =1. All three NIC cards are up and have unique mac addr.

i would like to save this route table permanently? please share the commnads to do that?

to get the route to work with all three cards up i did some temporary commands. and got the thing up ex:

/sbin/route add default gw 206.97.61.1 dev eth0, then eth1, then eth2

Destination Gateway GenMask Flags Metric ref Iface
192.168.1.0 * 255.255.255.0 U 0 0 eth2
192.168.0.0 * 255.255.255.0 U 0 0 eth1
206.97.0.0 * 255.255.0.0 U 0 0 eth0
127.0.0.0 * 0.0.0.0. U 0 0 lo
default 206.97.61..ip. 0.0.0.0. UG 0 0 eth0

the /etc/sysconfig/network-scripts ifcfg-ethx files
eth0
ipaddr 206.97.61.128
bcast 206.97.61.255
Gateway 206.97.61.1.ip. ( I do not understand the .ip.?) it works?

eth1
ipaddr 192.168.0.1
bcast 192.168.0.255
NO gateway

eth2
ipaddr 192.168.1.1
bcast 192.168.1.1
No gateway


this route seems to be ok, at least I can get the box to the net finally.
I know IF I reboot it is gone... and will have to be redone... I guess the next step would be to lock in this route? ideas?

thanks much,
P.Biter
 
Old 09-05-2003, 01:41 PM   #2
yocompia
Member
 
Registered: Apr 2003
Location: Chicago, IL
Distribution: openbsd 3.6, slackware 10.0
Posts: 244

Rep: Reputation: 30
i'm not too familiar with RH or debian, but i'd just script it to make the routes on boot. the commands you issue are things like

route add <blah>,

so just put the list of commands you issue to setup the routing in a startup script.

i don't know where to look on RH or debian (it's in /etc/rc.d/rc.inet2 in slackware), but i'd just put those route commands in the startup script that starts all your network services (iptables, various daemons, etc.).
 
Old 09-05-2003, 01:50 PM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
You can use:
/etc/sysconfig/static-routes

http://www.redhat.com/support/resour...ig-Tips-4.html
 
Old 09-05-2003, 06:57 PM   #4
piratebiter
Member
 
Registered: Aug 2003
Location: desert
Distribution: RH 8, Debian
Posts: 61

Original Poster
Rep: Reputation: 15
Here's several others with the same ? I will go check out the static-routes as a way to get it stuck, thanks much David,
P.Biter

well you can put all the route command you used in /etc/rc.d/rc.local so they will get run everytime the machine is restarted. Why would you need to restart the network service? My linux firewall/router has been up for 108 days, and I've never had to touch it. Just wondering.
Comment from aleksandrzingorenko Date: 07/18/2003 12:18PM PDT In that case (and in light of some new information I found out), I will rephrase my question. As I can see, when I restart the network, some program resets the routing table to the weird defaults and changes the /proc/net/route file. What program does this, where does it get these defaults from, and how do I make it set up the correct routing table instead when the network is started/restarted?
Comment from jlevie Date: 07/18/2003 03:58PM PDT A more appropriate question is what routes are set up by default and what changes do you find necessary and why? Comment from brabard Date: 07/21/2003 01:48AM PDT /proc/net/route is an informational file , not comand . It is changed every time a route has been added/deleted . The first thing ../network restart do is to restart interfaces . After that it makes routing table as it is in your ifcfg- scripts writen . Usualy there is paths to networks to witch interfaces belongs and the dafault gateway . If you want to put new routes in rc.local as jar3817 said it will work on reboot , but not in network reload , because this command do not restart rc.local .
Comment from aleksandrzingorenko Date: 07/21/2003 09:41AM PDT This is in response to jlevie's comment. I have three NICs in the firewall machine, eth0 through eth2. eth0 is the external interface, while eth1 is the interface to the computers protected by the firewall; eth2 is currently unconnected. Whenever I reboot the firewall machine (or merely restart the network by running the network script with the restart option) and then run route or netstat -r, I see two identical routes to the network protected by the firewall (private IP range) through eth2 instead of eth1, and I also see a route to some Class B network through eth2 which is completely out of place - I have never entered such IP addresses anywhere on the firewall machine or anywhere else. Hence, every time a network restart occurs, I must manually delete the 3 errant routes to eth2 and add the correct one to eth1. Furthermore, if I try to run an ifcfg script which binds a range of IP aliases to eth0 - very simple script, only contains starting and ending IP address and starting clonenumber - the routing table is even stranger, among other things, it has 3 identical default destinations even though there should only be one. I would really like to know if it is at all possible to prevent this "damage" to the routing tables and have the correct one load each time the network is started/restarted.

course this all academic... I changed one setting after the post this AM and the whole thing went bloohie.... (bloohie is very tech term for time for dinner)

P.Biter
 
  


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
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM
How to add a route table for eth1 and make it the default banner Linux - General 3 05-08-2005 11:14 AM
What in happening to my route table??? Julian_Thong Linux - Networking 2 08-22-2004 01:16 PM
Route table christianj Linux - Networking 3 11-17-2002 08:24 AM
Modify route table juno Linux - General 2 10-05-2002 08:42 AM


All times are GMT -5. The time now is 05:41 AM.

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