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 11-05-2004, 11:03 AM   #1
gabriele_101
Member
 
Registered: Oct 2001
Location: CAMBRIDGE, MA USA
Distribution: RH9 Kernel 2.4.20-18.9
Posts: 69

Rep: Reputation: 15
Exclamation Saving Routing Table


Running on RH 9 Kernel 2.4.20-20.9:

Issue: Using route to configure the IP routing tables is not permanent (saved). If I use the RedHat GUI network configurator, I still do not get what I want. I would like the routing table to permanently look like this:
Code:
%route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
68.126.160.128  0.0.0.0         255.255.255.248 U     0      0        0 eth0
192.168.1.0     192.168.1.1     255.255.255.0   UG    0      0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         68.126.160.129  0.0.0.0         UG    1      0        0 eth0
Lines in BLUE are command line input, lines in RED are lines that I do not want present, while lines in GREEN are lines that are OK.

QUESTION: How do I store the above routing table so that restarting the network and/or rebooting the system (same issue) does not change it?

With my network settings (see end for ifconfig information) the routing table is set up like this by default:
Code:
%route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
68.126.160.128  0.0.0.0         255.255.255.248 U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth1
0.0.0.0         68.126.160.129  0.0.0.0         UG    1      0        0 eth0
To get the routing table to look the way I want it to look, I can manually run these commands:
Code:
%route del default
%route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
And then the routing table looks like this (as desired):
Code:
%route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
68.126.160.128  0.0.0.0         255.255.255.248 U     0      0        0 eth0
192.168.1.0     192.168.1.1     255.255.255.0   UG    0      0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         68.126.160.129  0.0.0.0         UG    1      0        0 eth0
Of course, as soon as I restart the network (or reboot)....
Code:
%service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth1:                                [  OK  ]
I'm back to square one:
Code:
%route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
68.126.160.128  0.0.0.0         255.255.255.248 U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth1
0.0.0.0         68.126.160.129  0.0.0.0         UG    1      0        0 eth0
If, on the other hand, I use the redhat-config-network command to set up static routing table entries (192.168.1.0/255.255.255.0 gw 192.168.1.1 for eth1 and 0.0.0.0/0.0.0.0 gw 68.126.160.129 for eth0), I still do not get what I want:
Code:
%route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
68.126.160.128  0.0.0.0         255.255.255.248 U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth1
0.0.0.0         68.126.160.129  0.0.0.0         UG    1      0        0 eth0
0.0.0.0         68.126.160.129  0.0.0.0         UG    1      0        0 eth0
Notice the extra
Code:
0.0.0.0         68.126.160.129  0.0.0.0         UG    1      0        0 eth0
line.

So the question remains, how do I get my routing tables to look like the desired one (the first) and have them stay that way?

NOTE: at a MINIMUM, If I do NOT delete the
Code:
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth1
line, the server in question cannot access IP addresses OUTSIDE of the 192.168.1.0/255.255.255.0 network.

ifconfig output:
Code:
%ifconfig
eth0      Link encap:Ethernet  HWaddr 00:90:47:03:B3:4F
          inet addr:68.126.160.134  Bcast:68.126.160.135  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:31860 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20428 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:26605262 (25.3 Mb)  TX bytes:3809272 (3.6 Mb)
          Interrupt:5 Base address:0xc000

eth0:0    Link encap:Ethernet  HWaddr 00:90:47:03:B3:4F
          inet addr:68.126.160.133  Bcast:68.126.160.135  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3693 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:2158534 (2.0 Mb)  TX bytes:2802 (2.7 Kb)
          Interrupt:5 Base address:0xc000

eth0:1    Link encap:Ethernet  HWaddr 00:90:47:03:B3:4F
          inet addr:68.126.160.132  Bcast:68.126.160.135  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3693 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:2158534 (2.0 Mb)  TX bytes:2802 (2.7 Kb)
          Interrupt:5 Base address:0xc000

eth1      Link encap:Ethernet  HWaddr 00:50:8D:FB:E3:F4
          inet addr:192.168.1.13  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3693 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:2158534 (2.0 Mb)  TX bytes:2802 (2.7 Kb)
          Interrupt:11

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4825 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4825 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3175032 (3.0 Mb)  TX bytes:3175032 (3.0 Mb)

Last edited by gabriele_101; 11-05-2004 at 04:54 PM.
 
Old 11-05-2004, 04:22 PM   #2
gabriele_101
Member
 
Registered: Oct 2001
Location: CAMBRIDGE, MA USA
Distribution: RH9 Kernel 2.4.20-18.9
Posts: 69

Original Poster
Rep: Reputation: 15
OK, I am OFFICIALLY the only one who has not received a post. Guesses are WELCOME! ANYONE?

HEEEEEEEELP...........

-Gabriele
 
Old 11-18-2004, 04:02 AM   #3
bwtoh
LQ Newbie
 
Registered: Sep 2004
Posts: 10

Rep: Reputation: 0
Poor thing... have you found the answer ?

I am not 100% sure... but
try this:

I think the entries in the routing table are stored permanently in individual ethX.route files, for each network card (NIC).

eg :
/etc/sysconfig/networking/devices/eth0.route

The contents of these type of files should be something like this :

GATEWAY0=10.200.12.199
NETMASK0=255.255.255.240
ADDRESS0=172.28.171.30
...
...



Search the net for more answers.
Hope this helps and not a mislead.
Good luck.
 
Old 11-18-2004, 07:30 AM   #4
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
And the normal setups are in the /etc/sysconfig/network-scripts/ifcfg-eth~ files
Make sure only the ifcfg-eth0 file specifies a GATEWAY..
Also check /etc/sysconfig/network and make sure GATEWAY is not specified there.
 
  


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
permanent routing with SuSE lpoorman Linux - Networking 1 12-02-2005 08:35 PM
making chmod permanent Beckerjr Linux - General 5 05-11-2005 12:08 PM
rmmod - making the change permanent? DiBosco Linux - General 0 06-20-2004 05:32 AM
Making Changes Permanent T-u-N-i-X Linux - General 1 09-01-2003 05:47 AM
Making SMBMOUNT Permanent unclebyron Linux - General 2 01-31-2002 05:24 PM

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

All times are GMT -5. The time now is 02:22 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