/sbin/route and virtual interfaces

Rob Bringman (rob@trion.com)
Fri, 3 Sep 1999 12:33:07 -0400


/sbin/route doesn't seem to be doing what the man page says it should.

I have a redhat 5.2 box with the following upgrades-
kernel-2.2.11 (compiled by hand)
initscripts-3.78-2.4.i386.rpm
ipchains-1.3.8-0.i386.rpm
modutils-2.1.121-0.i386.rpm
mount-2.9-0.i386.rpm
net-tools-1.50-0.i386.rpm
procinfo-15-0.i386.rpm
util-linux-2.9-0.i386.rpm

I'm using the box as a router/firewall it has two ethernet cards, one
for the "inside" network and one for the "outside" networks with has
three virtual interfaces (because there are three ip networks on this
ethernet segment.

When I assign a route to a network beyond the "outside" network, it
always uses eth0 and not eth0:0 or eth0:1 like it should.

example-

[root@spy rob]# /sbin/ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:A0:C9:03:7F:EC
inet addr:172.16.1.3 Bcast:172.16.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1837 errors:0 dropped:0 overruns:0 frame:0
TX packets:1561 errors:0 dropped:0 overruns:0 carrier:0
collisions:155 txqueuelen:100
Interrupt:9 Base address:0xfce0

eth0:0 Link encap:Ethernet HWaddr 00:A0:C9:03:7F:EC
inet addr:172.19.1.3 Bcast:172.19.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:9 Base address:0xfce0

eth0:1 Link encap:Ethernet HWaddr 00:A0:C9:03:7F:EC
inet addr:172.17.1.3 Bcast:172.17.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:9 Base address:0xfce0

eth1 Link encap:Ethernet HWaddr 00:AA:00:BC:EF:34
inet addr:172.16.2.250 Bcast:172.16.2.255
Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:688 errors:0 dropped:0 overruns:0 frame:0
TX packets:464 errors:0 dropped:0 overruns:0 carrier:1
collisions:0 txqueuelen:100
Interrupt:11 Base address:0x300

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0

ot@spy rob]# /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
208.210.55.0 172.16.1.1 255.255.255.0 UG 1 0 0 eth0
172.17.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
172.19.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo

[root@spy rob]# /sbin/route add -host 192.168.1.5 gw 172.19.1.1 metric 1 dev eth0:0

[root@spy rob]# /sbin/route -n0:0
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.5 172.19.1.1 255.255.255.255 UGH 1 0 0 eth0
172.16.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
208.210.55.0 172.16.1.1 255.255.255.0 UG 1 0 0 eth0
172.17.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
172.19.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo

###
note the route for 192.168.1.5 is using the *wrong* interface. It
needs to be using eth0:0
test it with--
###

[root@spy rob]# /usr/sbin/traceroute 192.168.1.5
traceroute: Warning: Multiple interfaces found; using 172.16.1.3 @ eth0
traceroute to 192.168.1.5 (192.168.1.5), 30 hops max, 40 byte packets
1 * * *
2 *

### this proves it. its trying to go out eth0 and not eth0:0 like it
should

I noticed there is a more recient version of net-tools for RH 6.0, but
hte RPM requires a newer glib that the one on my box. If we know for
sure this will fix my problem, I can try to build it from source. Can
anyone verify this?

-- 
Robert Bringman, Network/System Administrator     mailto:rob@trion.com
TRION Technologies, Inc.                          http://www.trion.com

To understand recursion, one must first understand recursion.

- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.rutgers.edu