DHCP ip address order

Discussion in 'Tomato Firmware' started by sizzaone, Apr 28, 2009.

  1. sizzaone

    sizzaone Addicted to LI Member

    Hi, i upgraded from tomato 1.21 to 1.23 ND recently and I've noticed a change in the way the DHCP server acts. Instead of assigning the ip addreses in numeric order from the 1st available, it just seems to pick a random free address in the DHCP range and use that.

    For example, my DHCP range is currently set to - I would expect the first 3 devices to be asigned .100, .101 and .102. Instead they are assigned random IP's like .120, .135 and .142.

    It used to work for me as expected in version 1.21, is there a way to fix this behavior? Thanks.
  2. fyellin

    fyellin LI Guru Member

    Are you sure about what you claim is 1.21's behavior? I know that 1.21 (non-ND) gave out non-sequential IP addresses.

    The actual algorithm is that the MAC address is hashed, and then this value is used to search for an open IP address within the DHCP range. In this way, the same device can usually get the same IP address over and over. I don't think this code has changed.

    If you want a machine to have a fixed IP address, then you should use static IP addressing. This behavior is hard-wired into the code, and there is no simple way to change it.
  3. sizzaone

    sizzaone Addicted to LI Member

    Not 100% sure on this, it was a while ago. I know I defiantly had it sequential at one point, but it may have actually been prior to 1.21.

    I wasn't aware of the hashing though, it's good to know there's some sense in the way the IP's get assigned.
  4. bripab007

    bripab007 Network Guru Member

    Yeah, dude, I've been using Tomato since like 1.13, and it's never handed out addresses sequentially. And I've used DD-WRT off-and-on for years, too, and it, too, uses the same hashing algorithm to assign IPs that Tomato does.
  5. Kiwi8

    Kiwi8 LI Guru Member

    U should not be looking to fix this behaviour in this way. If u really need a fixed address, then u should just use static DHCP addressing which gives the IP address u want with the convenience of DHCP.
  6. sizzaone

    sizzaone Addicted to LI Member

    This is not about having a fixed address, it's about assigning devices that don't have a fixed address in numerical order.

    Having said that, it appears I must be crazy as apparently tomato never worked this way.
  7. Kiwi8

    Kiwi8 LI Guru Member

    I used to desire the same as u too, that of letting my devices have addresses in numerical order.

    However, dynamic DHCP issues out IP addresses based on a hashing algorithm that takes the requesting device's MAC address into consideration. This allows the device to get the same IP address (provided it is not taken) from a range of IP addresses to be issued out. This is actually a very important feature.

    Hence, if u really want to have a fixed IP address, it is better to use static DHCP.
  8. mstombs

    mstombs Network Guru Member

    Not seen the sequential dhcp issue since Linksys firmware, see old comment from Thibor on his old HyperWRT mod


    So I suspect it is a change from udhcpd to dnsmasq that introduces this feature
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice