vandeneynde.net
28Oct/08Off

Getting DHCP reservations into a Belkin N1 Vision router

Yesterday, I bought a new wireless router for home. I was in the computer store to buy some DVDs and picked it up in more of an impulse. My old router was not performing well so I bought the first draft-n gigabit router I happened to stumble upon after quickly having verified that it was supported by dd-wrt.

Back home, I noticed that I was a little too quick in verifying the dd-wrt support. It will be supported by dd-wrt but currently it is still a work in progress. So I decided to use the stock Belkin firmware for now. However, one minute later, I stumbled upon a major problem in that plan. The little router does not support DHCP reservations which I need in my home network. I could offload DHCP to another small device in my network but I preferred to have the router handle it.

This leaves three options for getting DHCP reservations in the box:

  1. cross-compile my own firmware (GPL sources and MIPS toolchain are available for download)
  2. modify an existing Belkin firmware image by injecting extras in the image
  3. hack into the router and modify  configuration parameters to support DHCP reservations.

I decided to see what’s behind door number 3 and after a an hour or two I found two ways of adding your static DHCP leases to the device.

The first way is by modifying he configuration file of the device. You can backup the running configuration from the GUI and save it to your local PC. That backup file (user.conf) contains all nvram parameters to get the router configured. I noticed that it had quite the same parameters as my old linksys router. Especially the parameter static_dhcp_clients was of interest to me. After looking at the linksys example, I filled it up with my dhcp leases :

static_dhcp_clients=hostname1:192.168.20.2:001AAABBCCDD:1:hostname2:192.168.20.3:009988776655:1

After feeding it back to the GUI (restore configuration), the GUI told me the CRC was incorrect. Some trial & error learned me that the check was a CRC-32 (8 bit) check done over all the parameters. This checksum was put at the end of the file in hex. With this knowledge, I opened up my hex editor, changed the checksum, uploaded the modified configuration and after a reboot of the router, I had static leases working!

The second way I found is even easier. There is a hidden web page in the administration website : http://routerIP/wukongjiuwo.html. This is a diagnostics page which gives you web-form based console access to the device. In the console, the following command followed by a reboot should bring static dhcp leases in the box:

nvram set static_dhcp_clients=hostname1:192.168.20.2:001AAABBCCDD:1:hostname2:192.168.20.3:009988776655:1

If you decide to use some of this ‘wisdom’ on your own router, please do so at your own risk!

