Add switchname/vlan id to dhcprelay pif-circuit-id


I would like to use option 82 to assign devices an ip based on the port on which they are connected. However when I use the pif-circuit-id I only see the switch port a format like
switch.port.vlan would make it easier to uniquely identify a device

4 replies

Userlevel 3
Hi Eelco,

I am not sure what the use-case is for requiring the vlan and port, so if I missed the point, please elaborate on the problem you are trying to solve.

The gi-addr field should be uniquely identifying the relay switch. Then the -a (circuit-id) option will put the SVI interface in the relay header by default. This would be something like "bridge.11" or "vlan11" depending on how you define the SVI. Obviously the pif-circuit-id alters this behavior, and puts the physical interface (swp1) in the circuit-id field, providing the most granular information, since a port can only be connected to a single device.

My feeling here is the relay packet should have plenty of identification information:
- mac-address
- gi-addr (switch)
- circuit-id to indicate the SVI/VLAN -or- pif-circuit-id to indicate the physical connection.

What you do with this information is all in how the dhcp server is configured. You can use client classification, static reservations, and many other tools to identify the initiator of the DHCP discover. For some really cool server-side tooling, check out ISC's new Kea DHCP server. It can do some really interesting things.
I checked out Kea and this works fine. With DHCPD reservations are global. With Kea they are tied to a subnet. As I will be using a management subnet per TOR switch. I can easily link a port to a subnet. As each subnet is linked to only one TOR. I can achieve what I want. I'll post my relevant Kea config when I cleaned it up a bit
Userlevel 3
Excellent! I am excited to see what you do for this. I know the ISC guys put a lot of effort into the code for subnet selection, host reservations, and client classification. There is a lot of power and flexibility in Kea.
It has been some time but we decided to stay with isc-dhcpd for now as the ubuntu packages for KEA are only still at 1.1
This ISC-DHCPD config works find as classes are also tied to a scope. The hostname are a bit more complex but edited for privacy reasons

 option cumulus-provision-url code 239 = text; subnet 172.20.1.0 netmask 255.255.255.0 {   default-lease-time 900;   max-lease-time 900;   min-lease-time 900; #  range 172.20.1.10 172.20.1.30;   option routers 172.20.1.1;    class "spine1" {  match if option agent.circuit-id = "swp1";  }   pool {  allow members of "spine1";  range 172.20.1.91;         option cumulus-provision-url "http://172.20.0.2/cumulus_base.sh";         option host-name "spine1";  }   class "spine2" {  match if option agent.circuit-id = "swp2";  }   pool {  allow members of "spine2";  range 172.20.1.92;         option cumulus-provision-url "http://172.20.0.2/cumulus_base.sh";         option host-name "spine2";  } }  

Reply