0% found this document useful (0 votes)
33 views82 pages

Mod 3 Net F24

Uploaded by

woshijuruo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views82 pages

Mod 3 Net F24

Uploaded by

woshijuruo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

04834480

Computer Networks (Honor Track)

Module 3
Internetworking and Internet

Chenren Xu(许辰人)
Fall 2024

 Includes material from lectures by David Wetherall (UW) and Jim Kurose (UMASS);
Jointly prepared with Yunzhe Ni and Naiqian Zheng 1
Network Layer Overview
Mobile network
• Starting the Network Layer! National or global ISP
- Builds on the link layer. Routers send packets
over multiple networks application

• Why do we need a network layer, or


transport
network
link
physical

what’s the shortcomings of switches? network


link
physical
network
link
physical

- Don’t scale to large networks


network
▪ Blow up of routing table, broadcast link
physical
network
link
physical network
- Don’t work across more than one link layer link
physical
Datacenter
network
technology, aka heterogeneous networks
application
▪ Hosts on Ethernet + LTE + 802.11 … transport
network
Enterprise link
- Don’t give much traffic control network
physical

▪ Want to plan routes / bandwidth

2
Outline
• Network Layer: Concepts and Algorithms
- Network service models
▪ Datagrams (packets), virtual circuits
- Routing
• An IP-flavored Network Layer Implementation
- Implementing Network-layer functionality
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

3
Network Service
• What is the major functionality of Network Layer?
- Interconnect networks (probably with different link layer technology)
▪ Enables hosts to send packets to other hosts in different networks
- Provide services to Transport Layer
• Network service models
- Divided by kind of service: - Divided by quality of service:
▪ Datagrams: connectionless service
➢ Like postal letters
➢ (This one is IP)
▪ Virtual circuits: connection-oriented service
➢ Like a telephone call

4
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
▪ Routers explained, Routing in datagram networks/virtual circuits
▪ Algorithm: Distance Vector routing, Shortest path routing, Flooding, Link-state routing
▪ Inter-domain routing, BGP

• An IP-flavored Network Layer Implementation


- Implementing Network-layer functionality
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

5
Routers
• Router workflow: Store-and-forward packet switching
- Routers receive a complete packet, storing it temporarily if necessary before forwarding it onwards

Routing, management
control plane (software)
Routing
operates in millisecond
processor
time frame

Forwarding data plane


(hardware) operates in
nanosecond
High-speed timeframe
switching
fabric

Router input ports Router output ports

6
Routers: Input Port Functions

Link Lookup,
layer forwarding
Line switch
termination protocol fabric
(receive)
Queueing

Physical Layer:
bit-level reception
• Using header field values, lookup output port using forwarding table
Link Layer:
in input port memory (“match plus action”)
e.g., Ethernet
• Goal: complete input port processing at ‘line speed’
• Input port queuing: if datagrams arrive faster than forwarding rate
into switch fabric

7
Routers: Input Port Functions

Link Lookup,
layer forwarding
Line switch
termination protocol fabric
(receive)
Queueing

Physical Layer:
bit-level reception
• Using header field values, lookup output port using forwarding table
Link Layer:
in input port memory (“match plus action”)
e.g., Ethernet
• IP-specific (explained later):
- Destination-based forwarding: forward based only on destination IP
address (traditional)
- Generalized forwarding: forward based on any set of header field values

8
Routers: Switching Fabrics
• Transfer packet from input link to appropriate output link
- Switching rate (R): rate at which packets can be transfer from inputs to outputs
▪ Often measured as multiple of input/output line rate
- N inputs: switching rate N times line rate desirable

• Three major types of switching fabrics:

Memory Bus Interconnection


Network
Faster, More Expensive

9
Routers: Input Port Queuing
• Switch fabric slower than input ports combined: Queueing may occur at input
queues
- Queueing delay and loss due to input buffer overflow!
• Head-of-the-Line (HOL) blocking: Queued datagram at front of queue prevents
others in queue from moving forward

Switch
fabric Switch
fabric

Output port contention: Only one red One packet time later: Green
datagram can be transferred. Lower red packet experiences HOL blocking
packet is blocked
10
Routers: Output Port & Queuing

Datagram
Switch Link
buffer
layer Line
fabric
protocol termination R
(rate: NR)
Queueing (send)

• Buffering required when datagrams arrive from fabric faster than


link transmission rate.
- Drop policy: which datagrams to drop if no free buffers?
• Scheduling discipline chooses among queued datagrams for
transmission
- Prioritized = Better performance + less dropped packets

11
Routing in Datagram Model
• Packets contain a destination
address; each router uses it to
forward each packet, possibly
on different paths

• Each router has a forwarding


table keyed by address
- Gives next hop for each
destination address; may change

12
Routing in Virtual Circuit Model
• Three phases:
- Connection establishment, setup circuit
▪ Path is chosen, store circuit info. in routers
- Data transfer, circuit is used
▪ Packets are forwarded along the path
- Connection teardown, circuit is deleted
▪ Circuit information is removed from routers

• Packets contain a short circuit ID


unique for a link; Each router has a
forwarding table keyed by circuit
- Gives output line and next label to place
on packet

13
Datagrams vs Virtual Circuits
• Complementary strengths
Issue Datagrams Virtual Circuits
Setup phase Not needed Required
Router state Per destination Per connection
Packet carries full Packet carries short
Addresses
address label
Routing Per packet Per circuit
Failures Easier to mask Difficult to mask
Quality of
Difficult to add Easier to add
service

14
MPLS (Multi-Protocol Label Switching)
• A virtual-circuit like technology widely used by ISPs
- ISP sets up circuits inside their backbone ahead of time
- ISP adds MPLS label to IP packet at ingress, undoes at egress

15
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
▪ Routers explained, Routing in datagram networks/virtual circuits
▪ Algorithm: Distance Vector routing, Shortest path routing, Flooding, Link-state routing
▪ Inter-domain routing, BGP

• An IP-flavored Network Layer Implementation


- Implementing Network-layer functionality
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

16
Routing Protocols
• Routing protocol goal: determine “good” Mobile network

National or global ISP


paths (equivalently, routes), from sending
hosts to receiving host, through network of application
transport

routers network
link
physical
- Path: Sequence of routers packets traverse from network
link
network
link
physical physical
given initial source host to final destination host
network
- “Good”: Least “cost”, “fastest”, “least congested” link
physical
network
link
physical network
link
physical
Datacenter
network
- Routing: A “top-10” networking challenge!
application
transport
network
Enterprise link
physical
network

17
Routing Algorithm Classification

Global: All routers have


complete topology, link cost info
• “Link state” algorithms
How fast
Dynamic: Routes change
do routes Static: Routes change more quickly
change? slowly over time • Periodic updates or in
response to link cost
changes
Decentralized: Iterative process of computation,
exchange of info with neighbors
• Routers initially only know link costs to attached
neighbors
• “Distance vector” algorithms
Global or decentralized information?
18
Distance Vector Routing
• Simple, early routing approach
- Used in ARPANET, and RIP
• One of two main approaches to routing
- Distributed version of Bellman-Ford
- Works, but very slow convergence after some failures
• Link-state algorithms are now typically used in practice
- More involved, better behavior

19
Distance Vector Routing
• Setting: each node computes its forwarding table in a distributed setting:
1. Nodes know only the cost to their neighbors; not the topology
2. Nodes can talk only to their neighbors using messages
3. All nodes run the same algorithm concurrently
4. Nodes and links may fail, messages may be lost

• Algorithm (Bellman-Ford): each node maintains a vector of distances (and next


hops) to all destinations
1. Initialize vector with 0 (zero) cost to self, ∞ (infinity) to other destinations
2. Periodically send vector to neighbors
3. Update vector for each destination by selecting the shortest distance heard, after adding cost of
neighbor link
▪ Use the best neighbor for forwarding
20
Distance Vector Routing Explained
• Consider a simple network. Each node runs on its own
- E.g., node A can only talk to nodes B and D
• First exchange, A hears from B, D and finds 1-hop routes
- A always learns min(B+3, D+7)

• First exchange for all nodes to find best 1-hop routes


- E.g., B learns min(A+3, C+6, D+3)
• Second exchange for all nodes to find best 2-hop routes
• Third exchange for all nodes to find best 3-hop routes
•…

21
Distance Vector Routing: Dynamics
• Adding routes
- News travels one hop per exchange
• Removing routes
- When a node fails, no more exchanges, other
nodes forget
• Link route changes
- Just like adding routes

22
Distance Vector Routing: Problem
• Partitions (unreachable nodes in divided
network) are a problem
- “Count to infinity” scenario
• Good news travels quickly, bad news slowly
Desired convergence
(inferred)
• Various heuristics to address X
- e.g., “Split horizon, poison reverse” (Don’t send
route back to where you learned it from.)
• But none are very effective
- Link state now favored in practice
- Except when very resource-limited
“Count to infinity” scenario

23
RIP (Routing Information Protocol)
• DV protocol with hop count as metric
- Infinity is 16 hops; limits network size
- Includes split horizon, poison reverse
• Routers send vectors every 30 seconds
- Runs on top of UDP
- Time-out in 180 secs to detect failures
• RIPv1 specified in RFC1058 (1988)

24
Flooding Details
• Remember message (to stop flood) using source and sequence number
- So next message (with higher sequence number) will go through
• To make flooding reliable, use ARQ
- So receiver acknowledges, and sender resends if needed