Filed under: IT, Tech Comments Off
Comments (20) Trackbacks (0)
  1. Sounds interesting. Could you please explain more changing checksum using an hex editor ?

  2. You can use for example winhex (http://www.x-ways.net/winhex/). With this, you edit the text part of the config and then highlight all the configuration text (starting with lan_ippaddr until bpa=0. Next you click on Tools-compute Hash and generate the CRC32 code. This code is the hex value of the checksum. you need to enter this (in hex) after the bpa=0 part. (remove everything behind it first).

  3. Funny, I’m not a network guru, but DHCP reservations is the ONE feature I with this router had.

    Could you give us a dummies version of how to do this? Do I type EXACTLY what you’ve got above:
    “nvram set static_dhcp_clients=hostname1:192.168.20.2:001AAABBCCDD:1:hostname2:192.168″ without quotes, or, do I replace the words hostname or the IP address or the AABB… with something else? i.e. are any of these variables that I’m supposed to change? Don’t want to brick my router. : )

  4. Hi Rob,

    They are indeed variables you need to change.
    hostname1=hostname of the machine
    192.168.20.2= static IP address you would like to allocate to the machine
    AAABBCCDD= MAC address of the machine where you want to allocate this IP to. You can find the mac address with an ipconfig /all on windows and look for the physical address of your adapter.

    Don’t worry, this should not brick the router :)

  5. DHCP Reservation – IT WORKS!! I just got a Belkin N1 Vision version 2000.
    Couldn’t get it to work at first because I saw in the example the long MAC address – which I recognized as such and glossed over – not noticing the required :1.
    And, restarting the router, which is required, doesn’t cause it to loose this setting. Nice.
    Version 2000 boots much quicker. About 28 seconds.
    Interesting that it comes with firmware version F5D8232-4_WW_2.00.04
    .04 is newer than what is on their US page. Yes, I live in the US.
    Thank you so much for this DHCP address reservation tip.

  6. QoS is on and grayed out. Can’t turn it off.
    Also, http://192.168.2.1/wifi.html (secret web page) doesn’t work on this v2000.

  7. Wow!
    Thanks for this, you’ve no idea how much pain you’ve saved me! This worked great. Just to clarify and help people, when wanting to set up a linux server (a good example of why you may want a static internal IP), find out your host name, and MAC address, both of which can be found by opening up terminal and typing in “ifconfig” without the quotes.

    The stuff after HWaddr is the mac address (you need to take out the colons).
    then to find your hostname, just type in “hostname” (without quotes) to give the hostname. Then as said above, on the router page (mine was http://192.168.2.1/wukongjiuwo.html ), type in the first box:

    nvram set static_dhcp_clients=hostname:192.168.2.19:0002ABBCCDD:1

    (or whatever it is, just edit in your values for hostname, the ip address and the MAC address)
    click enter, apply changes, and it should reboot. Looking at the DHCP client list, it will no longer show up, but it will be working on the ip address you specified.

    Thanks again!

  8. Just got a new PC. How would one clear out the old DHCP reservation that was set using your trick? nvram -set …. etc.?

  9. Hi all trying to get this working and im entering everything as it says here but no go for me.
    Do i need to set each client seperatly or can i do them all at once as when i try to enter all there seems to be not enough space to enter all the text in the command box.
    i want to get 9 clients working.

  10. Hi Daz,

    You should be able to enter them all at once. I don’t know if it will work for 9 clients as I didn’t try with that much hosts. I currently don’t use the AP any longer so I can’t try it out.

    Kind regards,

    Tom

  11. Thanks Tom but i can’t even get it to work for 1 client, im wondering if it has anything to do with the firmware im using its the pre release 1.00.16 version.

  12. Hi,
    I can’t get it to work either. I’m using the 1.00.16 fw, hardware: F5D8232-4 v1000. I used nvram get static_dhcp_clients which showed that it saved what I entered, but when I check the ARP entries from another computer, it shows as dynamic when on and doesn’t appear when off. Though the DHCP Client List always shows it there now.
    Either way, Wake on WAN still doesn’t work for me.

  13. Hi All,

    I am afraid I can’t test it anymore for myself as I no longer use and have the device.
    However, ARP entries are always dynamic in nature if you check them from another PC unless you configured them statically on that PC. It’s just the way ARP works.
    If static DHCP leases aren’t working any longer the way I originally described it, Belkin might have changed the behaviour in their new firmware. I don’t remember which firmware I ran on the device back then but it might be an older version.

    Kind regards,

    Tom

  14. Thanks for the reply Tom. I’m still trying to figure out a way to get it to work – I’ve changed things around and I’m currently testing port-forwarding to the broadcast address. I’m not certain if I’ve got the address right, but so far, the ARP entry has stayed in the table for 7 minutes (and still counting) after shutdown.
    I’ll report back if I get it working successfully.

  15. Could someone please let me know how to add many reservations please? The command line seems to be a limited amount of characters which only lets me enter 3 reservations. How do I add more entries into static_dhcp_clients?

  16. GAR – If you use Firebug in Firefox, you can change the limit. In the HTML, there is a maxlength property set to 150. Eliminate that and you’ve got no limits.

  17. Please have a look at my post at the Belkin N1 Vision thread in the DD-WRT forum for a way to enable port-forwarding without first having to assign a static IP:

    http://www.dd-wrt.com/phpBB2/viewtopic.php?p=493352#493352

  18. Great article, but it won’t seem to work with my router ip, any helpful hints?

  19. Through http://routerIP/wukongjiuwo.html
    Type
    nvram show
    to view all variables you can change.
    I needed to assign the wan port to lan so i changed only these two parameters in this way:
    nvram set “wandevs=”
    nvram set “landevs=et0 et1 wl0 wl1″
    and then you can click on “Apply changes”.
    If you want to set the original values:
    nvram set “wandevs=et1″
    nvram set “landevs=et0 wl0 wl1″
    and then click on “Apply changes”.

    Please be careful to changes any parameter.

  20. …But maybe setting the router in “Access Point mode” has the same results. The bridge will be done internally i think.


No trackbacks yet.

Social Widgets powered by AB-WebLog.com.