Internet Business

DHCP and Static IP Addresses


DHCP stands for Dynamic Host Configuration Protocol. A DHCP server, a.k.a. router, automatically assigns random IP addresses to devices connected to it. DHCP ensures that each device attached to the network gets an unique and random IP address. The keyword here is "random".

DHCP is a standard feature enabled by default in almost any operating system. When you first install Windows on a computer, your network interface card, often referred to as "NIC", is set to fetch an IP address from the router using DHCP protocols.

Due to the nature of DHCP, the IP address that you receive each time you turn on your computer could be different. If your Windows is set to use DHCP protocol to fetch an IP address, it is, most of the time, going to get a random IP address each time it connects to the router. (e.g. whenever you turn on the computer)

DHCP is often disabled for servers, and here is why.

 

Communication flow between a website visitor and the web server

 

The illustration above shows a network structure with a web server. Assuming all devices are set to DHCP and they have been given the IP addresses by the router as shown above.

Let's say Bob wants to browse the website hosted by the web server.

  • Step 1: Bob opens up Firefox and types in the website address, say "www.example.com"
  • Step 2: Since www.example.com is configured to point to the IP address 12.34.56.78 by the webmaster, Bob's Firefox attempts to establish a connection with the IP address 12.34.56.78.
  • Step 3: The router grants the access and forwards the connection to the pre-configured web server's IP address 192.168.0.2 within its network.
  • Step 4: The connection between Bob and the web server with the internal IP 192.168.0.1 is established by the router and Bob can now view the website hosted by the web server.

Things are working perfectly until a power outage which caused all the computers, including the servers to reboot. After the power outage, the network structure looks like this:

Let's say Bob wants to come back and look at the same website again...

Step 1: Bob opens up Firefox and types in the website address, say "www.example.com"

Step 2: Since www.example.com is configured to point to the IP address 12.34.56.78 by the webmaster, Bob's Firefox attempts to establish a connection with the IP address 12.34.56.78.

Step 3: The router grants the access and forwards the connection to the pre-configured web server's IP address 192.168.0.2 within its network.

Step 4: No website is being hosted on 192.168.0.2, so Bob's Firefox displays a "Page Not Found" page.

 

Servers are usually configured with Static IP Addresses

To avoid situtations like the above from occuring, servers are usually configured with static IP addresses. 

We'll talk from IPv4 perspective here. When a system is set to fetch an IP address using DHCP protocol, it obtains the following information from the DHCP server, or the router:

  1. IP Address
  2. Subnet Mask
  3. Default Gateway
  4. DNS server
  • The IP Address is a randomly assigned internal IP address by the router.
  • Subnet Mask is set by the router. We won't go into details about this yet.
  • Default Gateway is usually the IP address of the router.
  • DNS server stands for Domain Name System. To keep it short and simple, it is simply what translates a website address into the IP address of the hosting server.

To set a static IP address, so simply need to manually configure your network card with the above information.

 

DHCP Scope

DHCP Scope is the range of IP addresses that are available to be given out to DHCP clients by the DHCP server. DHCP clients are simply all the network devices attached to the router. e.g. computers, servers, network printers...etc.

DHCP Scope is a setting of the router that you can configure.

For example, for the above router with an internal IP address of 192.168.0.1, it could have a DHCP Scope of 192.168.0.2 to 192.168.0.100. So for any device that is trying to fetch an IP address from the router using DHCO protocol, the router may assign any random IP address within the DHCP Scope.

 

Set Static IP Addresses outside the DHCP Scope

Let's say in a network as shown in the above illustration, the Web Server with a static IP address of 192.168.0.2 has gone for repairs.

The router may assign any other network device with the IP address 192.168.0.2.

When the Web Server returns from repairs, there will be an IP conflict between the Web Server and the device that was given the same IP address by the router.

Therefore, to avoid possible conflicts, it is essential to set static IP addresses outside the DHCP Scope of the router.

 

IP Reservation

IP reservation is another setting of the router that can be configured. It is a specific IP address within a scope permanently set aside for a specific DHCP client.

Each network card has an unique identifier, often referred to as the MAC address. If you type "ipconfig /all" in the commands window in Windows you will be able to see the MAC address (shown as the "Physical Address") of your network card:

The screenshot above shows that my network card has a MAC address of 00-21-5A-22-12-83

Routers often use MAC addresses to setup IP address reservations.

 

To set a Static IP Address in Windows

Step 1: Go to the Properties of your network card in Network Connections (This is shown in Vista)

Step 2: Set the static IP address in Internet Protocol Version 4 or 6

 

To set a Static IP Address in Mac

Step 1: Go to "System Preferences". Then click on "Network Preference"

The illustration above is connected to the router using AirPort NIC.

Step 2: Under the TCP/IP tab, change the "Configure" selection menu to "Manually", then enter in your IP, Subnet Mask, Router (e.g. Default Gateway in Windows configuration), and DNS servers.


Share it! IF YOU LIKE THIS ARTICLE

Twitter
Digg
Facebook
Delicious
Stumble

People Who Read This Article Also Liked:


Enable Commentluv | This site uses KeywordLuv