Static DHCP

From DD-WRT Wiki

Revision as of 19:36, 2 May 2006 by Jgoldberg (Talk | contribs)
Jump to: navigation, search

Contents

What is Static DHCP?

Static DHCP is a useful feature which makes the DHCP server on your router always assign the same IP address to a specific computer on your LAN. To be more specific, the DHCP server assigns this static IP to the network card of your computer. Every network card has its unique address - the so called MAC address (MAC = media access control), that is used to identify it on the LAN.


Why would I need Static DHCP?

You will need this if you want your computer to always have the same IP address. This is useful if other people on your LAN know your IP and access your PC using this IP. Another important use is, when you do Port Forwarding. If you forward an external WAN TCP/UDP port to a port on a server running inside your LAN, you have to give that server a static IP that does not change.

v23 Port Forwarding section in the Web GUI

How does static IP address assignment work?

Your computer boots and requests its IP from the router's DHCP server. The DHCP server recognizes the MAC address of your PC's network card and assigns the static IP address to it.


How to Set Up Static DHCP Assignment

  1. Log into the DD-WRT Web GUI
  2. Go to Administration -> Services
  3. DHCP Daemon should be enabled
  4. Under Static Leases Enter the MAC address of the client interface, the hostname of the machine, and the desired internal IP for this machine.
  5. Before clicking the Add button, you need to scroll to the bottom of the page and save your changes.
  • If you don't save these fields before clicking the Add button, your Static DHCP settings will be lost, and you'll have to enter the information again.


v23 DHCP Services section in the Web GUI

Explanation of Dhcpd options

The DHCP system assigns IP addresses to your local devices. While the main configuration is on the setup page you can program some nifty special functions here.

Dhcpd: Disabling here will disable dhcp on this router irrespective of the settings on the Setup screen.

Used domain: You can select here which domain the DHCP clients should get as their local domain. This can be the WAN domain set on the Setup screen or the LAN domain which can be set here.

LAN Domain: You can define here your local LAN domain which is used as local domain for DNSmasq and DHCP service if chosen above.

Static allocations: If you want to assign certain hosts a specific address then you can define them here. This is also the way to add hosts with a fixed address to the router's local DNS service (DNS masq).

The format for static allocations is:

<IP Address>  <##:##:##:##:##:##>  <Hostname>

Warning: Be sure to set your static IPs outside of your automatic DHCP address range. This range is 192.168.1.100-192.168.1.149 by default and can be configured on the Setup screen.

Also note: Make sure you do not have a blank set of fields (MAC, HOST, & IP). This will cause an error "is not a valid MAC address" because you left a MAC address field empty.

Example

To assign the IP address 192.168.1.12 and the hostname "mypc" to a PC with a network card having the MAC address 00:AE:0D:FF:BE:56 you should press Add then enter 00:AE:0D:FF:BE:56 into the MAC field, mypc into the HOST field and 192.168.1.12 into the IP field.

After each entry press Save Settings (at the bottom of the Services page).

To add an additional entry, press Add again.
{Comment: Image of DHCP Services section here. --Jgoldberg 20:36, 2 May 2006 (CEST)}

If you press the 'Add' button before saving the entries you just made, they will be cleared. This is normal behavior in v23.