OpenWrt Forum Archive

Topic: DHCP Relay Confusion

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am trying to route between two vlans and for some reason everything works but DHCP across the two networks.  I am being lead to believe that I need a DHCP relay for this to work.  I am using an external DHCP server so its not hosted on the router.  I am a bit foggy on networking at this level so I am not sure that is in fact what is wrong. I could not find anything in the UI that is obvious so I am assuming I am doing something wrong.  It looks like dnsmasq supports an option of using it as a relay.  Is there a way to expose that? Thanks!

DHCP uses broadcast packets, that do not work across routed networks. You can use "relayd" for a generic solution, or configure "dnsmasq" on that interface and tell it to relay requests to an external server.

Is this something that can happen via the UI?  Or does this have to be done in the configuration files?  This is the part I am unclear with .  Relayd seems to emulate a full bridge, and I cannot find a way to put generic options into dnsmasq.  Help there would be appreciated.  Thanks!

Yes, relayd is not DHCP specific, and acts pretty much as a bridge. Advanced options are generally not available on LuCI, or even UCI; not sure you can configure dnsmasq like this unless you edit the files.

Relayd will collapse your two VLANs to one Subnet. I don't think that is what you want.

DHCP relay is a function which adds a tag to the DHCP request (option 82, circuit ID). This allows your DHCP server to respond with the correct subnet address to the request. You would need to configure DHCP relay on DNSMasq on the OpenWRT router, and configure your DHCP server to interpret the circuit ID. Here's the DNSMasq sample config:

https://gist.github.com/jeremyschulman/5880774

You _may_ find it easier to just run another DHCP server on the 2nd VLAN.

I tried a putting up the dhcp server on the second vlan, but it would not work correctly with my active directory setup.
I could not find a way to add custom options to the dnsmasq config so what I finally got working was to do a custom build with dhcprelay enabled in busybox:

CONFIG_BUSYBOX_CUSTOM=y
CONFIG_BUSYBOX_CONFIG_DHCPD_LEASES_FILE=""
CONFIG_BUSYBOX_CONFIG_DHCPRELAY=y
CONFIG_BUSYBOX_CONFIG_UDHCPD=y

Then at the end of the startup scripts I added:

dhcprelay vlan2 vlan1 192.168.1.2

Hope this helps someone!

That is great that you got it working (by running a dhcp relay). Thanks for sharing your solution.

The discussion might have continued from here.