25
Dijkstra’s Link-State Routing: Shortest Path Routing
• Centralized: network topology, link costs known to all nodes F
- Assumes a centralized information broadcaster to exist 4 2
E
3
- All nodes have same info G 10
3 2
• Computes least cost paths from one node (“source”) to all 4
1 D
A 4 B
2 2
other nodes H
3 C
- Dijkstra’s Shortest path algorithm F
- Gives forwarding table for that node 4 2
E
3
• Iterative: after k iterations, know least cost path to k G
3
10
2
4 D
1
destinations A 4 B
2 2
H
3 C

26
Flooding: Decentralized Broadcast
• Rule used at each node:
- Sends an incoming message on to all other neighbors
- Remember the message so that it is only flood once
• Inefficient because one node may receive multiple copies of message
E and B send F gets another
F F gets 2 F to each other F
copies copy
E E E
G G G
D D D
A B A B A B
H H H
C C
C
• Remember message (to stop flood) using source and sequence number
- So next message (with higher sequence number) will go through
• To make flooding reliable, use ARQ
- So receiver acknowledges, and sender resends if needed
27
Link-State Routing
• One of two approaches to routing
- Trades more computation than distance vector for better dynamics
• Widely used in practice
- Used in Internet/ARPANET from 1979
- Modern networks use OSPF and IS-IS
• Setting: Nodes compute their forwarding table in the same distributed setting as
for distance vector
1. Nodes know only the cost to their neighbors; not the topology
2. Nodes can talk only to their neighbors using messages
3. All nodes run the same algorithm concurrently
4. Nodes/links may fail, messages may be lost

28
Link-State Algorithm
Node E’s LSP flooded
• Proceeds in two phases: to A, B, C, D, and F F
4 2
1. Topology Dissemination: nodes flood topology in the 3
E
Seq. # G 10
form of link state packets A 10 3 2
4
▪ Each node floods link state packet (LSP) that describes B 4 1 D
C 1 A 4 B
their portion of the topology and learns full topology D 2 2 2
F 2 H
3 C
E’s Forwarding Table
Source Tree for E (from Dijkstra) To Next
2. Route Computation: Each node computes its own A C
F
forwarding table 4 2 B C
E C C
▪ By running Dijkstra (or equivalent) G 3
10
3 2 D D
➢ Some replicated computation, but finds required routes E --
4 D
1
directly 4 F F
A B
2 2 G F
➢ Compile forwarding table from sink/source tree
H H C
3 C

29
Handling Changes
• On change, flood updated LSPs, and re-compute routes
- E.g., nodes adjacent to failed link or node initiate
F
• Link failure Failure! 4 2
- Both nodes notice, send updated LSPs 3 E
B’s LSP GXXXX 10
- Link is removed from topology Seq. #
3 2
4
• Node failure A
C
4
2
1 D
A 4 B
- All neighbors notice a link has failed E 4 2 2
F 3 H
- Failed node can’t update its own LSP ∞
F’s LSP 3
G C
Seq. #
- But it is OK: all links to node removed
B 3
• Addition of a link or node E
G
2

- Add LSP of new node to topology
- Old LSPs are updated with new link
- Additions are the easy case …
30
Link-State Complications
• Things that can go wrong:
- Seq. number reaches max, or is corrupted
- Node crashes and loses seq. number
- Network partitions then heals
• Strategy:
- Include age on LSPs and forget old information that is not refreshed
• Much of the complexity is due to handling corner cases (as usual!)

31
IS-IS and OSPF Protocols
• Widely used in large enterprise and ISP networks
- IS-IS = Intermediate System to Intermediate System
- OSPF = Open Shortest Path First
• Link-state protocol with many added features
- E.g., “Areas” for scalability

32
DV/LS Comparison

Goal Distance Vector Link-State


Correctness Distributed Bellman-Ford Replicated Dijkstra
Efficient paths Approx. with shortest paths Approx. with shortest paths
Fair paths Approx. with shortest paths Approx. with shortest paths
Fast convergence Slow – many exchanges Fast – flood and compute
Scalability Excellent – storage/compute Moderate – storage/compute

33
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
▪ Routers explained, Routing in datagram networks/virtual circuits
▪ Algorithm: Distance Vector routing, Shortest path routing, Flooding, Link-state routing
▪ Inter-domain routing, BGP

• An IP-flavored Network Layer Implementation


- Implementing Network-layer functionality
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

34
Hierarchical Routing
• Introduce a larger routing unit
- Routing packets to a region instead of a single host
▪ e.g., ISP network

