[SOLVED] iproute2 in Debian lenny adds routes to the main table instead of desired table
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
iproute2 in Debian lenny adds routes to the main table instead of desired table
I perform the following:
[1]Add "1 lan" to /etc/iproute2/rt_tables.
[2]Type "ifconfig eth2 up" to bring up eth2, and verify that there are no routes for it by typing "ip route show"
[3]Type "ip route add XXX.XXX.XXX.XXX dev eth2 table lan"
[4]Type "ip route add default via XXX.XXX.XXX.XXX dev eth2 table lan"
[5]Type "ip route flush cache"
[6]Type "ip route show table lan". There is no response.
[7]Type "ip route show table main". There are the routes that I added in steps [3] & [4].
Can someone tell me why the routes are added to the main routing table instead of to the lan table? The kernel version is 2.6.21.
I add routing tables by simply specifying them when adding the route, like in
ip route add default table 8 dev tun0
ip route show table 8
default dev tun0 scope link
I think it adds the routes to the default table because it doesn't recognise the named table you defined in the config file.
Did you restart the service/reboot after the changes in the config file?
Yes, I executed "/etc/init.d/networking restart" after making the changes to rt_tables. I also just tried adding the route with a number like you did, but that didn't work either:
tcors01:/etc# ip route show
192.168.128.0/24 dev eth3 proto kernel scope link src 192.168.128.101
129.116.134.0/24 dev eth2 proto kernel scope link src XXX.XXX.XXX.XXX
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
tcors01:/etc# ip route add default table 1 dev eth2
tcors01:/etc# ip route show table 1
tcors01:/etc# ip route show table main
192.168.128.0/24 dev eth3 proto kernel scope link src 192.168.128.101
129.116.134.0/24 dev eth2 proto kernel scope link src XXX.XXX.XXX.XXX
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 dev eth2 scope link
tcors01:/etc#
I upgraded iproute2 from the lenny version to the squeeze version (20100519-3), but this did not seem to make a difference.
I went ahead and rebuilt the kernel adding:
CONFIG_NETFILTER_XTABLES=m
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
to the kernel configuration. I don't think they are required for iproute2, but I know that they are required for other things (Shorewall), so I put them in there.
After rebooting, I get the expected behavior from the "ip route add ... table lan" command. I'm not sure what the magic bullet was, but it is working for the moment, so I will mark this thread as solved.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.