An Address for Every Port
How DHCP relay and option 82 give the device on each port a fixed address, coming in Infix OS v27.01
A camera on port 3 breaks. Someone unscrews it and mounts the spare, and the spare has to come up with the address of the old one, or the video system does not find it. The usual way is to look up the MAC address of the spare and edit the DHCP server before the swap, which is not what anyone wants to do from the top of a ladder.
A DHCP relay agent with option 82 ties the address to the port instead of the device. Infix OS v27.01 brings one, dhcprelayd 3.0, along with new DHCP pages in the web interface that set it up in a few clicks.
The Relay Agent
A device that starts without an address broadcasts a DHCPDISCOVER to everyone on the LAN, and any DHCP server that hears it may answer with an offer. Routers do not forward broadcasts, so a server on another network never hears the request.
A relay agent is the way around that. It runs on a router or switch
with an address on the client network, picks up the broadcasts, and
sends them on as unicast to one or more DHCP servers. It also writes
its own address on the client network in the request, as the gateway
address, giaddr, which tells the server which subnet the client is on
and which pool to pick an address from. The replies come back the same
way.
Option 82
On a switch, the relay agent knows one more thing that the server does not: the port the request came in on. With option 82, the relay agent information option from RFC 3046, it passes that on. The option has two parts, the circuit-id, which names the port, and the remote-id, which names the relay agent.
Figure 1: A request before and after the relay agent. The
gateway address is set, and option 82 added with the port and the name
of the switch.
A server that looks at option 82 can hand out addresses per port
instead of per MAC address. The camera on port e1 gets 10.0.0.41,
whatever camera it is.
Figure 2: A switch relaying from three ports to a DHCP server
with one address set for each port.
Two details decide if this works in practice. The first is the lease of the old device. It has usually not expired when the spare asks, so a server that plays by the book offers the spare another address, or none. The server has to let the port win over the lease.
The second is the switch itself. A switch floods a broadcast to its other ports before the CPU sees it, so the request also reaches the server, or the next relay agent, without option 82. The switch has to trap DHCP requests to the CPU and leave the forwarding to the relay agent.
In Infix OS
Infix OS takes care of both. It can also run the server and the relay agent on the same device, so one switch on its own gives each of its ports an address. That is the setup shown here, in the web interface.
Under Configuration, DHCP, Set up asks what the device should do, and sets up both the relay agent and the server that this case needs:
Figure 3: The setup wizard, with a fixed address per port on
bridge br0.
The wizard stages the result as any other change, so it can be read in the changes pane before it is applied. For the bridge above that is a static host for each port, matched on the circuit-id the relay agent adds. Preempt is what lets the spare take over the address at once:
Figure 4: The DHCP server, with one static host per port.
The other half is the relay agent on the same bridge, with every port relayed from, and the port name as circuit-id:
Figure 5: The relay agent, with the ports of the bridge.
From there, a port can be left out, marked as trusted when it leads to
another relay agent, or given another circuit-id. Status, DHCP shows
it working, here with the device on e1 holding the first address:
Figure 6: Status of the relay agent, with counters and the last
client on each port.
The same is there without a browser, in the CLI, and over NETCONF and RESTCONF:
admin@example:/> show dhcp-relay
br0 : gateway address 192.168.1.1
INTERFACE PORT REQUESTS RELAYED DROPPED REPLIES CLIENT ADDRESS LAST REQUEST
br0 2 2 0 2
e1 2 2 0 2 ae:b6:69:3c:c9:e0 192.168.1.11 2026-12-01 18:52:07
e2 0 0 0 0
SERVER INTERFACE REQUESTS REPLIES LAST REPLY
127.0.0.1 2 2 2026-12-01 18:52:07
A dropped request is logged with the client, the port and the reason.
Coming in Infix OS v27.01
All of this lands in Infix OS v27.01:
- A DHCP relay agent for IPv4, on any interface with an address. On a bridge, or a VLAN interface on top of a bridge, requests are relayed per bridge port
- Option 82 with circuit-id, by default the port name, and remote-id, by default the base MAC address of the device
- A
policyfor requests that already carry option 82:replace, which is the default,keepordrop. A client cannot pick its own circuit-id, and with it someone else’s address trustedports, for chains and rings of relaying switchesforce-server-identity, from RFC 5107, so renewals also pass the relay agent- In the DHCP server, a static host can match on circuit-id, remote-id
or both, and
preemptlets a new device take over the address before the old lease has expired - The DHCP pages in the web interface, with the setup wizard, for both the server and the relay agent
- DHCP requests are trapped to the CPU on Marvell mv88e6xxx, MediaTek MT7531 and Microchip SparX-5 and lan969x switches
The relay agent is DHCPv4 only, and it always sets the gateway address, so every relaying switch needs an address in each VLAN it relays from.
The relay agent is dhcprelayd. It began as Simon Kelley’s dhcp-helper, and Westermo added bridge and option 82 support in 2018, as dhcp-helper v2.0. dhcprelayd 3.0 is the first release under the new name, with a new configuration file format, the option 82 policy, trusted and tagged ports, a status file with counters and a new test suite. It runs on any Linux system with a bridge, and its ChangeLog has the details.
