What's new

How to assign static LAN IP

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

gatorback

Regular Contributor
I would like to assign static LAN IPs to certain MAC addresses. I've done this with DD-WRT and imagine that it can be done with OpenWRT. I could not find an example. If you have done this before please provide an example. Thank you.
 
What router? What firmware?

Usually in the LAN config pages.
 
Is it possible to do this from the command line? I would like to be able to program routers with devices to be pinned to static LAN IPs.
 
Is it possible to do this from the command line? I would like to be able to program routers with devices to be pinned to static LAN IPs.
You can add them to dnsmasq itself using the the /jffs/configs/dnsmasq.conf.add file. Just add/remove entries llike this:

dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50

and then restart dnsmasq:

service restart_dnsmasq
 
And, if you want to give it a new name....

dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50,newclientname
 
You can add them to dnsmasq itself using the the /jffs/configs/dnsmasq.conf.add file. Just add/remove entries llike this:

dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50

and then restart dnsmasq:

service restart_dnsmasq

Is there any advantage to assigning IP addresses through the command line?

I have always done it the first way through LAN>DHCP>IP assignment and it works for me. The only problem I have with that is that I have to enter the IP assignments on every router individually if I want them the same. Doing a hard factory reboot requires that I have to enter the IP assignments manually again. It is somewhat tedious when you have 40+ assignments to do on multiple routers. Could this be done with a script that I only have to do once and can copy to each router without having to manually reenter it each time?
 
Is there any advantage to assigning IP addresses through the command line?

I have always done it the first way through LAN>DHCP>IP assignment and it works for me. The only problem I have with that is that I have to enter the IP assignments on every router individually if I want them the same. Doing a hard factory reboot requires that I have to enter the IP assignments manually again. It is somewhat tedious when you have 40+ assignments to do on multiple routers. Could this be done with a script that I only have to do once and can copy to each router without having to manually reenter it each time?

http://www.snbforums.com/threads/fe...hcp-hostnames-from-the-gui.25075/#post-186928
 
Or, if a gadget is already assigned a name in its OS, simply:
  • dhcp-host=android-fone,192.168.111.50
where android-fone is the gadget's hostname perhaps automatically assigned by its OS.

If not sure what name an OS assigns, we could find it in System Log > DHCP Leases page in Asuswrt-Merlin. While you're at it (and if possible), re-assign a user friendly name to your gadget in its OS..
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top