[Xorp-users] Question on supporting multiple routing tables.
Ben Greear
greearb at candelatech.com
Thu Aug 9 16:33:03 PDT 2007
Pavlin Radoslavov wrote:
> Ben Greear <greearb at candelatech.com> wrote:
> The "Getting Started" Web page has quick startup information for
> configuring XORP. However, it reflects only the latest 1.4 release,
> so here is a sample config with the table IDs for VR1:
[snip]
> For VR2 just replace eth0 and eth1 with eth2 and eth3 respectively,
> change their IP addresses, and set table-id to 101.
Thanks for this, it should significantly speed up my testing!
>> In order to make the messages go over the external interfaces, the Xorp
>> code will probably
>> need an option to bind to the local IP and device. For TCP sockets that
>> can do this, my code looks like this (I don't know if this applies to
>> IPv6 or not..I've only
>> tried with IPv4.)
>
> When we transmit multicast packets (e.g., raw IP packets used by
> OSPF or UDP used by RIP), we explicitly set the outgoing interface
> by using setsockopt(IP_MULTICAST_IF).
>
> I could be wrong, but for transmitting unicast packets (if we
> exclude the Linux-specific SO_BINDTODEVICE) I don't think we (can)
> explicitly specify the outgoing interface. I believe it will be
> automatically chosen by the kernel (based on the matching forwarding
> entry toward the destination). Only if the destination is on the same
> subnet, we could use SO_DONTROUTE socket option or MSG_DONTROUTE
> flag for send*(); currently we don't which we might need to change.
>
> Could you confirm that SO_BINDTODEVICE has impact when choosing the
> outgoing interface for transmitting packets?
> The socket(7) Linux manual page describes SO_BINDTODEVICE's impact
> only for receiving packets, but the manual page itself might be
> incomplete:
SO_BINDTODEVICE does bind to the out-going interface as well. Please
note that I also bind the local IP address (which matches the interface).
I then configure the routing tables with rules so that pkts from a
particular IP use a particular routing table. I *think* that you could
skip the SO_BINDTODEVICE and just bind to the local IP, as long as you have
rules set up similar to mine. But, by also binding with SO_BINDTODEVICE I
think it will work in slightly more cases where the routing tables may
be configured differently.
I'm sure you'll want to be able to bind the socket to a local IP, but
if you want to leave out the SO_BINDTODEVICE I can test it and see
if it works. I can add the SO_BINDTODEVICE if needed and send you a patch.
No need to mess with MSG_DONTROUTE.
In case it helps, here is a snippet of 'ip ru show' on a test system:
400: from 10.1.0.2 lookup 9
400: from 2.2.2.3 lookup 19
400: from 2.2.2.2 lookup 23
foo# ip route show table 9
10.1.0.0/24 via 10.1.0.2 dev rddVR4
default via 10.1.0.1 dev rddVR4
>> So, the environ variable is still needed, in addition to the
>> unicast-forwarding { } sections above?
>
> Yes. The environmental variable is needed so you can run more than
> one XORP instance on the same machine.
Ok, that's not a problem.
> Anyway, I fixed the XORP code and now it supports table ID larger
> than 255.
Thanks,
Ben
--
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc http://www.candelatech.com
More information about the Xorp-users
mailing list