• Route first to the region, then to the IP prefix within the region
- Hide details within a region from outside of the region
▪ e.g., Datagram network in region A, virtual circuit in region B
- Better scalability
- Letting different parties choose their routes to suit their own needs
• Outside a region, nodes have one route to all hosts within the region
- This gives savings in table size, messages and computation
• However, each node may have a different route to an outside region
- Routing decisions are still made by individual nodes; there is no single decision made by a region

35
Effects of Independent Parties
ISP A
• Each ISP selects routes to suit its own interests A1
ISP B
B1
- E.g., shortest path in ISP
• What path will be chosen for A2 → B1 and B1 → A2?
- What is the best path? A2
B2

• Selected paths are longer than overall shortest path ISP A


A1
ISP B
B1
- And symmetric too!
• This is a consequence of independent goals and
A2
decisions, not hierarchy B2

36
Routing Policies
• Capture the goals of different parties – could be anything
- E.g., Internet2 only carries non-commercial traffic ISP
Rest of
• Common policies: Customer 1
Internet
- ISPs give transit service to customers Non-
customer
• Customer gets transit service from ISP Customer 2

- ISP accepts traffic for customer from the rest of Internet


ISP A ISP B
- ISP sends traffic from customer to the rest of Internet
- Customer pays ISP for the privilege Customer A1 Customer B1

- ISPs give peer service to each other


• Both ISPs (in example) get peer service from each other Customer A2 Customer B2

- Each ISP accepts traffic from the other ISP only for their customers
- ISPs do not carry traffic to the rest of the Internet for each other
- ISPs don’t pay each other
37
BGP (Border Gateway Protocol)
• BGP: The de facto inter-domain routing protocol
- Path vector, a kind of distance vector
• Allows subnet to advertise its existence, and the destinations it can reach, to rest
of Internet: “I am here, here is who I can reach, and how”

• BGP provides each AS (Anonymous System) a means to:


- eBGP: Obtain AS reachability information from neighboring ASes
- iBGP: Propagate reachability information to all AS-internal routers.
- Determine “good” routes to other networks based on reachability information and policy
- AS: set of hosts here

38
eBGP, iBGP connections

2b

2a ∂
2c
1b 3b
2d
1a 1c ∂
3a 3c
AS 2
1d 3d

AS 1 eBGP connectivity AS 3
Logical iBGP connectivity

1c Gateway routers run both eBGP and iBGP protocols

39
BGP Example
• AS2 buys transit service from AS1 and peer service from AS3
• Customer (other side of transit): AS2 says [A, (AS2)] to AS1
• Transit: AS1 says [B, (AS1, AS3)], [C, (AS1, AS4)] to AS2
• Peer: AS2 says [A, (AS2)] to AS3, AS3 says [B, (AS3)] to AS2
• AS2 hears one route to C, and two routes to B (chooses AS3!)

40
BGP Thoughts
• Much more beyond basics to explore!
• Policy is a substantial factor
- Can we even be independent decisions will be sensible overall?
• Other important factors:
- Convergence effects
- How well it scales
- Integration with routing within ISPs
- And more …

41
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
• An IP-flavored Network Layer Implementation
- Implementing Network-layer functionality
▪ Datagram format, IP Address, Prefixes and Forwarding (Longest Matching Prefix)
▪ Fragmentation and MTU discovery
▪ Errors: ICMP (and traceroute!)
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

42
Networks May Still Differ!
• Basically, in a lot of ways: • Internetworking: connecting the whole world
- Service model (datagrams, VCs) - Pioneered by Cerf and Kahn, the “fathers of the
- Addressing (what kind) Internet”
- QoS (priorities, no priorities) ▪ In 1974, later led to TCP/IP

- Packet sizes - Tackled the problems of interconnecting networks


▪ Instead of mandating a single network technology
- Security (whether encrypted)
• Connecting Datagram and VC networks Vint Cerf Bob Kahn
- An example to show that it’s not so easy
▪ Need to map destination address to a VC and vice-
versa
▪ A bit of a “road bump”, e.g., might have to set up a VC

© 2009 IEEE © 2009 IEEE

43
The IP (Internet Protocol) hourglass

HTTP SMTP RTP


DASH …
Internet’s “thin waist”: QUIC
Many protocols in
• One network layer TCP UDP
physical, link,
protocol: IP transport, and
IP
• Must be implemented application layers
Ethernet PPP
by every (billions) of WiFi Bluetooth …
Internet-connected Copper Radio Fiber
devices

44
IPv4 Datagram Format

32 bits
IP protocol version number Total datagram
Ver Head. Type of Length length (bytes)
Header length(bytes) len service
Fragment Fragmentation/
“Type” of service: 16-bit identifier Flgs
offset Reassembly
▪ diffserv (0:5) Upper
Time to Header
▪ ECN (6:7) live layer checksum Header checksum
TTL: Remaining max hops Source IP address 32-bit source IP address
(decremented at each router)
Maximum length: 64K bytes
Destination IP address 32-bit destination IP address
Upper layer protocol (e.g., TCP or UDP) Typically: 1500 bytes or less

