@@ -455,6 +455,111 @@ The configuration will look as follows:
455455 subnet-id 1
456456 }
457457
458+ Relay agent information (Option 82)
459+ -----------------------------------
460+
461+ Some DHCP relays support the injection of information into a DHCP request, depending on
462+ where the request originated from. This is commonly used to determine the
463+ behaviour of the DHCP server, based on the port/switch combination where the
464+ request was first detected. I.e. the device plugged into a particular port (or
465+ set of ports) always gets the same IP address (or range of IP addresses). This
466+ information is usually included in the request using Option 82, hence this
467+ is what we call this part of the configuration.
468+
469+ This behaviour is controlled in two parts. First, "client classes" are defined
470+ which determine which inputs match. Once a positive match has been found the
471+ request is "tagged" with this client class. Second, when the DHCP server
472+ processes the request it checks to see if the configuration has a client class
473+ defined. If it does then that part of the configuration will override the others
474+
475+ Client classes can be applied at either the subnet or range level, depending on
476+ how you want the server to behave.
477+
478+ **Client Class definition **
479+
480+ .. cfgcmd :: set service dhcp-server client-class <name> relay-agent-information circuit-id
481+ <value>
482+
483+ Create a new client class (if not already defined) and set it to match on
484+ the "Circuit ID" part of the Option 82 field in the DHCP request. This is
485+ sub option "1" as specified by RFC 3046. The value specified here is either
486+ interpreted as a raw hex value, if it starts with the prefix 0x, or ASCII text
487+ otherwise. e.g. ``e1-5 `` and ``0x65312d35 `` are the same
488+
489+ .. cfgcmd :: set service dhcp-server client-class <name> relay-agent-information remote-id
490+ <value>
491+
492+ Create a new client class (if not already defined) and set it to match on
493+ the "Remote ID" part of the Option 82 field in the DHCP request. This is
494+ sub option "2" as specified by RFC 3046. The value specified here is either
495+ interpreted as a raw hex value, if it starts with the prefix 0x, or ASCII text
496+ otherwise. e.g. ``10.100.0.41 `` and ``0x31302e3130302e302e3431 `` are the
497+ same
498+
499+ **Client Class application **
500+
501+ .. cfgcmd :: set service dhcp-server shared-network-name <subnet-name> subnet
502+ <CIDR> client-class <class-name>
503+
504+ Applies the Client Class with the name `<class-name> ` to the subnet `<subnet-name> `.
505+ This means that whenever the client class matches a request it is always
506+ routed to this subnet definition first.
507+
508+ .. cfgcmd :: set service dhcp-server shared-network-name <subnet-name> subnet
509+ <CIDR> range <range-name> client-class <class-name>
510+
511+ Applies the Client Class with the name `<class-name> ` to the range
512+ `<range-name> ` which belongs to subnet `<subnet-name> `. This means that whenever the
513+ client class matches a request it is always routed to this range definition
514+ first.
515+
516+ NB: Kea (the DHCP server used by VyOS) is programmed to offer as many
517+ alternatives as it can to repeated DHCP Discover requests. Some operating
518+ systems (Notably Microsoft Windows) make multiple DHCP Discover requests before
519+ settling on an address. This particularly seems to happen when the DHCP server
520+ isn't set to authorative. This may explain why the address you espect isn't
521+ being chosen. Wireshark is helpful in these situations.
522+
523+ **Example: **
524+
525+ The following configuration example will classify requests coming in on port
526+ ``e1-5 `` from DHCP Relay ``192.0.2.1 `` and make sure that they are allocated the
527+ address ``192.0.2.4 ``. Any requests which do not match the circuit and remote ID
528+ will, instead, be allocated from the range otherRange in the usual manner.
529+
530+ NB: Both the Circuit ID and Remote ID fields are arbitrary free text. *Most *
531+ switches set the Remote ID to the IP address of the management interface but
532+ that should not be relied upon. Check the documentation of your DHCP Relay for
533+ more detail or, as a measure of last resort, inspect the DHCP requests in
534+ Wireshark.
535+
536+ .. code-block :: none
537+
538+ service {
539+ dhcp-server {
540+ client-class className {
541+ relay-agent-information {
542+ circuit-id e1-5
543+ remote-id 192.0.2.1
544+ }
545+ }
546+ shared-network-name test {
547+ subnet 192.0.2.0/24 {
548+ range classNameRange {
549+ client-class className
550+ start 192.0.2.4
551+ stop 192.0.2.4
552+ }
553+ range otherRange {
554+ start 192.0.2.5
555+ stop 192.0.2.100
556+ }
557+ subnet-id 1
558+ }
559+ }
560+ }
561+ }
562+
458563 Options
459564=======
460565
0 commit comments