No DHCP when bonding?

Hey ya OpenWRT masters,

I'm on OpenWrt R20.4.8 / LuCI Master (git-20.117.60969-420c61a)

What I trying to do:
I'm trying to setup a LACP (802.11ad) based link aggregation from my x86 based router down to a LACP supported switch. (It's a L2 switch so there is no DHCP feature enabled).
There are 4 physical ethernet interfaces on my x86 based router so I bonding eth2 and eth3 into this LACP group.

What goes well:

  • bonding-bond0 interface going up. (slave eth2 and slave eth3 is happy)
  • LACP protocol works good (I saw the package from wireshark)
  • an static IP configured via GUI and its good.

What's wrong:

  • I'm not able to enable DHCP service on the bonding-bond0 interface once I switch the protocol into Link Aggregation mode in GUI
  • dnsmasq-dhcp[5985]: no address range available for DHCP request via bonding-bond0

Some attempts:

  • I went to CLI and manually config dhcp for bonding-bond0 interface in /etc/config/dhcp then did a '/etc/init.d/dnsmasq restart' and '/etc/init.d/network restart'. After that, the DHCP service totally stop working. dnsmasq is able to start but it just stop assign DHCP to any interface.
config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option filter_aaaa '1'

config dhcp 'lan'
	option interface 'lan'
	option limit '150'
	option leasetime '7d'
	option start '50'

###Here is the section I added manually
config dhcp 'bonding-bond0'
	option interface 'bonding-bond0'
	option limit '150'
	option leasetime '7d'
	option start '50'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config srvhost
	option srv '_vlmcs._tcp'
	option target 'OpenWrt'
	option port '1688'
	option class '0'
	option weight '100'

Not sure if this is by design but I wanted to have DHCP enable on bonding interface which will keep my device connected with the L2 switch happy.

Tried to search and read every thread/discussion related but no interesting finding, sounds like I'm the first one :frowning:

Any idea/tips are appreciated.

What is the output of uci export network ?

Alright problem solved!

by add this line manually in /etc/dnsmasq.conf to manually set the dhcp range for interface bonding-bond0.

dhcp-range=set:bonding-bond0,192.168.0.50,192.168.0.199,255.255.255.0,7d

I read the https://wiki.openwrt.org/doc/uci/dhcp and figure out that /etc/dnsmasq.conf can 'override' /etc/config/dhcp

Using plain dnsmasq.conf
It is possible to mix the traditional /etc/dnsmasq.conf configuration file with the options found in /etc/config/dhcp.
The dnsmasq.conf file does not exist by default but will be processed by dnsmasq on startup if it is present. Note that options in /etc/config/dhcp take precendence over dnsmasq.conf since they are translated to command line arguments.

output from uci export network is respected with the line I put in /etc/config/dhcp

It should not be necessary to do that if the interface has an IP configured in /etc/config/network it should inherit to the dnsmasq DHCP server. Use the same name in both places, without the OpenWrt prefix like 'br-'

Be careful the kernel has a limit of 15 characters on interface names including the prefix.

1 Like

The static ip address and subnet did configured in /etc/config/network as this come from GUI.
But the dnsmasq somehow not able to automatically generate the DHCP address pool for that interface. (Also in GUI the DHCP config section will disappear once switch the link protocol from static into Link Aggregation)

Just an idea.
Setup your LA as usual without IP/mask and give it a name in uci, say lag.
Then on lan interface give protocol static, IP, mask, and for ifname give @lag

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.