Overhead Options (if any) e.g., timestamp, record route


taken
▪ 20 bytes of TCP
Payload data
▪ 20 bytes of IP
(variable length,
▪ = 40 bytes + app layer
typically a TCP
overhead for TCP+IP
or UDP segment)

45
IP Addresses
8 bits 8 bits 8 bits 8 bits
• IPv4 uses 32-bit addresses
00010010000111110000000000000001
- Later we’ll see IPv6, which uses 128-bit addresses
18.31.0.1
• Written in “dotted quad” notation 000100100001111100000000xxxxxxxx
- Four 8-bit numbers separated by dots 18.31.0.0/24
• IP Prefixes – Modern
- Addresses are allocated in blocks called prefixes
▪ Addresses in an L-bit prefix have the same top L bits
▪ There are 232-L addresses aligned on 232-L boundary
- More specific prefix
- Written in “IP address/length” notation ▪ Longer prefix, smaller number of IP addresses
▪ Address is lowest address in the prefix, length is - Less specific prefix
prefix bits ▪ Shorter prefix, larger number of IP addresses
▪ E.g., 128.13.0.0/16 is 128.13.0.0 to 128.13.255.255
▪ So a /24 (“slash 24”) is 256 addresses, and a /32 is
one address 46
Public/Private IP Addresses
• Public IP addresses, e.g., 18.31.0.1
- Valid destination on the global Internet
- Must be allocated to you before use
- Mostly exhausted … time for IPv6
• Private IP addresses
- Can be used freely within private networks (home, small company)
- 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
- Need public IP address(es) and NAT to connect to global Internet
• Allocating public IP addresses
- Follows a hierarchical process
▪ IANA delegates to regional bodies (RIRs)
▪ RIRs delegate to companies in their region
▪ Companies assign to their customers/computers (later, DHCP)
47
Forwarding in IP
• Node uses a table that lists the next hop for Prefix Next Hop
192.24.0.0/19 D
prefixes
192.24.12.0/22 B
• Longest Matching Prefix
A D
- Prefixes in the table might overlap!
▪ Combines hierarchy with flexibility B C
- Longest matching prefix forwarding rule: 192.24.63.255 More
specific
▪ For each packet, find the longest prefix that contains the 192.24.6.0 → D /18
D
destination address, i.e., the most specific entry 192.24.16.32 → B
192.24.15.255
▪ Forward the packet to the next hop router for that prefix 192.24.54.0 → D /22
B
- Flexibility 192.24.12.0
▪ Can provide default behavior, with less specifics
➢ To send traffic going outside an organization to a border router D
▪ Can provide special case behavior, with more specifics 192.24.0.0 IP address
➢ For performance, economics, security, …
48
Other Aspects of Forwarding
• It’s not all about addresses …
- Decrement TTL value
▪ Protects against loops
- Checks header checksum
▪ To add reliability
- Fragment large packets
▪ Split to fit it on next link
- Send congestion signals
▪ Warns hosts of congestion
- Generates error messages Payload (e.g., TCP segment)

▪ To help mange network


- Handle various option

49
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
• An IP-flavored Network Layer Implementation
- Implementing Network-layer functionality
▪ Datagram format, IP Address, Prefixes and Forwarding (Longest Matching Prefix)
▪ Fragmentation and MTU discovery
▪ Errors: ICMP (and traceroute!)
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

50
Supporting Different Packet Sizes
• Different networks have different maximum packet sizes!
- Need to split up packets, or discover the largest size to use
• Problem
- Different networks have different maximum packet sizes Take that It’s too big!
▪ Or MTU (Maximum Transmission Unit)
Big packet
▪ E.g., Ethernet 1.5 KB, WiFi 2.3 KB
- Prefer large packets for efficiency
▪ But what size is too large?
▪ Difficult because node does not know complete network path
• Solutions
- Fragmentation - Discovery
▪ Split up large packets in the network if they ▪ Find the largest packet that fits on the network
are too big to send path and use it
▪ Classic method, dated ▪ IP uses today instead of fragmentation

51
IPv4 Fragmentation
• Routers fragment packets, to be reassembled by receiving host
• Header fields used to handle packet size differences
- Identification (for aggregation), Fragment offset, MF (more fragments)/DF (don’t fragment) bits
• Procedure:
- Routers split a packet that is too large:
▪ Typically break into large pieces; Copy IP header to pieces; Adjust length on pieces; Set offset to indicate
position; Set MF (More Fragments) on all pieces except last
- Receiving hosts reassembles the pieces:
▪ Identification field links pieces together, MF tells receiver when it has all pieces

