Assign IP's to certian mac addresses in dd-wrt

2,496

Assigning IP addresses based on MAC addresses is generally done by the DHCP server; this is often referred to as "static leases".

Here's the DD-WRT tutorial on enabling Static DHCP. In the web administration GUI, you'll find this option on the Services tab, in the DHCP Server options.

If you're using the ssh commandline interface, use the following commands:

  • builds earlier than 13832:

    # X is the total number of static leases
    nvram set static_leasenum=X
    
    # note the space between the two example addresses
    nvram set static_leases="00:11:22:33:44:55=name1=IP-Address1 00:11:22:33:44:56=name2=IP-Address2"
    
  • build 13832 and later:

    # X is the total number of static leases
    nvram set static_leasenum=X
    
    # note the space between the two example addresses
    # the last field is new; lease time; leave empty for "indefinite"
    nvram set static_leases="00:11:22:33:44:55=name1=IP-Address1= 00:11:22:33:44:56=name2=IP-Address2=1440"
    

alt text

Share:
2,496

Related videos on Youtube

hardywang
Author by

hardywang

Updated on September 17, 2022

Comments

  • hardywang
    hardywang almost 2 years

    First of all I need to apology, I have very little Unix/Linux knowledge.

    I am following http://dns323.kood.org/howto:subversion to install SVN server on my DLink DNS323 device. I have successfully install Fonz Fun Plug. And I think I installed subversion-1.5.2-1.tgz as well.

    According to the document I need to run svnserve.sh, in which part of the soruce code is

    svnserve_start() {
        if [ -x "{$BINDIR}/svnserve" ]; then
            echo "Starting svnserve deamon... "
            ${BINDIR}/svnserve -d -r ${REPOSITORY}
        else
            echo "ERROR: svnserve not found or not executable"
        fi
    }
    

    I got ERROR: svnserve not found or not executable message, so it looks like to me $BINDIR is not defined well.

    Anybody knows, how can I do echo to display the value of $BINDIR?

    Thanks!

    • Jim Garrison
      Jim Garrison over 11 years
      Is this bash? Shouldn't {$BINDIR} be ${BINDIR}?
    • Basile Starynkevitch
      Basile Starynkevitch over 11 years
      I would suggest to take time to learn Linux by installing it on your main PC (laptop or desktop) computer.
  • quack quixote
    quack quixote about 14 years
    the procedure may differ if you've replaced the default DHCP server with DNSmasq; see dd-wrt.com/wiki/index.php?title=DNSMasq_as_DHCP_server
  • Unfundednut
    Unfundednut about 14 years
    Perfect thanks. Was hoping for a web based way but this works perfectly as well.
  • Piotr Dobrogost
    Piotr Dobrogost about 14 years
    MrStatic: There is a web based way. To quote quack quixote - In the web administration GUI, you'll find this option on the Services tab, in the DHCP Server options.
  • Aspartame_Xu
    Aspartame_Xu over 12 years
    @Piotr Dobrogost: The web based way is broken for a lot of people, including me. I'm on DD-WRT v24-sp2 (06/14/11) and the web interface for adding static leases just plain doesn't work. It gives no errors. It just does nothing. Searching shows that a lot of people have this issue.
  • Aspartame_Xu
    Aspartame_Xu over 12 years
    BTW, don't define extra leases or none of them will be saved. X must be the exact number defined in following statement.