DHCPv6 support for relay options in ISC DHCP 4.3
  • 25 Oct 2018
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

DHCPv6 support for relay options in ISC DHCP 4.3

  • Dark
    Light
  • PDF

Article Summary

Question:

How can I access relay agent options in my DHCPv6 configuration?

Answer:

Unlike in DHCPv4, in DHCPv6 each relay agent along the packet path will add its own set of relay agent options, encapsulating the options of all prior relay agents, with the specification mandating support for up to 32 sets of relay agent options. This complicates accessing these options because you have to specify which set of options you wish to look at.

To support this, we have added the v6relay expression and extended the host-identifier statement with a v6relopt expression.

The v6relay expression allows access to the nested relay agent options in statements. This works by taking two arguments: the first specifies which relay agent to look at, and the second specifies which relay agent option to look at. Each relay agent is numbered in order from the client, starting with 1 and continuing through 32.  Additionally, the value 0 indicates the client-supplied options, and values greater than 32 indicate the relay agent closest to the server no matter what number it would be. If the agent specified is not present, v6relay will return nothing, the same as if that agent did not specify the requested option.

# look at what the relay closest to the server says
if v6relay(33, option dhcp6.subscriber-id) = "client_1" { log(info, "client_1 closest to server"); }

# look at what the relay closest to the client says
# if there is only one set of relay agent options then both 33 and 1 will look at the same data
if v6relay(1, option dhcp6.subscriber-id) = "client_1" { log(info, "client_1 closest to client"); }

# probably will not match anything
if v6relay(32, option dhcp6.subscriber-id) = "client_1" { log(info, "client_1 from agent 32"); }

The v6relopt expression of the host-identifier statement allows you to specify a relay agent option option to be used as the host-identifier. Its syntax and semantics parallel those of the v6relay expression.

# this matches at the relay agent closest to the server, if any
host client_3 {
  host-identifier v6relopt 33 dhcp6.subscriber-id "client_3";
}