[PATCH 0/6] dhcrelay: Some useful DHCPv6 additions

Bjørn Mork bjorn at mork.no
Sun Sep 25 12:59:43 UTC 2011


In case anyone else are interested, here are a few patches for
the DHCPv6 code in dhcrelay. The base is the 4.2.2 release.

We are using these internally for test purposes, simulating a 
DSLAM layer2 relay on Linux. To do this, we needed to add the 
RFC6221 support.  And we also needed some way to configure 
D6O_SUBSCRIBER_ID and D6O_REMOTE_ID options per downstream 

The -l downstream interface option was a bit overloaded before
these patches, so we just made it worse :-)  I guess this needs
some cleanup if going into production.  Maybe it's time for a
configuration file for dhcrelay as well?

Tip: configuring a Linux host for layer2 DHCP6 relaying is
pretty straight forward:

1) configure a bridge with all your upstream and downstream

    brctl addbr br0
    brctl addif br0 eth0
    brctl addif br0 eth1
    brctl addif br0 eth2

2) route anything looking like DHCPv6 or addressed to the bridge:

    ebtables  -t broute -A BROUTING -p IPv6 --ip6-proto udp --ip6-dport 546:547 -j DROP
    ebtables  -t broute -A BROUTING -p IPv6 --ip6-dst fe80::f00 -j DROP
    ebtables  -t broute -A BROUTING -p IPv6 --ip6-dst fe80::f01 -j DROP
    ebtables  -t broute -A BROUTING -p IPv6 --ip6-dst fe80::f02 -j DROP

  where fe80::f0X are the link local addresses of ethX etc. (you probably need to add 
  *all* IPv6 addresses on ethX this way, but you don't need to have any global addresses

3) run dhcrelay in RFC6221 mode (with the patches below):

     dhcrelay -6 -L -l eth1 -l eth2 -u eth0

The above of course assumes clients on eth1 and eth2 and a DHCPv6 
server (or another relay) on eth0


Bjørn Mork (6):
  dhcrelay: Refactor DHCPv6 interface-id adding code
  dhcrelay: Adding D6O_REMOTE_ID support to DHCPv6 relay
  dhcrelay: Use network byte order for the interface id value
  dhcrelay: Print interface name in DHCPv6 downstream log messages
  dhcrelay: Support RFC6221 Lightweight DHCPv6 Relay Agent operation
  dhcrelay: Add D6O_SUBSCRIBER_ID to DHCPv6 relayed packets

 relay/dhcrelay.8 |   28 +++++++++--
 relay/dhcrelay.c |  143 +++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 124 insertions(+), 47 deletions(-)


More information about the dhcp-users mailing list