DHCP lease issue with odhcpd #dhcp #odhcpd

I have x86 network server with 6 interfaces (1 WAN, 3 Interface as br-lan, and 2 as lan3 and lan4) where I have disabled dnsmasq and run odhcpd for DHCP. But the problem is when I start the router it normally gives the DHCP IP with all of its LAN interfaces but when I tried to swap by connecting a laptop from one LAN interface to another LAN interface it's not offering DHCP to the client. My network and DHCP file are as follows

Network:

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fdb6:cfb7:f470::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0'
	list ports 'eth2'
	list ports 'eth3'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.20.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option device 'eth1'
	option proto 'dhcp'

config interface 'lan3'
	option proto 'static'
	option device 'eth4'
	option ipaddr '192.168.134.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
 
config interface 'lan4'
	option proto 'static'
	option device 'eth5'
	option ipaddr '192.168.34.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

DHCP:


config odhcpd 'odhcpd'
	option maindhcp '1'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '7'

config dhcp 'lan'
	option ignore '0'
	option dhcpv4_forcereconf '1'
	option interface 'lan'
	option start '100'
	option limit '250'
	option leasetime '12h'
	option domain 'LAN'
	option dhcpv4 'server'

 
config dhcp 'lan4'
	option ignore '0'
	option dhcpv4_forcereconf '1'
	option interface 'lan4'
	option start '100'
	option limit '250'
	option leasetime '12h'
	option domain 'Lan2'
	option dhcpv4 'server'

 
config dhcp 'lan3'
	option ignore '0'
	option dhcpv4_forcereconf '1'
	option interface 'lan3'
	option start '100'
	option limit '250'
	option leasetime '12h'
	option domain 'Lan3'
	option dhcpv4 'server'



Please help!!

why?

On all of your DHCP servers, your limit is invalid -- it's too big. The limit is the size of the DHCP pool, not the end point. This means that you've specified 250 addresses, starting at 100. That gets you to 349 which is outside the allowable range (254 max). Therefore, you need to change your DHCP server limit paramter to <=155.

Sorry my mistake
Change it accordingly,

config odhcpd 'odhcpd'
	option maindhcp '1'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '7'

config dhcp 'lan'
	option ignore '0'
	option dhcpv4_forcereconf '1'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option domain 'LAN'
	option dhcpv4 'server'

 
config dhcp 'lan4'
	option ignore '0'
	option dhcpv4_forcereconf '1'
	option interface 'lan4'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option domain 'Lan2'
	option dhcpv4 'server'

 
config dhcp 'lan3'
	option ignore '0'
	option dhcpv4_forcereconf '1'
	option interface 'lan3'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option domain 'Lan3'
	option dhcpv4 'server'

But still the same.while swapping my PC between the LAN interfaces it can't get the IP.

Let’s see your firewall file.

I'm not using a firewall. I'm using iptables where I have allowed all inbound communication for those 3 subnets and also allowed dhcp port,

iptables -I INPUT -s 192.168.134.0/24 -j ACCEPT
iptables -I INPUT -s 192.168.34.0/24 -j ACCEPT
iptables -I INPUT -s 192.168.20.0/24 -j ACCEPT
iptables -I INPUT -p udp --dport 67 -j ACCEPT
iptables -I OUTPUT -p udp --sport 68 -j ACCEPT

I’m not sure what the issue is, but why are you running in such a nonstandard way?

The issue is while I swap my dhcp host from one interface to another it's not getting the lease. Normally I try to use iptables instead of firewall and odhcpd instead of dnsmasq.

What I mean is that if you run dnsmasq and the normal firewall, things will work without issue.