Fragment! Reassemble!

Fits on first link


52
Path MTU Discovery
• Discover the MTU that will fit (The method in use today!)
- So we can avoid fragmentation
• Host tests path with large packet
- Routers provide feedback if too large; they tell host what size would have fit
• Path MTU depends on the path and so can change over time
- Search is ongoing
• Implemented with ICMP
- Set DF (Don’t Fragment) bit in IP header to get feedback messages

Test #1
Test #2 Test #3

MTU=1400 MTU=1200 bytes MTU=900

Try 1200 Try 900

53
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
• An IP-flavored Network Layer Implementation
- Implementing Network-layer functionality
▪ Datagram format, IP Address, Prefixes and Forwarding (Longest Matching Prefix)
▪ Fragmentation and MTU discovery
▪ Errors: ICMP (and traceroute!)
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

54
Internet Control Message Protocol (ICMP)
• Used by hosts and routers to communicate
Type Code description
network-level information 0 0 echo reply (ping)
- Error reporting: unreachable host, network, port, protocol 3 0 dest. network unreachable
3 1 dest host unreachable
- Echo request/reply (used by ping) 3 2 dest protocol unreachable
• Network-layer “above” IP: 3
3
3
6
dest port unreachable
dest network unknown
- ICMP messages carried in IP datagrams 3 7 dest host unknown
4 0 source quench (congestion
Src = router, Dst = A Type = X, Src = A, Dst = B
control - not used)
Protocol = 1 Code = Y XXXXXXXXXXX 8 0 echo request (ping)
9 0 route advertisement
10 0 router discovery
IP header ICMP header ICMP data
11 0 TTL expired
12 0 bad IP header
• ICMP message: type, code plus first 8 bytes of
IP datagram causing error
55
Traceroute
• IP header contains TTL (Time to live) field
- Decremented every router hop, with ICMP error if it hits zero
- Protects against forwarding loops
• Traceroute repurposes TTL and ICMP functionality
- Sends probe packets increasing TTL starting from 1
- ICMP errors identify routers on the path

Local ... Remote


Host Host
1 hop
2 hops
3 hops N-1 hops
N hops

56
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
• An IP-flavored Network Layer Implementation
- Implementing Network-layer functionality
- Co-operating with Link layer
▪ DHCP, ARP
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

57
IP Address Allocation Issue
• Problem 1:
- A node wakes up for the first time … Hey, where am I?

- What is its IP address? What’s the IP address of its router? Etc.

• Problem 2:
- A host determined to send/forward a packet to A.B.C.D…
My IP is 2.3.4.1
- Who has A.B.C.D? How to send packet to it via Link Layer?

Wait. Who has 1.2.3.4?

My IP is 1.2.3.4

58
Getting IP Addresses
• Manual configuration (old days)
- Can’t be factory set, depends on use
▪ Remember that routing in IP is based on prefixes!
▪ What will happen if a host “carries” an IP to other place?
- Collisions!

• Or, a protocol for automatically configuring addresses (DHCP)


- Goal: Host dynamically obtains IP address from network server when it “joins” network
▪ Can renew its lease on address in use
▪ Allows reuse of addresses (only hold address while connected/on)
▪ Support for mobile users who join/leave network
- Binds IP to maintainer of IP prefix instead of hardware (the Link Layer approach)

59
DHCP (Dynamic Host Configuration Protocol)
• From 1993, widely used • DHCP overview:
• It leases IP address to nodes - Host broadcasts DHCP Discover message [optional]
▪ Broadcast messages are delivered to all nodes on the network
• Provides other parameters too
▪ Broadcast address is all 1s
- Network prefix
▪ IP (32 bit): 255.255.255.255; Ethernet (48 bit): ff:ff:ff:ff:ff:ff
- Address of local router
- DHCP server responds with DHCP Offer message [optional]
- DNS server, time server, etc.
- Host requests IP address: DHCP Request message
• Protocol Stack - DHCP server sends address: DHCP Ack message
- a client-server application
▪ Uses UDP ports 67, 68 Client Server
DISCOVER
Broadcast
DHCP OFFER

UDP REQUEST

IP ACK

Ethernet
60
Mapping IP Address To Link Address
• Problem:
- A node needs Link layer addresses to send a frame over the local link
- How does it get the destination link address from a destination IP address?

Uh oh … My IP is 1.2.3.4

61
ARP (Address Resolution Protocol)
• Node uses to map a local IP address Source Dest.
Ethernet Ethernet
Source
IP
Dest.
IP Payload …

to its Link layer addresses From From


NIC From ARP DHCP

• Protocol Stack: ARP sits right on top ARP


