OpenWrt Forum Archive

Topic: Different DHCP for ethernet/wireless after initial install?

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

Hi everyone,

   New OpenWRT user here.  First off, just wanted to let you know that OpenWRT is happily running a local charity that helps abused children.  I installed OpenWRT because I wanted to block port 25 into the SMTP server to only the external antispam/antivirus provider, and it works great.

   Here's the wierd part, though - in my inital testing post-boot, I connected to the Ethernet side of the router just fine from my laptop and got a proper DHCP setup (I changed the subnet to, let's say, 192.168.45.x).

   But, when I brought my wireless up, it connected fine, but I couldn't ping anything.  After further investigation, I noticed that my wireless was getting an address of 192.168.1.20 from DHCP!

   In the deployed scenario it wasn't a big deal because the new network we set up has a Winblows DHCP server, but I'd like to set up OpenWRT on my new WRT54GS at home, and I am using DHCP there, so it will matter.

   Any hints on what could have cause this? Seems strange to me.

I'm not sure where to look for that oddity you see, but you might want to check the config files. What config file to look in depends on what "version" of OpenWrt you are using.

If you're using dnsmasq as your DHCP server, which is the "new" method, you'll need to change the IP range (it hands out) in /etc/dnsmasq.conf:

# enable dhcp (start,end,netmask,leasetime)
dhcp-range=192.168.1.100,192.168.1.250,255.255.255.0,12h

If you're using udhcpd as your DHCP server, which is the "old" method, you'll need to change the IP range in /etc/udhcpd.conf:

start 192.168.1.20
end 192.168.1.250

I suspect you are using the old method (udhcpd) since the default range in udhcpd.conf is from 192.168.1.20 - 192.168.1.250. If you are unsure, check ps for 'udhcpd'.

Shoot, knew I forgot something.

I loaded the last (0630) version of NicoWRT because I also want to make this router a PPTP server when I can.

It was running both udhcp and dnsmasq.  There's no dnsmasq.conf, but it's started from inittab with the command line "/usr/sbin/dnsmasq -d -l /tmp/udhcpd.leases -s lan" and udhcpd.conf was indeed still configured for 192.168.1.20 through 250.

So thanks, that clears the 192.168.1 issue up, because that file isn't autoconfigured.  But then where did the 192.168.45 address on the Ethernet side come from?

Was it dnsmasq automatically serving from the subnet via compiled-in code?

Appreciate the pointers - I should have investigated a bit more before posting, but the first router was kind of a rush job.

It's probably too late now, but you could've done a "IPCONFIG /ALL" from your Windows machine to see which DHCP server offered that IP address.

I doubt it was your OpenWrt, since udhcpd can only hand out one range of IP adresses, and dnsmasq requires a config file that describes the range (unless given from the commandline, which obvious isn't the case looking at the line from /etc/inittab).

Your version of OpenWrt only uses dnsmasq as a caching nameserver.

The discussion might have continued from here.