Chapter5 NetworkLayer Withnotes
Chapter5 NetworkLayer Withnotes
Chapter 5
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Network Layer Overview
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Problem
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
The Network Layer
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Store-and-Forward Packet Switching
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Network Layer Functions
To move packets from a sending host to a receiving host,
two important network layer functions are needed:
• Forwarding:
− Directing a data packet to an outgoing link
− Router-local action
− Individual router using a forwarding table
− Take place at very short timescales (typically nanoseconds)
• Routing:
− Determining the route or path taken by the packets as they
flow from a sender to a receiver
− Network-wise process
− Routers talking amongst themselves
− Individual router creating a forwarding table
− Take place on longer timescales (typically seconds)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Network Service Models
• Connectionless service
• No advance setup is needed
• Packets are routed independently
• Packets are called datagrams
• Networks are called datagram networks
• Connection-oriented service
• Source-destination connection must be established
first
• This connection is called a virtual circuit (VC)
• Networks are called virtual-circuit networks
• All packets follow the same route
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Connectionless Service – Datagrams
Packet is forwarded using destination address inside it
• Different packets may take different paths
ISP’s equipment
A’s table (initially) A’s table (later) C’s Table E’s Table
Dest. Line
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Connection-Oriented – Virtual Circuits
Packet is forwarded along a virtual circuit using tag inside it
• Virtual circuit (VC) is set up ahead of time
ISP’s equipment
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Service Model for IP
• Connectionless Service – Datagram
• Best Effort Service
• Will make best effort to deliver the packets
− Packets can get lost, corrupted, reordered, misdelivered,
duplicated, delayed
• IP protocol’s greatest strength
− Runs over anything Email, Web, VoIP,
RSTP, etc.
TCP/IP Protocol IP
stack Ethernet, PPP,
WiFi, FDDI
Twisted Pair, Fiber optics,
wireless, Coaxial cable
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Inside a Router
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Router Architecture
Functions: Components:
• Forwarding • Input ports
• Routing • Output ports
• Switching fabric
• Routing processor
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Terminate Inside a Router
Perform data-
physical link
link functions Can perform
look-up and
forwarding
Store incoming
Connect input ports packets (queues)
to output ports and transmit on
outgoing link;
Executes routing
protocols, main
forwarding tables
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Router Functions
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Router Physical Layout
Juniper T series
Switch
Linecards
Cisco 12000
Review - 1
• Network layer: deliver packets from a sending host to a
receiving host
• Service that can be provided by the network layer
• Connectionless service
• Connection-oriented service
• Network layer protocol used in Internet: IP
• IP protocol helps interconnect heterogeneous
networks in a scalable fashion
• Best-effort datagram delivery service
• Router: a core device at network layer
• Key components and two functions
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Routing Algorithms
• Optimality principle »
• Dijkstra’s Shortest path algorithm »
• Distance vector routing »
• Link state routing »
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Problem
• Routers have forwarding tables
• Map IP prefix to outgoing link(s)
• Entries can be statically configured
• E.g., “map 12.34.158.0/24 to Serial0/0.1”
• But this doesn’t adapt
• To failures
• To new equipment
• To the need to balance load
• How to build the forwarding table?
• Via routing protocols
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Theory
• Based on graph theory
• Nodes: hosts, routers, networks
• Edges: physical links
• Each edge is associated with a cost
• No edge -> infinite cost
• Neighbor: directly connected nodes
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Goal of Routing
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
The Optimality Principle
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Cost Metric
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Dijkstra’s Shortest-Path Algorithm (1)
Given: network topology with link distances (costs)
• Infinity if two nodes are not direct neighbors
Compute: shortest paths between a source and all
destinations in the network
Example: consider the start node A, and find the
shortest paths to B,C,D,E.
Node Shortest distance Previous
6 from A node
A C
3 A 0
3 2 B 1 A
1 E
C 4 B
B D 3 D 3 B
2
E 6 D
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Dijkstra’s Shortest-Path Algorithm (2)
Initially,
• distances to all other nodes from the start node A are
unknown, therefore, set the distances to infinity (∞).
• Distance to A from A is 0
B D 3 C ∞
2 D ∞
E ∞
Visited = [] Unvisited = [A,B,C,D,E]
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Dijkstra’s Shortest-Path Algorithm (3)
• Visit the unvisited node with the smallest known distance from the
start node A.
• For the current node, examine its unvisited neighbors, and calculate
the distance of each neighbor from the start node A.
• If the calculated distance is less than the known distance, update the
shortest distance from start node A and the previous node.
• Add the current node to the list of visited node
B D C ∞ →6 A
3
2 D ∞
Visited = [] Unvisited = [A,B,C,D,E] E ∞
B D C 6 →4 B
3
2 D ∞ →3 B
Visited = [A] Unvisited = [B,C,D,E] E ∞
B D C 4 B
3
2 D 3 B
Visited = [A,B] Unvisited = [C,D,E] E ∞ →6 D
B D C 4 B
3
2 D 3 B
Visited = [A,B,D] Unvisited = [C,E] E 6 D
B D C 4 B
3
2 D 3 B
Visited = [A,B,D,C] Unvisited = [E] E 6 D
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Distance Vector Routing – Key Idea
• DVR works by having each router maintain a table (i.e.,
vector) giving the best known distance (cost) to each
destination and which link to use to get there
− Initial state: distance to neighbors
− Final state: distance to all nodes, and the next hop
− Tables are updated by exchanging information with the
neighbors
Destination Distance Next Hop
Initial
B 1 B
6 routing
A C C 6 C table at A
3
3 2 Destination Distance Next Hop
1 E
B 1 B
Final
B D 3 C 4 B routing
2 table at A
D 3 B
E 6
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 B
Distance Vector Routing – Questions
• Questions?
• What information to exchange?
• How to act on a message?
• When to send a message?
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Distance Vector Routing – What information
to Exchange
Destination Distance
B 1
C 6
Message shared by A
with its neighbors initially
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Distance Vector Routing – How to Act on a
Message
• Bellman-Ford equation
• Dx(y) ← minv{c(x,v) + Dv(y)}
• Dx(y) = estimate of the least cost from x to y
• c(x,v) = cost for direct link from x to v
• v is the neighbor of node x
• On receiving a message from a neighbor v,
• Update cost to destinations based on the Bellman-
ford equation; change next hop accordingly
• For each destination in the received routing table
− Dx(y) ← min{current estimate, c(x,v) + Dv(y)}
• Estimated costs finally converge to the optimal cost
after series of message exchanges
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Distance Vector Routing – Example (1)
How to update the routing table at
node A? 6
A C
Initially 3
3 2
Destination Distance Next Hop 1 E
B 1 B
B D 3
C 6 C 2
Message from B
Destination Distance
Dx(y)
A 1
Dv(y) Destination Distance Next Hop
C 3
D 2 B 1 B
C 4 B
c(x,v) Cost from A to B = 1 D 3 B
Distance Vector Routing – Example (2)
After the first iteration 6
Destination Distance Next Hop A C
3
B 1 B 3
1 2
C 4 B E
D 3 B B D 3
2
Message from C
Destination Distance Dx(y)
A 6
Destination Distance Next Hop
B 3
Dv(y) B 1 B
D 2
C 4 B
E 3
D 3 B
E 9 C
c(x,v) Cost from A to C = 6
Distance Vector Routing – How long to
Converge
• The settling of routes to the best paths across the
network is called convergence.
• If no topology changes, convergence will happen in a
few rounds.
• For a network whose longest path is of length N
hops, the convergence happens within N message
exchanges.
− After one message exchange, each node knows about
nodes two hops away
− After two message exchange, each node knows about nodes
three hops away,
− And so on….
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Distance Vector Routing – When to Send a
Message
• Triggered update: sent whenever the routing table
changes
• Link/node failure or cost changes
• Periodic update: sent even when no change in routing
table
• To tell others that “I am still alive”
• To update others’ routing table in case some route
becomes invalid
• Timescale: few seconds or few minutes
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Distance Vector Routing - Count-to-Infinity
Problem
Failures can cause DV to “count to infinity” while
seeking a path to an unreachable node
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Review - 2
• Dijkstra’s shortest path algorithm
• Given the topology, it finds the shortest paths from
one start node to all other nodes in the network.
• Static algorithm that works with global knowledge
• Distance Vector algorithm
• Nodes learn topology and finds the shortest paths
to other nodes by exchanging information with
neighbors
• Distributed algorithm that works with local
knowledge
• Suffer from the count-to-infinity problem
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing - Overview
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing – Key Idea
Two Phases:
• Phase 1: Nodes flood topology in the form of link
state packets
• Initial state: each node only knowns the cost to its
neighbors
• Final state: each node learns the full topology
• Phase 2: Each node computes its own forwarding
table
• By running Dijkstra’s algorithm to find the optimal
routes to all nodes
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing - Flooding
• Each node floods link state packet (LSP) that includes
neighborhood information to all nodes in the topology
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing – Problems & Solutions
(1)
• Problem 1: How to avoid loops and minimize message
exchanges?
A 6 A 6
A 6
C C
C
1 1
1
3 3
3
B B
B
A 6 A 6
C C
1 3
3 3
B B
Old new
• Solution to Problem 2:
• Use sequence number (seq.) to uniquely identify a
packet
• At a node, increment sequence number for each
new message flooded.
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing – Problems & Solutions
(3)
• Problem 3: What if the sequence number wrap around?
• Solution to Problem 3:
• Use a very large sequence space (e.g., 32 bits).
• Solution to Problem 5:
• Start with sequence number 0. If heard “your own”
packet, increment sequence number (within) and
use
• Packets are associated with an “age”, discard
packets when age becomes zero.
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing – Questions
• Questions?
• What information to send?
• How to act on a message?
• When to send a message?
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing – What Message to
Send
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing – How to Act on a
Message
Suppose node A receives an LSP generated by node B
(B may not be A’s neighbor)
Based on whether A has heard from B before
• If no, store the link-state information. Start an aging
timer.
• If yes, compare the sequence number of this packet
(seq_new) with the stored information (seq_old).
• If Seq_new > Seq_old, overwrite old link-state
information, refresh aging timer, forward to
”required” neighbors
• Otherwise, discard the packet
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link State Routing – When to Send
Message
Triggered updates
• A node floods the network whenever its link-state
information changes
Periodic updates
• Need not be sent often, use long timers (order of
hours) to avoid large flooding traffic
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
DVR vs LSR
Message complexity Robustness: what happens
if router malfunctions?
LSR: with n nodes, E links, O(nE)
messages sent LSR:
DVR: exchange between • Node can advertise incorrect
neighbors only link cost
• Each node computes only its
Speed of Convergence own table
LSR: relatively fast DVR:
DVR: convergence time varies • DV node can advertise
• May be routing loops incorrect path cost
• Count-to-infinity problem • Each node’s table used by
others (error propagates)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Review - 3
• Link State routing:
• Distributed algorithm
• Two phases: flooding, then calculate routes
• Provides fast convergence
• Used in Internet (IS-IS, OSPF)
• Comparison between LSR and DVR
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Congestion Control
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
The Problem of Congestion
What is congestion?
• Load is higher than capacity
What do IP routers do?
• Drop the excess packets
Why is this bad?
• Wasted bandwidth for retransmissions
“congestion
Goodput
collapse” Increase in load that
(useful results in a decrease in
packets)
useful work done.
Load 59
Congestion Control
Handling congestion is the responsibility of the Network
and Transport layers working together
− We look at the Network portion here
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Traffic-Aware Routing
Choose routes depending on traffic, not just topology
• E.g., use EI for West-to-East traffic if CF is loaded
• But take care to avoid oscillations
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Admission Control
Admission control allows a new traffic load only if the
network has sufficient capacity, e.g., with virtual circuits
• Can combine with looking for an uncongested route
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Traffic Throttling
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Load Shedding (1)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Load Shedding (2)
1
End-to-end (right) takes
5
longer to have an effect,
but can better target the 2
cause of congestion
6
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Load Shedding - Random Early Detection
(RED)
Basic idea of RED
• Router notices that the queue is getting backlogged
• … and randomly drops packets to signal congestion
When to start dropping?
• Router maintains a running average of its queue lengths.
• When the queue length on some link exceeds a threshold,
the link is considered to be congested.
• IP Packet Format »
• IP Addresses »
• Internet Control Protocols »
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
IP Packet Format (1)
• Version (4 bits) 32 bits
• Indicates the version
of the IP protocol
• Necessary to know
what other fields to
expect
• Typically “4” (for
IPv4), and sometimes
“6” (for IPv6)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
IP Packet Format (3)
32 bits
• Identification/Flags/Fragmen
t offset (32 bits)
• Supports dividing a large
IP packet into fragments
• Underlying links may not
support large packets
• Time-To-Live (8 bits)
• Limit packet lifetimes
• Routers decrement the
field by one before
forwarding; if zero
discard
• Default value = 64
• Used to identify packets
stuck in forwarding looks
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
IP Packet Format (4)
32 bits
• Protocol (8 bits):
• Tells which transport
process to give the
packet to.
• TCP: 6, UDP: 17
• Source/Destination IP
Address (32 + 32 bits)
• Global address space,
independent of physical
network address (MAC)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
IP Packet Format (5)
32 bits
• Options: rarely used
• E.g., Security, record
route, etc.
• Payload
• Higher layer data (TCP
or UDP segment)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
IP Packet Format – Fragmentation (1)
• Problem: each technology has different Maximum
Transmission Unit (MTU) size
• MTU: largest IP datagram that can be carried in a
frame
• E.g., Ethernet: 1500 bytes, WiFi: 7981 bytes.
• When fragmentation and reassembling happen?
• At host: select MTU of link it is connected to
• At intermediate router: if forward datagram on a
network with smaller MTU, fragment the datagram
• At destination: reassemble the fragments.
3-bit
16-bit Identification Flags 13-bit Fragment Offset
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
IP Packet Format – Fragmentation (2)
• Identification (16 bits): helps identify a datagram
• All fragments carry same identification
3-bit
16-bit Identification
13-bit Fragment Offset
• Flags (3 bits): Flags
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Problem
• Flat addressing: N hosts needs N entries in the
forwarding table (MAC addresses)
• Millions of hosts make address lookup in forwarding
becomes a bottleneck
• Need a method of reducing entries in the forwarding
table for scalability purposes
• Solution: hierarchical addressing
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Hierarchical Addressing
• Address structure: address captures location in the
network topology
• IP addresses (32 bits) consists of two parts: network
and host
• Network part identifies the network to which the
host is connected to
• Host part uniquely identifies each host in the
network
• How does this help?
• An entire network (e.g., a LAN) can be represented
by a single entry at a router.
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Classful Addressing
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Special IP Addresses
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Points to Note
• Every datagram contains the IP address of the
destination host, where the network part uniquely
identifies a single physical network
• All nodes that share the same network part are
connected to the same physical network
• An IP address refers to a network interface, rather
than a host
• If a host is on two networks, it must have two IP
addresses
• In practice, most hosts are on one network, thus
one IP address
• Routers have multiple interfaces and thus multiple
IP addresses.
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Forwarding at Host
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Forwarding at Router
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Example
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Review - 4
• Look at IP packet format
• Fragmentation and reassembly
• IP addresses (classful addressing):
• Hierarchical addressing to address scalability
• IP address has a network and a host part
• Significantly reduces entries in the forwarding table
• Looked at how forwarding is done at host and router
• Next: How IP addresses are assigned now?
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Issues of Classful Addressing
• Motivating example:
• Network with just 2 hosts needs a Class C address;
efficiency is 2/2^8 = 0.7%
• Network with 260 hosts needs a Class B address;
efficiency is 260/2^16 = 0.4%
• Class B addresses in high demand
• Class B networks: ~ 16000 (2^14)
• Out of class B addresses
• Out of addresses to hand out (2^32 ~ 4 billion in
total)
• Problem: how to address the “address assignment
inefficiency” issue?
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Scenario 1
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Subnetting (1)
• Introduce another level of hierarchy
• Divide host part into subnet id and host id
Network Number Host Number
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Subnetting (2)
• Address format of subnet number (prefix): a.b.c.d/x,
where x is number of bits in the network portion of the
address
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Subnetting (5) - Example
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Longest Matching Prefix
• Routers do a prefix match
• There may be many matching prefixes
• Packets are forwarded to the entry with the longest
matching prefix or smallest address block
− Complicates forwarding but adds flexibility
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Scenario 2
• An organization has a physical network with 4000 hosts.
• Classful addressing: give a class B address
• Efficiency = 4000/2^16 = 6%
• Can we assign multiple class C addresses?
• Lead to 16 entries for the same organization in the
forwarding table
• Solution: supernetting
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Supernetting
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Classless Interdomain Routing (CIDR)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
NAT (2)
• Key idea:
• Assign each organization with a single IP address.
• Within the organization, each host gets a unique IP
address from the private address space.
• Connect to Internet via a NAT router, which
translates the unique internal IP address to the
shared external IP address.
• Private address space:
• Class A: 10.0.0.0 ~ 10.255.255.255/8
• Class B: 172.16.0.0 ~ 172.31.255.255/12
• Class C: 192.168.0.0 ~ 192.168.255.255/16
• Anyone can use the private address space, but
address is not routable in the global Internet
NAT (3)
• Uses TCP/UDP port to tell connections apart
• Violates layering; very common in homes, etc.
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Review - 5
• Classful addressing was found not efficient or scalable
enough
• Subnetting: share a single class address among
multiple networks
• Supernetting: share multiple class addresses on a
single network
• Lead to CIDR (classless addressing) and longest prefix
match
• Widely used now
• NAT: assign one IP address for an organization
• another solution to IPv4 address exhaustion
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Internet Control Protocols
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
ARP (1)
• ARP: Address Resolution Protocol
• Operates at the link layer
• Based on broadcast: what is the MAC address
corresponding to the given IP address?
• Host with matching IP address replies
• Each host maintains a cache with IP to MAC translations
• Entries in cache times out periodically (15 min)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
ARP (2)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
DHCP
• DHCP: Dynamic Host Configuration Protocol
• Based on broadcast
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Review - 6
• Studied two useful protocols: ARP and DHCP
• ARP is needed for forwarding
• Performs IP to MAC address translation
• DHCP allows automatic assignment of IP address
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Summary
Three different kinds of addresses
• Host names (e.g., www.cnn.com)
• IP addresses (e.g., 64.236.16.20)
• MAC addresses (e.g., 00:15:C5:49:04:A9)
Protocols for translating between addresses
• Domain Name System (DNS)
• Dynamic Host Configuration Protocol (DHCP)
• Address Resolution Protocol (ARP)
Three Kinds of Identifiers
Host name (e.g., www.cnn.com)
• Mnemonic name appreciated by humans
• Provides little (if any) information about location
• Hierarchical, variable # of alpha-numeric characters
IP address (e.g., 64.236.16.20)
• Numerical address appreciated by routers
• Related to host’s current location in the topology
• Hierarchical name space of 32 bits
MAC address (e.g., 00:15:C5:49:04:A9)
• Numerical address appreciated within local area
network
• Unique, hard-coded in the adapter when it is built
• Flat name space of 48 bits
Names vs IP Address vs MAC Address
• Separating names (www.cnn.com) and IP address
(64.236.16.20)
• Names are easier for us to remember
• IP address can change underneath
• Name can map to multiple IP addresses
• Separating IP and MAC addresses
• Different LANs may have different addressing
schemes
• A host may move to a new location, so cannot simply
assign a static IP address
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Mapping Between Identifiers
Domain Name System (DNS)
• Given a host name, provide the IP address
• Given an IP address, provide the host name
Dynamic Host Configuration Protocol (DHCP)
• Given a MAC address, assign a unique IP address
• To automate the boot-strapping process
Address Resolution Protocol (ARP)
• Given an IP address, provide the MAC address
• To enable communication within the Local Area
Network