Dynamic host configuration protocol (DHCP)
The number of available private IP addresses within a private network is limited. Assigning
each device on a network its own private IP address would not be sensible, as that device
may leave and never join again, resulting in a wasted IP address.
Instead, DHCP is used to assign IP addresses to devices as they join a network. DHCP
uses a pool of available IP addresses to allocate IP addresses to new devices for the
duration of their session. Once a device leaves the network, the IP address that the device
was using is returned to the pool for allocation to a new device.
Network address translation (NAT)
The diagram shows a network
consisting of three computers, each
of which is allocated a private
(non-routable) IP address. The
network’s router has two IP
addresses, one private address on
the private network’s side and a
public (routable) address on the
Internet’s side. There is a server
connected to the Internet with a
routable IP address.
If a device on the network sent a packet to the server, the server couldn’t respond to the
computer directly because the computer’s IP address is non-routable - not globally unique.
NAT gets around this problem.
When a device
on the private network (let’s use 192.168.1.2)
needs to communicate with a device on the
Internet (let’s use the server), it sends packets
through the router, which makes a record of
the packet before replacing the private IP
address of the computer with its own routable
IP address.
When a response is received, it is sent to the
router’s public IP address, which then
forwards the response to the correct private IP
address by using the record it made when
sending the packet.