dhcpcd-discuss

Re: Multihoming support in dhcpcd (source-dest routing)

Roy Marples

Sun Feb 08 11:47:34 2015

Hi

On 05/02/2015 23:33, Baptiste Jonglez wrote:
> I'd like to extend dhcpcd to support routing based on the source address
> (and not only the destination address).  Some people call that source-dest
> routing, others call that source-specific routing:
> 
>   http://www.pps.univ-paris-diderot.fr/~boutier/source-specific-routing.html
> 
> Supporting this kind of routing is going to be very useful, as using
> multiple Internet connections is becoming more and more common.
> 
> Linux already supports source-dest routing (through IPV6_SUBTREES for
> IPv6, or through ip-rule and multiple routing tables for IPv4), but there
> is almost no userspace tool automating the required configuration.
> For instance, Multipath TCP needs such a source-dest configuration to
> work, but it is done either by hand or through scripts:
> 
>   http://multipath-tcp.org/pmwiki.php/Users/ConfigureRouting
> 
> 
> I think it is possible to make dhcpcd aware of source-dest routing, so
> that things would just work when receiving multiple RA or DHCPv4 leases.
> 
> For IPv6 without DHCPv6, it's quite simple to support on Linux.
> When receiving a RA with a prefix (say 2001:db8:42::/64) and a default route,
> it's only a matter of doing (the netlink equivalent of):
> 
>   ip -6 r add default from 2001:db8:42::/64 via fe80::42 dev ethX
> 
> This adds a default route that will only match for packets whose source
> address is in 2001:db8:42::/64.  If we receive another RA (possibly on the
> same interface) from another router/ISP, then it's just a matter of adding
> another source-specific route:
> 
>   ip -6 r add default from 2001:db8:1337::/64 via fe80::1337 dev ethY
> 
> With these two routes in place, an application (or Multipath TCP) can
> choose which ISP it will use by just setting the source address
> appropriately.
> 
> 
> For IPv4, it's more tricky to automate, as it involves ip rule and
> multiple routing tables, but it's still doable (LARTC has a chapter about
> it: http://lartc.org/howto/lartc.rpdb.html).  Basically, dhcpcd would need
> to create a routing table with a default route for each DHCP lease it
> receives, and add the corresponding ip-rules to redirect to the right
> routing table based on the source address of packets.
> 
> 
> What would be the best way to implement the above ideas?  It looks
> possible to do it by directly calling "ip" in hooks (although I haven't
> found the necessary variables), but I'm not sure it's the cleanest
> approach.  Maybe it could be integrated directly into dhcpcd?

dhcpcd manages the routing table itself internally so manipulating it
via the hooks, while possible, could lead to interesting errors.
For ipv6, look at ipv6.c ipv6_buildroutes() function which is called
each time dhcpcd has an IPv6 event such as receiving a RA or DHCPv6
message (or they expire).

Question though - if we only have one default route, marked with a from
address, can other global addresses still use the route if on a
different prefix? If the answer is yes then we probably won't need a
config option for it, otherwise we will.

There's a similar function in ipv4.c for IPv4 routing.

Can you do a patch for this if needed? My time to spend in dhcpcd is
fairly limited right now to bug fixing only.

Roy

Attachment: signature.asc
Description: OpenPGP digital signature


Follow-Ups:
Re: Multihoming support in dhcpcd (source-dest routing)Baptiste Jonglez
Re: Multihoming support in dhcpcd (source-dest routing)Bernd May
References:
Multihoming support in dhcpcd (source-dest routing)Baptiste Jonglez
Archive administrator: postmaster@marples.name