Static and Dynamic DHCP interworking

Discussion in 'Tomato Firmware' started by hpsmartyz, Sep 29, 2007.

  1. hpsmartyz

    hpsmartyz LI Guru Member


    just a small post to understand how these two work together.
    I have, in Basic > Network, the DHCP running and range between
    x.x.x.100 and x.x.x.105
    In Basic > Static DHCP, I have assigned IP @s to MAC ones
    in the range x.x.x.100 to x.x.x.106
    The computer to which is assigned x.x.x.106 connected itself to the network
    without any problem.
    I would have thought, knowing that the DHCP server is configured to only
    allocate up to x.x.x.105, that the computer would not be able to connect.

    So, are there two DHCP processes running?
    How the two configuration inter-work?
    Knowing that I only want to use Static DHCP, should I turn off the DHCP server, or could I assign a null range?

    thanks for your clarifications
  2. mstombs

    mstombs Network Guru Member

    There is just one dhcp server, dnsmasq, which also does the dns proxy/cache.

    The static dhcp just reserves the IPs defined for your clients, they should still have 'auto' set for their TCP/IP settings - they should just get the same IP each time.

    You usually assign static IPs outside the the auto dhcp range, but I think dnsmasq is clever enough to work around.
  3. ifican

    ifican Network Guru Member

    This a very insteresting question and one i have never thought directly about. However I would agree with mstombs, the router knows you have assinged essentially a static ip to that one host so it gives it the ip of your choosing. I would venture to guess if connected 6 clients with no mappings, all 6 would get an ip but if you connect a 7th it would not work because the available ip's would all be used up, however if you connect the client that has a mapping (106) it would get an ip and work because of it. Though i am interested in what others discover if they care to test.
  4. Mercjoe

    Mercjoe Network Guru Member

    I have a network set up here at the house that has a hybrid of dynamic and static IP addresses.

    In the Tomato basic/network tab, down where is states DHCP Server, it allows you to set a range of available addresses. In my case, I allow 100 to 149 ( - to be dynamically allocated as needed.

    I have two machines that I have set as static IP's. One is, the other is You just have to be sure to set the IP's for your static DHCP to be outside the dynamic range.

    This arrangement has been stable for over a year now with NO problems.

    Why you may ask??

    It simplies the use of QOS rules to manage bandwidth priorities and port forwarding. Instead of having to use MAC adress's and such I just define an IP for bandwidth management purposes.
  5. hpsmartyz

    hpsmartyz LI Guru Member


    thanks for your answers from which I understand that I should not switch off the DHCP server even if I do not use "dynamic" allocation.
    Furthermore it would be more appropriate to set the range for the dynamic allocation
    outside the range of the static one.
    On the other hand, if want to avoid any computer for getting a dynamic IP @ I should set the ranges to be the same. Am I right?
    Does the static DHCP ensure that only a given IP @ will be assigned to the associated MAC?
    In other words if x.x.x.104 is in both dynamic and static ranges will it only be assigned to
    the computer with the MAC to which it is associated in the static table or can it be given
    to another computer if currently not used?
  6. mstombs

    mstombs Network Guru Member

    I currently have most static IPs defined outside a small auto range - but I have also fixed a couple of devices on whatever IP they first found, by auto within the dhcp auto range. As you will have noticed the dnsmasq auto doesn't hand out IP addresses in a straight numerical order!
    I'm pretty sure the reservation works and it will never hand that address out to another mac. I have not tried no free dhcp addresses, but suspect it will work - refuse to give anything to a new alien PC - but suggest you experiment and let us know for sure!
  7. azeari

    azeari LI Guru Member

    if you wish to stop computers from being allocated dynamic IPs if they're not listed in ur static table,
    you're better off turning off the DHCP server option. (=

    This stops dnsmasq from handing out dynamic ips via DHCP, but doesn't actually terminate the dnsmasq process. The process will still be needed for static ip management and dns proxying/caching
  8. hpsmartyz

    hpsmartyz LI Guru Member


    I have conducted the following test
    - forced the range of D-DHCP to be x.x.x.105 to x.x.x.105
    - have an entry in static S-DHCP conf for x.x.x.105 associated to MACz
    - try to connect with a PC having MACy (while PC with MACz is not connected and lease not ongoing)

    The PC can NOT connect.

    Furthermore I have tried the proposition of azeari, but this does not work :frown: (even if I would have liked it to)
    A PC with an IP/MAC entry in the S-DHCP conf can not get this IP@ if DHCP server is disabled.

    hope it helped

  9. Toastman

    Toastman Super Moderator Staff Member Member

    Here's how I did it.

    I use the DHCP service to assign static addresses to 199. (I also use static DHCP "hostname" box to assign a user ID to each MAC so it's easy to identify who they are).

    My own IP for admin is

    To stop anyone else gaining access:

    I set my DHCP server to only allocate one dynamic - IP - which is actually my own address, which is already assigned to me in the static DHCP table. When a client connects, the DHCP server looks to see that no. is reserved for my MAC address, and can't allocate it. A message is therefore returned to the client "no address available".

    I used my own address just to see if there were any negative repercussions, (none that I can see) - you can use perhaps and a dummy MAC instead.
  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