Multihoming support in dhcpcd (source-dest routing)
Baptiste Jonglez
Thu Feb 05 23:33:07 2015Hi, 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? Thanks, Baptiste
Attachment:
pgpRN6dhzv6xw.pgp
Description: PGP signature
| Re: Multihoming support in dhcpcd (source-dest routing) | Roy Marples |