Skip to main content

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:

ElementRoleExample
IP AddressIdentifies the machine on the network192.168.1.42
Subnet MaskIndicates which portion of the IP is the network, and which portion is the host255.255.255.0
GatewayExit 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 TypeDefinitionUsage Example
Static IPAddress manually set in the configurationServers, network printers
Dynamic IPAddress assigned automatically by DHCPLaptops, 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​

  1. 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.

  2. DHCP Offer: The DHCP server responds with an available IP address offer.

  3. DHCP Request: The device accepts the offer and requests to use the address.

  4. 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.

info

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​

CommandRole
ipconfigDisplays the current IP address
ipconfig /allAlso displays details: MAC, DHCP, DNS
ipconfig /releaseReleases the current IP address
ipconfig /renewRequests a new IP address via DHCP
ping 192.168.1.1Tests 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​

ElementFunction
IPUnique address to identify a machine
MaskIndicates the boundary between network and host
GatewayAllows access to external networks
DHCPAutomatically assigns network settings