1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DHCP problem related to router time (weird)

Discussion in 'Tomato Firmware' started by CrLf, Apr 1, 2007.

  1. CrLf

    CrLf LI Guru Member


    Up until last week, I had a dedicated Linux box serving as my home router/gateway. But it makes a lot of noise and eats too much power, so I've installed tomato (1.06.0981) on my WRT54G (v2.2)... But I have this problem with DHCP that's making me go nuts...

    I have a Linux install here, configured to use DHCP. It used to work fine while I was using ISC-DHCP on my old Linux server, but now with "dnsmasq" it can't obtain a lease most of the time. It keeps pumping out DHCPDISCOVER messages but gets nothing back (and I've confirmed that the box really sees no reply, using wireshark/ethereal). Funny enough, the logs on my linksys show those DHCPDISCOVERs and corresponding DHCPOFFERs...

    I first thought that it must be something with the DHCP client, some problem that didn't manifest itself with ISC DHCP as server. But I've tried "udhcpc" and the problem remained.

    Also, the Windows boxes always get their lease... Although I've noticed that most of the time they hammer the linksys a bunch of times before finally getting their lease, as if they aren't seeing the first few replies.

    After a few hours hitting my head on the wall over this, I finally found a way to reproduce the problem reliably...

    If I power off the linksys, in the first 30 seconds or so after powering it back on, the Linux box obtains a lease just fine. But, as soon as the router sets its internal clock, the Linux box can't get a lease anymore. I've even tried to disconnect the router from my DSL modem, and the same thing happens: DHCP works fine (for both the Linux box and Windows boxes) up until the moment I reconnect the modem, and the router sets its internal clock...

    Also, just rebooting the router solves nothing, and that's because the internal clock stays set...

    I'm wondering if anyone else has noticed this problem, or it's just me...

    BTW, if anyone thinks this is too weird to be true: this is NOT an April Fools joke.
  2. pablito

    pablito Network Guru Member

    I haven't see this problem with my linux boxes and have to guess it is the DHCP client. If the box isn't going to move you could put a static ip on it. Or clean out the client side lease files so it doesn't try to renew from old data. Or run the DHCP server on the linux box as before.

    My laptop linux always gets a lease from either my WRT/tomato, or the RV08, or another linux server, depending on where I'm at.
  3. CrLf

    CrLf LI Guru Member

    Like I said, I tried with two different clients, "dhclient" (ISC, both version 2 and 3) and "udhcpc". They both show the same behaviour.

    The Linux client install is in a VMware virtual machine running atop a Windows host. Running wireshark on the Windows host shows no DHCPOFFER reaching the Linux VM, which means there isn't one being sent from the router. Now, I also have a Windows VM. Running wireshark on the host while that VM is trying to get a lease, shows no DHCPOFFERs reaching it for the first few DHCPDISCOVERs, but eventually one gets there and then the remaining DHCPREQUEST/DHCPACK handshake goes on as normal and the VM gets a lease.

    But... before the router sets its internal clock, the Windows hosts also get a lease with the first DHCPDISCOVER. This shows that the problem is in the linksys, but is just manifests itself differently for Windows and Linux clients.

    I know I can just set a static address for the affected clients, but I just wan't to know what the hell is going on here, and maybe help fixing it*.

    * This isn't the first time I tried an alternate firmware to replace my old noisy Linux gateway, and everytime I ended up giving up because of problems related to "dnsmasq". But Tomato is a really nice firmware, I'm not willing to give up just yet.
  4. CrLf

    CrLf LI Guru Member

    Just to make this clear: the same thing happens with physical Windows boxes, so this isn't a VMware problem.
  5. CrLf

    CrLf LI Guru Member

    I seem to have fixed the problem, at least temporarily... I pushed the reset button and configured the router from scratch again.
  6. HennieM

    HennieM Network Guru Member

    That's always a good place to start! Sometimes, it seems, the nvram gets set to something somewhere because of different firmware, a setting previously used and not used any more, etc., and this manifests somewhere unpredictable. Clearing the nvram, or better, clearing, resetting, and reflashing usually solves.
  7. devilkin

    devilkin LI Guru Member

    Yesterday I reflashed my WRT54G to the latest tomato firmware. Works fine, but I'm seeing exactly the same problem, though worse:

    None of my linux boxes, nor my Macbook manage to get an IP address from the dnsmasq server. Windows boxes always do, but it seems to take longer than before.

    I've installed a DHCP on a linux box just to test, and it always manages to get the IP from that one.

    I haven't tried to do a full reset - I just configured it yesterday - so that will be tomorrow before I can try that out.

    Anyone got any other hints?
  8. devilkin

    devilkin LI Guru Member

    I just finished setting up my router from scratch, but it still exhibits the problem. DHCP simply does not work with my macbook, with tomato.

    It wasn't any problem with dd-wrt v23sp2.
  9. Odin-60

    Odin-60 LI Guru Member

    It seems as if I can confirm the latter problem. It occurs with a friend's
    router, where I have installed Tomato 1.06 yesterday. Now he complains
    that Win XP needs an unusually long time until the network comes up.
    And, yes, his PC does obtain its IP address via DHCP, and there was
    no such problem with DD-WRT v23 SP2 he was using before.
    FYI: Tomato 1.06 on WRT54GL
  10. dynamx

    dynamx LI Guru Member

    Add me to the list

    I noticed the same problem, my Windows boxes have a hard time getting a new DHCP address on startup. I've done the 'toggling' of WAN DHCP packets and it doesn't work. ddwrt sp2 is okay but I really want to stick with tomato.
  11. devilkin

    devilkin LI Guru Member

    Question: What hardware / revision are you using? Just in case, should it be something that's related to hardware/build...

    Mine is an WRT54G 2.1.
  12. spox

    spox Guest

    I was wondering if anyone has any updates regarding this problem?

    I'm experiencing such dhcp behaviour too and I'm suspecting this might be related somehow to the Broadcom networking chipset on my laptop.

    Neither wired nor wireless network interfaces are able to get a dhcp lease from my WRT54G with Tomato 1.7 under Linux

    Also Windows takes an unusually long time to acquire lease - even displaying "network problem" icon for a moment and then managing to get it right.
  13. devilkin

    devilkin LI Guru Member

    In my case it was that I had disabled the loopback. Enabling this in the settings fixed this problem completely.
  14. unixfool

    unixfool LI Guru Member

    I'm a recent convert here. I've been running Tomato v1.07 installed on a WRT54GSv3.0 about 6 days and noticed that my Mac can't get an IP from the WAP, although if I use two other WAPs that are sitting behind Tomato (a Linksys WRT54gx4 and an Actiontec), I can get an IP fine. I also had an issue with my work laptop, which runs WinXP...it got an IP but only after an insane amount of time where it actually got an IP of 169.254.xxx.xxx then got a real IP.

    This issue drove me crazy all night tonight (3+ hours of troubleshooting, until I registered at this site and saw this one lonely thread).

    No root cause or resolution yet?
  15. devilkin

    devilkin LI Guru Member

    Enabling loopback fixed it for me.
  16. unixfool

    unixfool LI Guru Member

    You mean, go to Advanced/Firewall and click the 'Enable NAT Loopback' radio button?

    I've done it (tunnelled in remotely, from work)...will have to test when I get home. I'd read your post last night but for some reason thought you were talking about the loopback local to your individual machine...stupid me.
  17. unixfool

    unixfool LI Guru Member

    OK, I've tested. I now get an IP (yes!!) and can view web pages or ping/connect other outside IPs. What I CAN'T do is plug in the Tomato IP into a browser to access the GUI...it won't connect.

    rons-computer:~ rsinclair$ ping
    PING ( 56 data bytes
    64 bytes from icmp_seq=0 ttl=64 time=1.888 ms
    64 bytes from icmp_seq=1 ttl=64 time=1.740 ms
    64 bytes from icmp_seq=2 ttl=64 time=1.704 ms
    --- ping statistics ---
    3 packets transmitted, 3 packets received, 0% packet loss
    round-trip min/avg/max/stddev = 1.704/1.777/1.888/0.080 ms
    rons-computer:~ rsinclair$ 
    rons-computer:~ rsinclair$ 
    rons-computer:~ rsinclair$ telnet 80
    Connected to
    Escape character is '^]'.
    Connection closed by foreign host.
    rons-computer:~ rsinclair$ traceroute
    traceroute to (, 64 hops max, 40 byte packets
     1 (  2.317 ms  1.264 ms  1.082 ms
    rons-computer:~ rsinclair$ ifconfig
    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
            inet6 ::1 prefixlen 128 
            inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
            inet netmask 0xff000000 
    gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
    stf0: flags=0<> mtu 1280
            ether 00:16:cb:cf:75:82 
            media: autoselect status: inactive
            supported media: autoselect 10baseT/UTP <half-duplex> 10baseT/UTP <full-duplex> 10baseT/UTP <full-duplex,hw-loopback> 10baseT/UTP <full-duplex,flow-control> 100baseTX <half-duplex> 100baseTX <full-duplex> 100baseTX <full-duplex,hw-loopback> 100baseTX <full-duplex,flow-control> 1000baseT <full-duplex> 1000baseT <full-duplex,hw-loopback> 1000baseT <full-duplex,flow-control> none
            inet6 fe80::216:cbff:febf:8954%en1 prefixlen 64 scopeid 0x5 
            inet netmask 0xffffff00 broadcast
            ether 00:16:cb:bf:89:54 
            media: autoselect status: active
            supported media: autoselect
    wlt1: flags=41<UP,RUNNING> mtu 1500
            lladdr 00:16:cb:ff:fe:e2:38:12 
            media: autoselect <full-duplex> status: inactive
            supported media: autoselect <full-duplex>
    rons-computer:~ rsinclair$ netstat -r
    Routing tables
    Destination        Gateway            Flags    Refs      Use  Netif Expire
    default           UGSc       37       65    en1
    10.150.1/24        link#5             UCS         1        0    en1         0:f:66:52:71:aa    UHLW       35       42    en1   1141       localhost          UHS         0        0    lo0
    127                localhost          UCS         0        0    lo0
    localhost          localhost          UH         10    12220    lo0
    169.254            link#5             UCS         0        0    en1
    Destination        Gateway            Flags      Netif Expire
    localhost          localhost          UH          lo0
                       localhost          Uc          lo0
    localhost          link#1             UHL         lo0
                       link#5             UC          en1
    rons-computer 0:16:cb:bf:89:54   UHL         lo0
    ff01::             localhost          U           lo0
    ff02::%lo0         localhost          UC          lo0
    ff02::%en1         link#5             UC          en1
    rons-computer:~ rsinclair$ telnet
    Connected to
    Escape character is '^]'.
     login: root
    Tomato  v1.07.1039
    BusyBox v1.2.2 (2007.05.06-15:48+0000) Built-in shell (ash)
    Enter 'help' for a list of built-in commands.
    Just a status. Will continue to dig.
  18. unixfool

    unixfool LI Guru Member

    I feel very very stupid.

    The "Allow Wireless Access" button wasn't enabled on the "Administration/Admin Acess" page. :/

    Problem solved. Thanks for the assist, Devilkin!
  19. krzysiunocen

    krzysiunocen LI Guru Member

    Ok. I'm not newbie. And I have the same problem. I'm watching on WRT logs, my Linux logs and Ethereal logs on my Windows. That's the same problem like user "CrLf". When I plug off my DSL modem, dnsmasq on my WRT works fine. When I put modem plug on, WRT responding on DHCPDISCOVER but host (both windows and unix) didn't catch WRT's OFFER. :/ Only on Windows 4th offer 'is visible' and set IP for Windows machine. (in between i can see yellow warning exclamation)

    HELP! :)
  20. krzysiunocen

    krzysiunocen LI Guru Member

    TIP: HARD RESET and new manually settings helps me. Try to do it :)
  21. Odin-60

    Odin-60 LI Guru Member

    I can confirm that.
    FYI: The problem had occured on a WRT54GL 1.1.
  22. hrts

    hrts LI Guru Member

    I have a WRT54GL v1.1 with Tomato 1.16 - OpenVPN version.
    I moved from DD-WRT v23 sp2.

    I use 2 Windows laptops and one MacBook. The weird thing is that my MacBook gets the IP (I see in the Tomato logs all DHCP negotiation) but after 20-30 seconds the MacBook is not able to browse - not even ping the router. The DHCP dialogue has success only when I do a reboot of the tomatoo -> SSH login, reboot. If the Tomato box is powered from some time, the Macbook simply do not gets the IP.
    I must say that in all startup scripts I have several "sleep 5" commands and perhaps this helps the MacBook to acquire the IP until one delayed service starts.
    Any ideas?

    Never tried the NAT loopback - I'll give a try this night and post the result.
    Do the NAT starts after DHCP? If yes, this can be the cause for the weird 20 seconds of browsing as soon as I reboot the box and then nothing...
  23. mstombs

    mstombs Network Guru Member

    WAN IP local Nat Loopback is only a configuration via iptables of the kernel netfilter firewall. It will be enabled when the WAN connects (pppoe or dhcp on the WAN port). I have never understood why this should break LANside dhcp (or network browsing), but the default recommended setting is for Nat Loopback is "forwarded only" now I recall.
  24. hrts

    hrts LI Guru Member

    I did the test: it solved the problem.
    Basically as soon as I put the NAT Loopback on disable my MacBook (my airport wifi connection) got the IP. It's working for the past 10 minutes without any problem.
    Thank you for the solution!

    PS: In previuos posts the recommendation was to Enable (forwarded only settings) the NAT Loopback.
    I had to disable completly in order to make my MacBook works. Weird indeed...

Share This Page