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)