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

Static DHCP... Pretty please...

Discussion in 'HyperWRT Firmware' started by Edge, Aug 20, 2004.

  1. Edge

    Edge Network Guru Member

    I know you are trying to keep HyperWRT as lean as possible.... But is there any possible way to add STATIC DHCP?

    I hate hard coding my servers/pcs in order to make port forwarding work. Having the ability to assign ip addresses by MAC address is soooooo nice.

    Anyone else agree?

    Great firmware, Avenger. Keep up the good work!
    Edge
     
  2. Taomyn

    Taomyn Network Guru Member

    I second the request and totally agree with the reasons for needing it.

    I dumped the Seasoft firmware in favour of HyperWRT which is 1000% more stable, but I miss static DHCP :cry:
     
  3. ravn

    ravn Network Guru Member

    I'm also waiting for the static DHCP in HyperWRT, it's working perfectly in the -now rather old :cry: - Wifibox FW version...
     
  4. Toxic

    Toxic Administrator Staff Member

    for the sake of adding static IP addresses to the linksys setup why not just set you PCs to static IPs?
     
  5. Edge

    Edge Network Guru Member

    I know thats an option... Thats what I am doing now with HyperWRT 1.3.. But I do not like hardcoding static IP addresses on my pcs/wifi devices.

    Static DHCP comes in handy with my Xbox and PS2, as well as my Audiotron and Print Server. Using their MAC address to set their IPA within the firmware is a nice, polished solution.

    Hopefully its not a big change to add that functionality. Maybe I can ask Santa. :lol:
     
  6. Milox

    Milox Guest

    I use HyperWRT for a while now and it's rocksolid!

    the only thing missing is static DHCP...
    perhaps even with a option that unknown MAC's (not listed in the MAC table to get a static IP) are given a dynamic IP.
    This can be very handy when my friends come over with for a LAN-party

    Avenger, keep up the good work!
     
  7. koitsu

    koitsu Network Guru Member

    Add me to the list of users who wants static DHCP, by the way. I thought HyperWRT would come with this, but obviously thought wrong -- so, I was forced to fire up isc-dhcpd version 3 on my little FreeBSD box here on my LAN.

    Also, I'd just like to mention that for DHCP, I'd recommend avoiding the stock Linksys DHCP server if at all possible. Between OpenWRT, wifi-box, and Sveasoft, there has yet to be a "flawless" DHCP server that supports all the features people want (static DHCP being one of them). Please consider using ISC's DHCP server, as it supports configurability while having a fairly small footprint, and seems to work *fantastic* for everything.

    Thanks!
     
  8. Edge

    Edge Network Guru Member

    Avenger,
    Did this capablity creep into 1.4? Do you have a list of features we can take a peek at?
    Edge
     
  9. dellsweig

    dellsweig Network Guru Member

    Hey

    I have a kindof dumb question - why do you need to port forward to a fixed IP?? Why not just port trigger?? If there is a port listener on the LAN for the triggered port, it will connect - no matter what the IP is......

    I use port triggering with hyperWRT for the SIP ports on my 2 Cisco ATA's (5060 & 5061). The ATA's use DHCP so I can't/don't port forward. Triggering solves the problem.....
     
  10. m33p

    m33p Network Guru Member

    I agree that would also be very usefull for my self as well
     
  11. Esquire

    Esquire Mesquire Staff Member Member

    Just out of curiosity, does everyone's LAN suffer changing IPs using Dymanic DHCP all the time or only after certain events (e.g., reset/reboot)?
     
  12. dellsweig

    dellsweig Network Guru Member

    I have seen my Cisco ATA's (My only DHCP devices) get a different address. Not sure why - never really looked into it as it had no effect on performance.
     
  13. niTz

    niTz Network Guru Member

    dhcp time release

    do u mean like ur lan ips change, ive had that prob too so what i did was enter this number 9999 in the dhcp release time to it expires in 6 days instead of 1( its set to 0 by default)

    hope that was ur prob

    the niTz
     
  14. Esquire

    Esquire Mesquire Staff Member Member

    Sorry for the confusion.

    The reason I asked was because I was simply trying to get more info about this problem - but it hasn't happened to me (yet), except when I rebooted/resetted my router, in which case the IP would be reassigned according to the order my clients booted up next time, which I thought was normal. Otherwise, the IP would remain the same even if the client hasn't been connected/booted up for days. This isn't just with my WRT54G, my old Linksys BEFSR41 (which the WRT54G replaced) behaved exactly the same, even on default DHCP settings.
     
  15. koitsu

    koitsu Network Guru Member

    Re: "dynamic DHCP insanity"

    Let me explain how DHCP works a bit, then maybe it'll make sense to you. Your PC will fetch an IP from a pool assigned by your WRT unit (in this case, via the HyperWRT unit).

    Along with an IP, an expiry value for the lease (how long that computer has until it re-requests an IP via DHCP across the broadcast address) is negotiated. The client will say "I'd like an expiry of [X]", and the server can give that requested expiry thumbs up or down. In the case that it's given a thumbs down, the DHCP server says "Use this expiry". You can see this in action using ISC's DHCP server via the `default-lease-time' and `max-lease-time' variables.

    Now the client PC has an IP, and let's pretend for sake of example that the expiry is set to 10 hours. Meaning, in 10 hours, the client PC will send out a BOOTP/DHCP request saying "Expiry's up! Give me an IP again! My present IP is x.x.x.x".

    The IP is essentially "negotiated" in MOST/PROPER DHCP server environments. There are a LOT of DHCP servers out ther which don't adhere to this behaviour. What's supposed to happen is that the DHCP server looks up x.x.x.x in it's DHCP pool, determines if it's already allocated or not (and if it is, if it's allocated to the same MAC address that's requesting an IP again).

    If it's already allocated to that PC in the pool, the DHCP server says "Your IP doesn't need to be changed", and any other information is updated (the expiry, DNS servers, etc.).

    In the case that the x.x.x.x IP has been re-allocated to someone else (probability is low, but it can happen), the client PC will be given a new IP in the pool. The client PC will release the old IP -- the release itself can cause any pre-existing sockets to drop, etc. etc. (there is absolutely no way around this, and it is normal behaviour).

    Now, pretend for a moment that the client gets an IP, and 5 hours later you reboot or power-cycle your WRT unit.

    If your client PC is connected to your WRT unit via CAT5, the client PC will re-fetch an IP address; this is because Ethernet link is dropped when the WRT is rebooted, so the client PC will say "Now I don't know what the status of the DHCP server is, when link comes back up I'd better ask for things again".

    In this case, it goes through the same rigamaroll as what I described above -- except since the DHCP server cannot/does not write it's lease table to disk (flash), it assumes everyone needs to re-register for an IP. So, you possibly could get a new IP in this case. Two of your PCs could even "switch" IPs, if you get what I'm saying.

    The exact same is supposed to happen in wireless environments when the wireless link is physically dropped (and the client knows about it -- sometimes it doesn't. Ahh, the joys of crappy technology...).

    It all boils down to how the DHCP server is written and implemented, which is why I really wish people would try to get ISC's up and working on the WRT units. It's stable, it's consistent, and there are a TON of tunables for people who want to muck with things. Plus it provides static DHCP, and it even supports writing the lease table to disk so that after a reboot, the DHCP server can recover and know EXACTLY where it left off.

    Hope this helps.
     
  16. Taomyn

    Taomyn Network Guru Member

    You're not quite correct in describing the behaviour of the Windows DHCP client. To quote from the Microsoft website:

    Code:
    If the DHCP client had previously obtained a lease from a DHCP server:
    
    1. If the clients lease is still valid (not expired) at system start time, the client will try to renew its lease.
    
    2. If, during the renewal attempt, the client fails to locate any DHCP server, it will attempt to ping the default gateway listed in the lease, and proceed in one of the following ways:
    
    • If the ping is successful, the DHCP client assumes that it is still located on the same network where it obtained its current lease, and continue to use the lease. By default, the client will then attempt, in the background, to renew its lease when 50 percent of its assigned lease time has expired.
    • If the ping fails, the DHCP client assumes that it has been moved to a network where DHCP services are not available. The client then auto-configures its IP address as described previously. Once the client is auto-configured, every 5 minutes it attempts to locate a DHCP server and obtain a lease. 
    So basically everytime your pc successfully contacts your DHCP server at start-up, it will always have a full length lease, and then if never rebooted, after 50% of the lease time it will renew - rarely will a pc have waited until the lease has run out before requesting a renewal.
     
  17. koitsu

    koitsu Network Guru Member

    What? The default lease time for a lot of DHCP servers is between 600 and 7200 seconds. We're talking about LAN DHCP, and not WAN-side (i.e. where ISPs have configured their servers to have a DHCP lease length of 900 million years -- heh ;) )
     
  18. Taomyn

    Taomyn Network Guru Member

    Windows DHCP servers have a default lease time of 8 days 8O (for Windows 2003, it may have been only 7 for previous versions).

    Once a lease expires the server keeps the record of it for 4 hours before finally releasing it. Having looked around various DHCP config webpages (mainly *nix man pages) it seems different flavours set it by default from minutes to weeks.
     
  19. Haakie

    Haakie Network Guru Member

    Ok, but stil static DNS would also be very nice feature for me. I use a couple of programs wich work on IP base...
     
  20. koitsu

    koitsu Network Guru Member

    Just a note for those incoming: 1.4 does not provide static DHCP.

    And a note for the author: we still want this, you know... :)
     
  21. cabo

    cabo Network Guru Member

    May be using dnsmasq as the dhcp server would be an option (e.g openwrt is using it).

    It might also fit more to the concept of HyperWRT's author:
    - you just replace the current dnsmasq version with the latest official version
    (no 3rd party patches needed)
    - this will also fix a lot of bugs in dnsmasq
    - by changing/adding the dnsmasq config, you can also run a simple DNS Server (the latest version has many options).

    (depending on the amount of changes, you can use the current web interface to setup and run the dnsmasq server for dhcp)

    I'm currently writing some modifications to use dnsmasq as an dhcp server.


    To update the dnsmasq code, download it from http://thekelleys.org.uk/dnsmasq.

    then make a backup of the current dnsmasq source in
    WRT54GS/release/src/router/dnsmasq
    then delete everything in that dir except for
    dnsr_vx.c
    dnsr_vx.h
    Makefile

    Then copy the files from the latest dnsmasq source dir (e.g. dnsmasq-2.15/src) to the router source ( WRT54GS/release/src/router/dnsmasq )
    Update the Makefile for the new version, by modifing the OBJS line to this:
    Code:
    OBJS = cache.o rfc1035.o util.o option.o forward.o isc.o network.o dnsmasq.o dhcp.o lease.o rfc2131.o
    
    now you can change the start_dns() function in rc/services.c to this

    Code:
    int
    start_dns(void)
    {
        int ret;
    
        if(!is_exist("/tmp/resolv.conf"))
            return -1;
    
        /* dnsmasq simple mod start */
        FILE *fp;
    
        /* creates dnsmasq.more.conf if it doesn't exists */
        if (!(fp = fopen("/tmp/dnsmasq.more.conf", "a"))) {
            perror("/tmp/dnsmasq.more.conf");
            return errno;
        }
        fclose(fp);
    
        if (!(fp = fopen("/tmp/dnsmasq.conf", "w"))) {
            perror("/tmp/dnsmasq.conf");
            return errno;
        }
    
        fprintf(fp, "resolv-file=/tmp/resolv.conf\n");
        fprintf(fp, "interface=%s\n", nvram_safe_get("lan_ifname"));
        /* additional config file */
        fprintf(fp, "conf-file=/tmp/dnsmasq.more.conf\n");
        /* do not use the /etc/hosts file (which is /tmp/hosts */
        /* this is the default setting in the linksys firmware */
        fprintf(fp, "no-hosts\n");
    
    
        fclose(fp);
    
    
    
        ret = eval("dnsmasq",
               "-C", "/tmp/dnsmasq.conf");
    
        /* dnsmasq simple  mod end */
    
        dprintf("done\n");
        return ret;
    }
    
    You could also disable the command stop_syslog(); in function stop_services(void) for debugging.

    WARNING: This is experimental and only tested by myself (i am currently not using my WRT54GS for internet access)

    NOTE: This patch doesn't change anything, it just enables you to do runtime changes in the config (e.g. test the dhcp server functions).

    you can add for example s.th. like this to HyperWRT's startscript for DNS Server functions

    Code:
    touch /tmp/myhosts
    echo "domain=my.lokal" > /tmp/dnsmasq.more.conf
    echo "addn-hosts=/tmp/myhosts" >> /tmp/dnsmasq.more.conf
    echo "expand-hosts" >> /tmp/dnsmasq.more.conf
    echo "127.0.0.1 localhost" > /tmp/myhosts
    echo "192.168.1.1 wrt54gs" >> /tmp/myhosts
    echo "192.168.1.2 myself" >> /tmp/myhosts
    echo "192.168.1.19 linuxserver" >> /tmp/myhosts
    
    The DHCP Server can be enabled by setting the dhcp range
    Example:
    dhcp-range=192.168.1.50,192.168.1.150,255.255.255.0,12h
    Static host Example:
    dhcp-host=11:22:33:44:55:66,192.168.1.19,linuxserver
    See "dnsmasq.conf.example" from the source for all options

    I'm working also on an advanced patch, to launch the dnsmasq dhcp server instead of udchpd in the code. (ready but untested)


    PS: It is very late, so excuse for my english
    :oops:

    PS: There is a bug in the webinterface: if you view your script, it isn't displayed corret: ">" e.g. is shown as in the html code. That's not worse, until you save it this way. Backup up the script locally, to be able to make future changes
     
  22. cyrano

    cyrano Network Guru Member

    bump

    Please !

    This is the most important missing feature!
    There must be a way to implement this !
     
  23. tangyue

    tangyue Guest

    i second this too. many thanks.
     
  24. KenNashua

    KenNashua Guest

    ditto...

    In the past month I've had 1 SMC router fail and my Buffalo wired ports just went last night, so I bought a WRT54GS and really miss the DHCP static IP assignment...

    I know there's Satori, but it seems like it's added too much and suffers stability... HyperWRT seems ideal IF Avenger adds static IPs to the DHCP server....
     
  25. dadaniel

    dadaniel Network Guru Member

    If all WRT54G firmware developers could work together ...... *dreaming* :lol:
     
  26. destro_23

    destro_23 Guest

    I'll just add my name to the Static DHCP list by mac... as my roomates at school use bittorrent and wireless cards.. and i have them using different ports routed to their IP's... needless to say, if something happens and one grabs the other IP first... it sucks.

    i can always hard code it... but they aren't the brightest bulbs in the pack. They will call me every time they go home and their "internet" doesn't work.

    Again thanks for reading this

    --Destro
     
  27. chamiz

    chamiz Network Guru Member

    What's the benefit of Static DHCP? They have it in the new original Linksys firmware. Why do so many people want it? Do I need it?
     
  28. dankim831

    dankim831 Network Guru Member

    they have static ip for your WAN connection.

    but not static dhcp for your lan connections
     
  29. SirDracula

    SirDracula Network Guru Member

    One more vote for static DHCP, I don't want to use sveasoft's firmwares just for this feature.
     
  30. Lazybones

    Lazybones Network Guru Member

    I think its a very useful feature. It allows you to keep all of your workstations set on DHCP and allows you to configure static port forwarding all from one place.

    It is very handy to have laptops for example always set on DHCP mode because often they will move between networks. This removes the exta step of needing more than one config saved in windows or manualy changing the setting on the laptop everytime you want to use it on the network.
     
  31. shorty

    shorty Guest

    Here's a justification: I have 5 computers attached, 3 wirelessly and 2 hard-wired with software firewalls on all machines. The firewall on my servers restrict certain machines from accessing them on certain ports (SSH, for instance, is only allowed from my laptop, not my girlfriend's). The only way I can do this is by IP address so I want to statically assign a certain IP address via DHCP to my laptop and let hers float. With static DHCP I can do this. Without, my laptop's IP address could end up on another machine.
     
  32. rtau

    rtau Network Guru Member

  33. Edge

    Edge Network Guru Member

    If static dhcp support is added to busybox, would that mean HyperWRT would inherit this capability as well?
     
  34. Edge

    Edge Network Guru Member

    WOW! Over 5000 views on this post! 10x more than most...

    Static DHCP must be high on everyone's wish list.. :)
     
  35. MrMike

    MrMike Network Guru Member

    Want to add my "me too" vote for this. Its probably the only feature that I'm waiting for HyperWRT to have before switching to it.
     
  36. daenigma

    daenigma Network Guru Member

    Add one more to this thread....
     
  37. Maeka

    Maeka Network Guru Member

    CA$H???

    Can I offer a monetary bribe/bounty/incentive to get DHCP reservations into HyperWRT?

    I am willing to pledge some cash, and I bet I am not the only one.

    Some of the Sveasoft "developers" will add requested features for money...

    Not saying you have to, shit man, it's your baby and we are all just satisfied leeches....
     
  38. Phil06

    Phil06 Network Guru Member

    +1 for static DHCP
     
  39. dellsweig

    dellsweig Network Guru Member

    The BIG advantage to the hyperwrt (Avengers) model is he is simply makeing the LINKSYS release code usable. He is uncovering basic features, increasing some table sizes and activating some hidden code, thats it.

    If he was to add code, staic DHCP for example, he then has to support those changes. If a bug is found - he is responsible for it..

    I for one am quite happy with the few pieces - which are in the Linksys code - he has uncovered .. I hope he keeps the same model and refused the temptation to start writing code.....

    Just my 2 cents

    Happy Holidays
     
  40. muki2

    muki2 Network Guru Member


    udhcp is another project though it is hosted on Busybox.net.
     
  41. TomDoe

    TomDoe Network Guru Member

    Another vote PRO....
     
  42. FDM80

    FDM80 Network Guru Member

    I understand the want of some people to keep Static DHCP out because it would be straying farther from the linksys original. I like that hyperwrt's focus is on staying close to the original, keeps things simple. Personally, I think static dhcp would be good though. I believe D-Link actually has static DHCP as a standard feature in there newer offerings (might be netgear but I don't remember for sure). If linksys competitors are putting in static DHCP as a standard feature and linksys isn't making an effort to match their competitors features then that usually raises a few eyebrows in my case. I think that because the competition is making static DHCP a normal thing that having it on a linksys wouldn't exactly be straying as far from the norm as it would have been a year ago. That's my opinion, coming from a tinypeap addicted user, and therefore tied to the hip to satori, for now.
     
  43. rtau

    rtau Network Guru Member

    I think udhcp can be compiled into Busybox although it exist as another project.

    http://www.busybox.net/downloads/BusyBox.html
     
  44. JasonM

    JasonM Network Guru Member

    One more vote for static DHCP.

    I have a laptop that I use at work and home so I can't use a single static ip. I have ports forwarded at home and therefore need to pick up the same IP every time.

    Thanks,
    Jason Martin
     
  45. shamran

    shamran Guest

    Me to for my PDA and VOIP phone !
     
  46. kingdaveone

    kingdaveone Network Guru Member

    static dhcp

    me to for static dhcp
     
  47. Lord_KiRon

    Lord_KiRon Network Guru Member

    I need it too !!!!

    My laptop use DHCP at work but at home I need to forward some ports to it so now I use static at home and each time I go to work I have to change to DHCP , came back home - back to static :(
     
  48. Jumbo

    Jumbo Network Guru Member

    Static DHCP please !!!
     
  49. karankas

    karankas Network Guru Member

    Setting up a Static IP Address with the Linksys WRT54G

    If u want to set up a Static IP Address with the WRT54G the fasters way -for Windows users- is make it like here:

    http://www.portforward.com/networking/staticip-dhcp.htm

    Select ur O.S. version.

    Linux/BSD/etc users can make the follow the same steps :)

    Make sure the DHCP IP address range of the modem does not include the one u want to set up.
     
  50. ravn

    ravn Network Guru Member

    It's not the same...

    :(
     
  51. karankas

    karankas Network Guru Member

  52. kdude

    kdude Network Guru Member

    Re: Setting up a Static IP Address with the Linksys WRT54G

    OK, stop the whining and go over to http://www.hyperwrt.org/forum/viewtopic.php?id=506 and get what you are looking for. HyperWRT with static DHCP and Linksys 4.20.7 base - all thanks to tofu, thibor and rupan - they seem to build on each others good work and is much appreciated. I've been running this for a few days now and using static DHCP feature with no issues whatsoever. No, it's not an 'official' HyperWRT release, but it works very well.
    HyperWRT Forum
     
  53. Green

    Green Network Guru Member

    and there is Static DHCP configuration for Rupan's version?
    :(
     
  54. kdude

    kdude Network Guru Member

    I haven't installed Rupan's latest but I read that it requires editing the files directly and does not include web configuration for static DHCP. Do you know if that is correct?
     
  55. Green

    Green Network Guru Member

    I know that GUI configuration not possible, but which files should be edited?
     
  56. kdude

    kdude Network Guru Member

    Can't really say as I installed Tofu's version and have been quite happy with it and have not even tried to look under the covers too much. However, there is a file (/tmp/udhcpd.conf) that contains the static DHCP entries that I configured through the GUI. However, I'm always nervous about files in /tmp and their longevity. Have you checked the forums over on hyperwrt.org?
     

Share This Page