DHCP relay takes long time obtaining IP address

Hi all,

I'm recently using OpenWrt (installed on Rpi Zero W) as a DHCP relay. I think there exists problem in my setting. Although that the clients can obtain IP addresses from the DHCP server, but it takes circa 1 minute to do this.

My routing is:

Rpi (OpenWrt @ 192.168.2.1) --- switch --- ISP modem (DHCP server @ 192.168.1.1)

My OpenWrt configs:

etc/config/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 'fd7a:4e97:e56c::/48'
        option packet_steering '1'

config interface 'lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option device 'wlan0'
        option defaultroute '0'
        option ipaddr '192.168.2.1'

config device
        option name 'eth0'
        option acceptlocal '1'

config device
        option name 'wlan0'
        option acceptlocal '1'

config interface 'br'
        option proto 'relay'
        list network 'lan'
        list network 'wan'
        option forward_bcast '0'
        option force_link '1'

config interface 'wan'
        option proto 'none'
        option device 'eth0'
        option force_link '1'
        option defaultroute '0'

/etc/config/wireless:

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'platform/soc/20300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'
        option band '2g'
        option htmode 'HT20'
        option country 'TW'
        option disabled '0'
        option cell_density '0'
        option channel 'auto'
        option distance '4'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option mode 'ap'
        option ssid 'OpenWrt'
        option disabled '0'
        option network 'lan'
        option encryption 'psk2'
        option key 'xxxxxxxxxxx

/etc/config/dhcp: (IIUC, ignore means no DHCP server on the speficied interface)

config dnsmasq
        option localise_queries '1'
        option rebind_protection '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option localservice '1'
        option ednspacket_max '1232'
        option boguspriv '0'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        option ignore '1'
        option dynamicdhcp '0'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

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

config dhcp 'br'
        option interface 'br'
        option ignore '1'

Is there anything wrong in my network config? Furthermore, I'm not sure that protocol relay is required for my use case, how about simply using unmanaged (I tried and it's not working. Maybe it's because of my incorrect configuration) ?

Please let me know if other configs are required!

Thanks,
Huichun

If you are connecting them by cable I don't see why relay is needed. You just turn off the DHCP server on the lan and assign it to get dhcp settings from ISP router or statically assign IP from the 192.168.1.0/24 network.

2 Likes

Thanks for the reply!

Do you mean that I can simply use unmanaged protocol to bind device wlan0?

assign it to get dhcp settings from ISP router or statically assign IP from the 192.168.1.0/24 network.

Does this setting locate under the DHCP page? I didn't manage to find this setting.

Thanks!

Are you using a Pi as a wifi AP? While this can functionally work, it is not a good option in terms of performance and range in most environments. You will be much better off with pretty much any basic AP (or a wifi router that you just use as a dumb AP).

That said, if you are using the Pi in this way, you simply put the ethernet device into br-lan, then assign the lan network with an IP as per @trendy's comment, and then specify the network (lan) in the wifi config.

If you want specifics, we can guide you through the changes based on your config file:

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
2 Likes

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