IP Address and DHCP
What is an IP address?
An IP (Internet Protocol) address is a unique logical address that identifies a device on a network.
Format (IPv4)
An IPv4 address consists of 4 bytes (32 bits), usually displayed in decimal form:
192.168.1.42
Each value is between 0 and 255. IPv6 also exists, but we focus here on IPv4, the most common.
The 3 components of an IP configuration
When a machine is connected to a network, it uses 3 main pieces of information:
| Element | Role | Example |
|---|---|---|
| IP Address | Identifies the machine on the network | 192.168.1.42 |
| Subnet Mask | Indicates which portion of the IP is the network, and which portion is the host | 255.255.255.0 |
| Gateway | Exit point from the local network to the outside (e.g., Internet) | 192.168.1.1 |
Subnet Mask
The subnet mask allows you to know if two IP addresses are on the same local network. It consists of 32 bits, like the IP address. A bit set to 1 indicates the network part, and a bit set to 0 indicates the host part. The bits set to 1 are consecutive, followed by bits set to 0.
For example, for the mask 255.255.255.0, corresponding to 11111111.11111111.11111111.00000000. This indicates that the first 3 bytes (24 bits) are for the network, and the last byte (8 bits) is for the host.
IP Address : 192.168.1.42
Mask : 255.255.255.0
Network : 192.168.1.0
Machines whose IP addresses start with 192.168.1. can communicate directly.
Default Gateway
This is the IP address of the local router. If a machine wants to communicate with a device outside its local network, it sends the packet to the gateway, which forwards it to the outside (Internet, another network, etc.).
Static IP vs Dynamic IP
| Address Type | Definition | Usage Example |
|---|---|---|
| Static IP | Address manually set in the configuration | Servers, network printers |
| Dynamic IP | Address assigned automatically by DHCP | Laptops, phones, clients |
The DHCP Protocol (Dynamic Host Configuration Protocol)
Objective
Automatically assign to each machine on the network:
- An IP address
- A subnet mask
- A gateway
- One or more DNS servers
DHCP Operation
-
DHCP Discover: The device sends a broadcast to find a DHCP server. A broadcast is a message sent to all devices on the local network.
-
DHCP Offer: The DHCP server responds with an available IP address offer.
-
DHCP Request: The device accepts the offer and requests to use the address.
-
DHCP Ack: The server confirms the assignment of the IP address.
Lease Duration
The IP address is assigned temporarily: it's a lease (e.g., 24 hours).
When the lease expires, the device must renew the IP address.
On a personal or small business network, the router often acts as the DHCP server. It assigns IP addresses to connected devices. For a more complex network, a dedicated server can be used.
Diagnostic Tools on Windows
| Command | Role |
|---|---|
ipconfig | Displays the current IP address |
ipconfig /all | Also displays details: MAC, DHCP, DNS |
ipconfig /release | Releases the current IP address |
ipconfig /renew | Requests a new IP address via DHCP |
ping 192.168.1.1 | Tests connectivity with the gateway |
Graphical Tool:
You can also use:
- Network & Internet (accessible via Windows settings)
- Network & Internet (accessible via the Control Panel)
Example of a Typical IP Configuration (Windows)
Ethernet adapter Wi-Fi:
Connection-specific DNS Suffix . : localdomain
IPv4 Address. . . . . . . . . . . : 192.168.0.105
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
Summary
| Element | Function |
|---|---|
| IP | Unique address to identify a machine |
| Mask | Indicates the boundary between network and host |
| Gateway | Allows access to external networks |
| DHCP | Automatically assigns network settings |