of link layer Ethernet
- No servers, just asks node with target IP
to identify itself Node Target
- Uses broadcast to reach all nodes
REQUEST Broadcast
Who has IP 1.2.3.4?

• Messages REPLY

I do at 1:2:3:4:5:6

62
Discovery Protocols
• Help nodes find each other
- There are more of them!
▪ E.g., zeroconf, Bonjour

• Often involve broadcast


- Since nodes aren’t introduced
- Very handy glue

63
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
• An IP-flavored Network Layer Implementation
- Implementing Network-layer functionality
- Co-operating with Link layer
- Middleboxes
▪ NAT
- Future: IPv6
- Generalized Forwarding, SDN

64
Middleboxes
• RFC 3234: “Any intermediary box performing functions apart from
normal, standard functions of an IP router on the data path between Firewalls, IDS: Corporate,
a source host and destination host”
institutional, service providers,
National or global ISP
ISPs
NAT: Home,
cellular, institutional
Load balancers:
Corporate, service
provider, data center,
mobile nets
Application-specific:
Datacenter
Service providers, network

institutional, CDN
Caches: Service
Enterprise
provider, mobile, CDNs
network
65
NAT (Network Address Translation) Box
• NAT box connects an internal network to an external network
- Many internal hosts are connected using few external addresses
- Middlebox that “translates addresses” Unmodified computers at home Looks like one
• Motivated by IP address scarcity computer outside
- Controversial at first, now accepted
ISP
• Common scenario:
NAT box
- Home computers use “private” IP addresses
- NAT (in AP/firewall) connects home to ISP using a single external IP address

66
How NAT Works
• Keeps an internal/external table
- Typically uses IP address + TCP port
- This is address and port translation
• Need ports to make mapping 1-1 since there are fewer external IPs
• Internal → External What host thinks What ISP thinks
- Look up and rewrite Source IP/port to external one Internal IP: port External IP : port

• External → Internal 192.168.1.12 : 5523 44.25.80.3 : 1500


192.168.1.13 : 1234 44.25.80.3 : 1501
- Look up and rewrite Destination IP/port to internal one
192.168.2.20 : 1234 44.25.80.3 : 1502
• Need to enter translations in the table for it to work
- Create external name when host makes a TCP connection

67
Comments on NAT
• Downsides • Upsides
- Connectivity has been broken! - Relieves much IP address pressure
▪ Can only send incoming packets after an ▪ Many home hosts behind NATs
outgoing connection is set up - Easy to deploy
▪ Difficult to run servers or peer-to-peer apps ▪ Rapidly, and by you alone
(Skype) at home - Useful functionality
- Doesn’t work so well when there are no ▪ Firewall, helps with privacy
connections (UDP apps) - Kinks will get worked out eventually
- Breaks apps that unwisely expose their IP ▪ “NAT Traversal” for incoming traffic
addresses (FTP)

68
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
• An IP-flavored Network Layer Implementation
- Implementing Network-layer functionality
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN

69
Internet Growth
• At least a billion Internet hosts and growing
• And we’re using 32-bit addresses!
• IP Version 6 to the Rescue
- Effort started by the IETF in 1994
▪ Much larger addresses (128 bits)
▪ Many sundry improvements
- Became an IETF standard in 1998
Time for
▪ Nothing much happened for a decade Percentage of users accessing Google via IPv6
growth!
▪ Hampered by deployment issues, and a lack of
adoption incentives
▪ Big push ~2011 as exhaustion looms
- Deployment
Source: Google IPv6 Statistics, 30/1/13

70
IPv6
Flow label: Identify datagrams
32 bits in same "flow.” (concept of
Priority: Identify priority
Ver Pri Flow label “flow” not well defined).
among datagrams in flow
Payload len Next hdr Hop limit
Source address
128-bit (128 bits)
IPv6 addresses Destination address
(128 bits)

Payload (data)

What’s missing (compared with IPv4):


▪ No checksum (to speed processing at routers)
▪ No fragmentation/reassembly
▪ No options (available as upper-layer, next-header protocol at router)

71
Transition from IPv4 to IPv6
• Not all routers can be upgraded simultaneously
- No “flag days”
- How will network operate with mixed IPv4 and IPv6 routers?
• Tunneling: IPv6 datagram carried as payload in IPv4 datagram among IPv4
routers (“packet within a packet”)
- Tunneling used extensively in other contexts (4G/5G)
IPv4 header fields IPv6 header fields
IPv4 payload
IPv4 source, dest addr IPv6 source dest addr
UDP/TCP payload

IPv6 datagram
IPv4 datagram

72
Tunneling
• Native IPv6 islands connected via IPv4
- Tunnel carries IPv6 packets across IPv4 network
• Tunnel acts as a single link across IPv4 network
- Difficulty is to set up tunnel endpoints and routing

