How to obtain an IP address?
- Hard-coded in config file by system admin (e.g., /etc/rc.config in UNIX).
- Obtain an IP address dynamically from DHCP.
DHCP: Dynamic Host Configuration Protocol
Typically, DHCP server is co-located in a router, serving all hosts in its host portion.
Steps
- DHCP discovery: Host broadcasts, using 255 address, DHCP discover message.
- DHCP offer: DHCP server responds with DHCP offer message containing available IP addresses.
- The first two steps can be skipped if host remembers and wishes to reuse a previously allocation address.
- DHCP request: Host sends DHCP request message with a specific IP address it wants to use.
- DHCP ack: DHCP sends DHCP acknowledge message, assigning the IP address to the host.

DHCP does more than IP address
- serves IP address of first-hop router.
- serves name and IP address of DNS server.
- serves subnet mask indicating network versus host portion of address.
- client now knows its IP address, name and IP address of DNS server, IP address of its first-hop router.
Hierarchical IP Addressing
This sets up the hierarchy: an organization doesn’t get its IP address block from ICANN directly — it gets a slice of an ISP’s already-allocated block.

The example shows an ISP holding 200.23.16.0/20, which it then splits into eight /23 blocks, one per each customer organization. So the organizations’ addresses are all nested inside the ISP’s larger block.
This gives 2^9 = 512 IP addresses which each customer organization can use on their own.
Route Aggregation

Because all eight organizations’ blocks live inside the ISP’s single /20, the ISP doesn’t need to tell the rest of the Internet about each customer individually. It can advertise just one aggregate announcement — “send me anything starting with 200.23.16.0/20” — and that one route covers all eight downstream organizations.
This is the core idea: hierarchical addressing lets you summarize many specific routes into one, keeping the global routing tables (which every backbone router has to hold) dramatically smaller.
Real World Application

Organization 1 switches providers, moving from its original ISP to AT&T but keeps its original address block (200.23.18.0/23) instead of renumbering. Now the addressing no longer matches the topology cleanly:
- The old ISP is still advertising the full aggregate
200.23.16.0/20, which technically still includes Organization 1’s addresses. - But traffic for Organization 1 actually needs to go to the new ISP now.
So AT&T has to additionally advertise a more specific route just for 200.23.18.0/23 (“or 200.23.18.0/23”), on top of its own aggregate block. Routers then rely on longest-prefix matching to notice that this more specific /23 route overrides the broader /20 aggregate for that particular slice of addresses, and correctly send Organization 1’s traffic to AT&T.
NAT: Network Address Translation
Overview
NAT allows all devices in local network to share just one IPv4 address:
- All devices in local network can have a private IP address (e.g. 192.168.1.0).
- Advantages:
- just one IP address is needed from provider ISP to cover all devices.
- can change addresses of host in local network without notifiying outside world.
- can change ISP without chaning addresses of devices in local network.
- security: devices in local network is not directly visible by outside world.
Network Address Translation
- Outgoing datagrams
- replace (source IP address, port #) in every outgoing datagram fields with (NAT IP address, port #).
- remote clients will respond using (NAT IP address, port #) as destination address.
- Incoming datagrams
- replace (NAT IP address, port #) in every incoming datagram fields with corresponding (source IP address, port #).
- NAT table
- every (source IP address, port #) is mapepd to (NAT IP address, port #) pair.

NAT is conversial
- routers should be only concerned with up to 3 layers (port number is transport layer).
- violates end-to-end argument since network-layer manipulates port number.
- address “shortage” should be resolved by IPv6.
- NAT traversal: what if client wants to directly connect to server behind NAT?
Transition from IPv4 to IPv6: Tunneling
e.g., IPv4 tunnel connets two IPv6 routers:
