Use Your Router To Create Static Local IP Addresses
We take a look at how to create static ip addresses on your local area network using your wireless router.
Make A Static Local IP Address For Each Device
In most small office/home office (SOHO) environments, running a wireless or cable modem router is common. By default, Dynamic Host Configuration Protocol (DHCP) is enabled to allocate a pool of local IP addresses to devices. As each device enables itself on the LAN, a DHCP server is waiting to allocate a dynamic IP address to it. This IP address' life varies according to a leased time. When the lease expires, the IP address is added back to the pool and a new one fetched and assigned.
If you are using DHCP on a SOHO network, you may want to assign a static local IP address to each device you own. Ideally, you could assign one for your Android tablet, your Windows machine, Linux box, iPad etc. Look for a DHCP Reservation feature in your router administration software. On Linksys routers for example, there is a DHCP reservation button in the Setup screen. Here is how mine looks for a Linksys WRT310N router:
By reserving an IP address, it becomes fixed and assigned to a device. The DHCP manager will not allocate new IP addresses that are already taken. A neat little trick without going through all the typing, is to log your device onto the LAN. Then, head to your router admin screen and add the client to the reserve pool. The Linksys WRT310N interface above, makes this very easy.
Multiple Operating Systems Per Device
When you are on a computer that has multiple operating systems to boot from, you must make sure that the hostname is the same. In most routers, they base the unique DHCP client signature on the client name, interface, IP address, and MAC address.
For example, on an Intel PC that I have in the office, it dual boots Ubuntu and Windows.
In Ubuntu, I modify /etc/hostname and /etc/hosts to be the same identifier.
In Windows, I go to Control Panel | System | Computer Name and Computer description and change it to the same identifier.
This prevents the case where if you boot into your Linux box and use the network, your client lease is going to be based on that Linux hostname. Now if you shut down and quickly go into Windows, the DHCP server may complain because there is a conflict in hostnames and it hasn't expired the lease yet. This way you keep the same name and there is no conflict.
Accessing Devices On Your LAN
Why are we going through the hassle of doing all of this? Because now, you will be able to have static local ip addresses in your LAN and gain access to each device. If you then decide to run a domain name server (DNS) internally, you will be able to identify each device by both ip address and name.
This is a nameless static ip address network because it uses no domain name server (DNS) internally in the LAN. Requests to go outside the LAN to invoke services proceed through the Internet Service Provider DNS servers for name resolution.
In the image above, if 220.127.116.11 was running Apache HTTP server and hosting a Wordpress blog, other devices on the LAN could see the blog by using a browser and surfing to:
Because there is no internal DNS server running on the LAN, you have to specify the IP address. You could create a local HOSTS file:
This host file would have to be copied and stored on each device. But that would be a terrible mess to manage as more resources come and go online. Also, some devices may require to be jailbreaked (like the iPad) in order to get at the hosts file and we wouldn't want to go about doing that.
The solution to getting rid of typing IP addresses is to create a local DNS server to help with ip address and name resolution internally and to pass off ip addresses outside the network to an authoritative DNS server to resolve. This machine would have to be on 24/7 so everyone on the LAN won't lose their way. Just like how one goes about looking in a telephone address book for a persons name, and then the telephone number, DNS works the same sort of way. However, this telephone book has to be made privately available to all callers on the LAN.
One possible solution is to use a DDNS service like DynDNS.org or tzo.com. These are paid services that allow you to create a domain name. If your ISP changes your IP address, your domain name will resolve without any problems.
The other solution is to install a DNS server on your LAN. There are many DNS server distributions available including:
Bind - Available on Linux distributions; free open source
Microsoft DNS - Available on Microsoft Server; not free
MaraDNS - Linux and Windows 32 bit (XP/Vista/Windows 7); free open source
Simple DNS - Windows 32 and 64 bit; not free
PowerDNS - Linux and Windows; free open source
Posadis - Linux and Windows; free open source
Discussion of how to get one of these DNS servers running is left for another day.