IPv4 tunnel
A B connecting IPv6 routers E F
IPv4 tunnel
connecting two IPv6 routers IPv6 IPv6/v4 IPv6/v4 IPv6

IPv6 datagram
IPv4 datagram Tunneling: IPv6 datagram as payload in a IPv4 datagram

73
Outline
• Network Layer: Concepts and Algorithms
- Network service models
- Routing
• An IP-flavored Network Layer Implementation
- Implementing Network-layer functionality
- Co-operating with Link layer
- Middleboxes
- Future: IPv6
- Generalized Forwarding, SDN
▪ OpenFlow

 Optional material 74
Generalized forwarding: match plus action
• Review: each router contains a forwarding table (aka Flow Table)
- “Match plus action” abstraction: match bits in arriving packet, take action
▪ Destination-based forwarding: forward based on dest. IP address
▪ Generalized forwarding:
➢ Many header fields can determine action
➢ Many action possible: Drop/Copy/Modify/Log packet

Values in arriving
packet header 0111 1
2
3

 Optional material 75
Flow table abstraction
• Flow: defined by header field values (in link-, network-, transport-layer fields)
• Generalized forwarding: simple packet-handling rules
- Match: pattern values in packet header fields
- Actions: for matched packet: drop, forward, modify, matched packet or send matched packet to
controller
- Priority: disambiguate overlapping patterns
- Counters: #bytes and #packets

Router’s flow table


src = *.*.*.*, dest=3.4.*.* Forward(2)
Flow table
define router’s Match Action src=1.2.*.*, dest=*.*.*.* Drop
match+action rules src=10.1.2.3, dest=*.*.*.* Send to controller
* : wildcard
1 4
3
2
 Optional material 76
OpenFlow: Flow table entries

Match Action Stats

Packet + byte counters

1. Forward packet to port(s)


2. Drop packet
3. Modify fields in header(s)
4. Encapsulate and forward to controller

Header fields to
match:
Ingress Src Dst Eth VLAN VLAN IP IP IP IP TCP/UDP TCP/UDP
Port MAC MAC Type ID Pri Src Dst Proto ToS Src Port Dst Port

Link layer Network layer Transport layer

 Optional material 77
OpenFlow: Examples
Destination-based forwarding:
Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP
Action
Port src dst type ID Pri Src Dst Prot ToS s-port d-port
* * * * * * * 51.6.0.8 * * * * port6
IP datagrams destined to IP address 51.6.0.8 should be forwarded to router output port 6

Firewall:
Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP
Action
Port src dst type ID Pri Src Dst Prot ToS s-port d-port
* * * * * * * * * * * 22 drop
Block (do not forward) all datagrams destined to TCP port 22 (ssh port #)

Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP


Action
Port src dst type ID Pri Src Dst Prot ToS s-port d-port
* * * * * * 128.119.1.1 * * * * * drop
Block (do not forward) all datagrams sent by host 128.119.1.1

 Optional material 78
OpenFlow: Examples
Layer 2 destination-based forwarding:

Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP


Action
Port src dst type ID Pri Src Dst Prot ToS s-port d-port

* * 22:A7:23: * * * * * * * * * port3
11:E1:02

Layer 2 frames with destination MAC address 22:A7:23:11:E1:02 should be forwarded to output
port 3

 Optional material 79
OpenFlow Abstraction
• Match+Action: Abstraction unifies different kinds of devices

Router Firewall
• Match: Longest destination IP prefix • Match: IP addresses and TCP/UDP
• Action: Forward out a link port numbers
• Action: Permit or deny

Switch NAT
• Match: Destination MAC address • Match: IP address and port
• Action: Forward or flood • Action: Rewrite address and port

Orchestrated tables can create network-wide behavior!

 Optional material 80
Path to Programmable Networking
• Hardware defined: Common switch (1993)
- Not configurable or manageable
• Configurable: Switch with management plane (1990s)
- Configurable entries in fixed tables
• Software defined: OpenFlow switch (2009)
- Customized tables, keys and actions can be selected from the given choices
• Programmable: Tofino, Trident 4 (2016)
- Customized tables, keys and actions
• Software: OVS (2009)
- Implemented by software, mostly based on X86 servers

 Optional material 81
Generalized forwarding: Summary
• “Match plus action” abstraction: Match bits in arriving packet header(s) in any
layers, take action
- Matching over many fields (link-, network-, transport-layer)
- Local actions: drop, forward, modify, or send matched packet to controller
- “Program” network-wide behaviors

• Simple form of “network programmability”


- Programmable, per-packet “processing”
- Historical roots: active networking
- Today: more generalized programming: P4 (see p4.org)

 Optional material 82

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy