[LARTC] The "ip route get" returns wrong interface and gateway in an multipath routing environment

e.janz at barceloviajes.com e.janz at barceloviajes.com
Wed Apr 18 13:06:22 CEST 2007


Hi,

I think I found a problem in iproute or ubuntu kernel. I think that the 
"ip route get" returns wrong interface and gateway in an multipath routing 
environment on Ubuntu 6.06 LTS.
I reported it also to launchpad as a bug: 
https://bugs.launchpad.net/ubuntu/+source/iproute/+bug/105521

The easiest way to reproduce it is to start an Ubuntu 6.06 LTS Live on a 
system with three IF's and setup the environment as follows:

root at ubuntu:~# ifconfig eth0 192.168.0.1 netmask 255.255.255.0 broadcast 
192.168.0.255 up
root at ubuntu:~# ifconfig eth1 192.168.1.1 netmask 255.255.255.0 broadcast 
192.168.1.255 up
root at ubuntu:~# ifconfig eth2 192.168.2.1 netmask 255.255.255.0 broadcast 
192.168.2.255 up
root at ubuntu:~# ip route add default nexthop via 192.168.1.254 dev eth1 
weight 1 nexthop via 192.168.2.254 dev eth2 weight 1
root at ubuntu:~# ip rule add prio 111 from 192.168.1.1 table 111
root at ubuntu:~# ip rule add prio 222 from 192.168.2.1 table 222
root at ubuntu:~# ip route add default table 111 via 192.168.1.254
root at ubuntu:~# ip route add default table 222 via 192.168.2.254

root at ubuntu:~# ip route ls
192.168.2.0/24 dev eth2 proto kernel scope link src 192.168.2.1
192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.1
default
        nexthop via 192.168.1.254 dev eth1 weight 1
        nexthop via 192.168.2.254 dev eth2 weight 1

root at ubuntu:~# ip rule ls
0: from all lookup local
111: from 192.168.1.1 lookup 111
222: from 192.168.2.1 lookup 222
32766: from all lookup main
32767: from all lookup default

root at ubuntu:~# ip route ls table 111
default via 192.168.1.254 dev eth1
root at ubuntu:~# ip route ls table 222
default via 192.168.2.254 dev eth2

root at ubuntu:~# uname -a
Linux ubuntu 2.6.15-23-386 #1 PREEMPT Tue May 23 13:49:40 UTC 2006 i686 
GNU/Linux

root at ubuntu:~# ip -V
ip utility, iproute2-ss041019

root at ubuntu:~# ip route get 1.2.3.1
1.2.3.1 via 192.168.2.254 dev eth2 src 192.168.1.1
    cache mtu 1500 advmss 1460 hoplimit 64
root at ubuntu:~# ip route get 1.2.3.2
1.2.3.2 via 192.168.2.254 dev eth2 src 192.168.2.1
    cache mtu 1500 advmss 1460 hoplimit 64

As you can see, the "ip route get" always returns ".. via 192.168.2.254 
dev eth2 ..." and only switches the source ip but not the corresponding 
interface and gateway. I saw this behaviour a long time ago on Debian, but 
by now, on Debian Woody this is working fine as least on kernel 2.6.14 and 
2.6.16 with the same iproute package and the "ip route get" output also 
gives the right interface and gateway ( I did not test it on more 
environments ). On an installed Ubuntu 6.06 LTS the behaviour is also 
wrong ( I found this problem on a 2.6.15-28-server kernel with the same 
iproute package ).

¿ Any idea why this is happening ? ¿ Is this a regression ? ¿ Any 
suggestions ?


Kind Regards,
Eric Janz
--

ADVERTENCIA LEGAL
El contenido de este correo es confidencial y dirigido unicamente a su destinatario. Para acceder a su clausula de privacidad consulte http://www.barceloviajes.com/privacy

LEGAL ADVISORY
This message is confidential and intended only for the person or entity to which it is addressed. In order to read its privacy policy consult it at http://www.barceloviajes.com/privacy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ds9a.nl/pipermail/lartc/attachments/20070418/3e77e302/attachment.html


More information about the LARTC mailing list