Relayd not forwarding broadcast (BOOTP/DHCP) responses

Thanks @muxx for sharing your findings.

Running a Mikrotik router/AP and an OpenWrt wireless bridge, after RouterOS upgrade to 6.47 I found myself in exact same situation as you describe. DHCP packets from the server are now coming with a unicast L2 address and are not relayed.

Judging from sources, relayd indeed only watches for DHCP packets with broadcast or multicast addresses. I don't feel up to devising a fix, maybe we could file a feature request.

Anyway, my current solution is to stop relying on relayd's DHCP capabilities and use a standalone DHCP relay. There are multiple implementations to choose from, I went for dnsmasq as it's already installed and well integrated (ready with init.d script etc.)

First step is to run relayd without the -D parameter. Can be done in /etc/config/network:

config interface 'sta_bridge'
        option proto 'relay'
        option network 'lan wwan'
        ...
        option forward_dhcp 0 # add this

Second, configure dnsmasq as DHCP relay. This is how my /etc/config/dhcp looks like:

config dnsmasq
        option port '0' # optional, disable dnsmasq's DNS server, I don't need it

config relay
        option interface 'wwan'
        option local_addr '192.168.2.1' # lan interface address
        option server_addr '192.168.1.1' # the actual dhcp server address

# the rest is only needed for IPv6 (odhcpd)

config dhcp 'lan'
        option interface 'lan'
        option dhcpv4 'disabled'
        option ra 'relay'
        option ndp 'relay'
        option dhcpv6 'relay'

config dhcp 'wwan'
        option interface 'wwan'
        option dhcpv4 'disabled'
        option ra 'relay'
        option ndp 'relay'
        option dhcpv6 'relay'
        option master '1'

The final step is to make sure the real DHCP server accepts requests from relay agents. On Mikrotik I did:
/ip dhcp-server set defconf relay=255.255.255.255)

Hope this helps anyone.

1 Like