1 Network Layer 4-1 Chapter 4 Network Layer A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights Reserved Computer Networking: A Top Down Approach 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007. Network Layer 4-2 Chapter 4: Network Layer Chapter goals: understand principles behind network layer services: datagram networks forwarding versus routing how a router works routing (path selection) dealing with scale IPv6 instantiation, implementation in the Internet
28
Embed
Chapter 4 Network Layer - The College of Engineering at ...cs5480/notes/chapter4-2007-Part1.pdf · If you post any slides in substantially unaltered form on a ... Network Layer 4-3
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
Network Layer 4-1
Chapter 4Network Layer
A note on the use of these ppt slides:We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following:
If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!)
If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material.
Thanks and enjoy! JFK/KWR
All material copyright 1996-2007J.F Kurose and K.W. Ross, All Rights Reserved
Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith RossAddison-Wesley, July 2007.
4.6 Broadcast and multicast routing4.7 What’s inside a router?
Network Layer 4-4
Network layertransport segment from sending to receiving host on sending side encapsulates segments into datagramson rcving side, delivers segments to transport layernetwork layer protocols in every host, routerrouter examines header fields in all IP datagrams passing through it
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
networkdata linkphysical network
data linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysicalnetwork
data linkphysical
3
Network Layer 4-5
Two Key Network-Layer Functions
forwarding: move packets from router’s input to appropriate router output
routing: determine route taken by packets from source to dest.
routing algorithms
analogy:
routing: process of planning trip from source to dest
forwarding: process of getting through single interchange
Network Layer 4-6
1
23
0111
value in arrivingpacket’s header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
4
Network Layer 4-7
Datagram networksno call setup at network layerrouters: no state about end-to-end connections
no network-level concept of “connection”packets forwarded using destination host address
packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1. Send data 2. Receive data
Network Layer 4-8
Forwarding table
Destination Address Range Link Interface
11001000 00010111 00010000 00000000through 0
11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through 1
11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through 2
11001000 00010111 00011111 11111111
otherwise 3
4 billion possible entries
5
Network Layer 4-9
Longest prefix matching
Prefix Match Link Interface11001000 00010111 00010 0 11001000 00010111 00011000 111001000 00010111 00011 2
otherwise 3
DA: 11001000 00010111 00011000 10101010
Examples
DA: 11001000 00010111 00010110 10100001 Which interface?
IP Addressing: introductionIP address: 32-bit identifier for host, router interfaceinterface: connection between host/router and physical link
router’s typically have multiple interfaceshost typically has one interfaceIP addresses associated with each interface
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 11
Network Layer 4-16
SubnetsIP address:
subnet part (high order bits)host part (low order bits)
What’s a subnet ?device interfaces with same subnet part of IP addresscan physically reach each other without intervening router
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
network consisting of 3 subnets
subnet
9
Network Layer 4-17
Subnets 223.1.1.0/24 223.1.2.0/24
223.1.3.0/24
RecipeTo determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.
given notion of “network”, let’s re-examine IP addresses:
“class-full” addressing:
Network Layer 4-20
IP addressing: CIDRCIDR: Classless InterDomain Routing
subnet portion of address of arbitrary lengthaddress format: a.b.c.d/x, where x is # bits in subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
200.23.16.0/23
11
Network Layer 4-21
IP addresses: how to get one?
Q: How does host get IP address?
hard-coded by system admin in a fileWintel: control-panel->network->configuration->tcp/ip->propertiesUNIX: /etc/rc.config
DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server
“plug-and-play”
Network Layer 4-22
DHCP: Dynamic Host Configuration Protocol
Goal: allow host to dynamically obtain its IP address from network server when it joins networkCan renew its lease on address in useAllows reuse of addresses (only hold address while connected
an “on”Support for mobile users who want to join network (more
shortly)DHCP overview:
host broadcasts “DHCP discover” msgDHCP server responds with “DHCP offer” msghost requests IP address: “DHCP request” msgDHCP server sends address: “DHCP ack” msg
“Send me anythingwith addresses beginning 200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us “Send me anythingwith addresses beginning 199.31.0.0/16”
200.23.20.0/23Organization 2
...
...
Hierarchical addressing allows efficient advertisement of routing information:
14
Network Layer 4-27
Hierarchical addressing: more specific routes
ISPs-R-Us has a more specific route to Organization 1
“Send me anythingwith addresses beginning 200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us “Send me anythingwith addresses beginning 199.31.0.0/16or 200.23.18.0/23”
200.23.20.0/23Organization 2
...
...
Network Layer 4-28
IP addressing: the last word...
Q: How does an ISP get block of addresses?A: ICANN: Internet Corporation for Assigned
Names and Numbersallocates addressesmanages DNSassigns domain names, resolves disputes
15
Network Layer 4-29
NAT: Network Address Translation
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
138.76.29.7
local network(e.g., home network)
10.0.0/24
rest ofInternet
Datagrams with source or destination in this networkhave 10.0.0/24 address for source, destination (as usual)
All datagrams leaving localnetwork have same single source
NAT IP address: 138.76.29.7,different source port numbers
Network Layer 4-30
NAT: Network Address Translation
Motivation: local network uses just one IP address as far as outside world is concerned:
range of addresses not needed from ISP: just one IP address for all devicescan change addresses of devices in local network without notifying outside worldcan change ISP without changing addresses of devices in local networkdevices inside local net not explicitly addressable, visible by outside world (a security plus).
outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #). . . remote clients/servers will respond using (NAT
IP address, new port #) as destination addr.
remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair
incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table
Network Layer 4-32
NAT: Network Address Translation
10.0.0.1
10.0.0.2
10.0.0.3
S: 10.0.0.1, 3345D: 128.119.40.186, 80
110.0.0.4
138.76.29.7
1: host 10.0.0.1 sends datagram to 128.119.40.186, 80
NAT translation tableWAN side addr LAN side addr138.76.29.7, 5001 10.0.0.1, 3345…… ……
network-layer “above” IP:ICMP msgs carried in IP datagrams
ICMP message: type, code plus first 8 bytes of IP datagram causing error
Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion
control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header
20
Network Layer 4-39
Traceroute and ICMP
Source sends series of UDP segments to dest
First has TTL =1Second has TTL=2, etc.Unlikely port number
When nth datagram arrives to nth router:
Router discards datagramAnd sends to source an ICMP message (type 11, code 0)Message includes name of router& IP address
When ICMP message arrives, source calculates RTTTraceroute does this 3 times
Stopping criterionUDP segment eventually arrives at destination hostDestination returns ICMP “port unreachable” packet (type 3, code 3)When source gets this ICMP, stops.
Network Layer 4-40
Chapter 4: Network Layer
4. 1 Introduction4.2 Virtual circuit and datagram networks4.3 What’s inside a router4.4 IP: Internet Protocol
IPv6 Header (Cont)Priority: identify priority among datagrams in flowFlow Label: identify datagrams in same “flow.”
(concept of“flow” not well defined).Next header: identify upper layer protocol for data
22
Network Layer 4-43
Other Changes from IPv4
Checksum: removed entirely to reduce processing time at each hopOptions: allowed, but outside of header, indicated by “Next Header” fieldICMPv6: new version of ICMP
additional message types, e.g. “Packet Too Big”multicast group management functions
Network Layer 4-44
Transition From IPv4 To IPv6
Not all routers can be upgraded simultaneousno “flag days”How will the network operate with mixed IPv4 and IPv6 routers?
Tunneling: IPv6 carried as payload in IPv4 datagram among IPv4 routers
23
Network Layer 4-45
TunnelingA B E F
IPv6 IPv6 IPv6 IPv6
tunnelLogical view:
Physical view:A B E F
IPv6 IPv6 IPv6 IPv6IPv4 IPv4
Network Layer 4-46
TunnelingA B E F
IPv6 IPv6 IPv6 IPv6
tunnelLogical view:
Physical view:A B E F
IPv6 IPv6 IPv6 IPv6
C D
IPv4 IPv4
Flow: XSrc: ADest: F
data
Flow: XSrc: ADest: F
data
Flow: XSrc: ADest: F
data
Src:BDest: E
Flow: XSrc: ADest: F
data
Src:BDest: E
A-to-B:IPv6
E-to-F:IPv6B-to-C:
IPv6 insideIPv4
B-to-C:IPv6 inside
IPv4
24
Network Layer 4-47
1
23
0111
value in arrivingpacket’s header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing, forwarding
Network Layer 4-48
u
yx
wv
z2
21
3
1
1
2
53
5
Graph: G = (N,E)
N = set of routers = { u, v, w, x, y, z }
E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
Graph abstraction
Remark: Graph abstraction is useful in other network contexts
Example: P2P, where N is set of peers and E is set of TCP connections
25
Network Layer 4-49
Graph abstraction: costs
u
yx
wv
z2
21
3
1
1
2
53
5 • c(x,x’) = cost of link (x,x’)
- e.g., c(w,z) = 5
• cost could always be 1, or inversely related to bandwidth,or inversely related to congestion
Question: What’s the least-cost path between u and z ?
Routing algorithm: algorithm that finds least-cost path
Network Layer 4-50
Routing Algorithm classificationGlobal or decentralized
information?Global:
all routers have complete topology, link cost info“link state” algorithms
Decentralized:router knows physically-connected neighbors, link costs to neighborsiterative process of computation, exchange of info with neighbors“distance vector” algorithms
Static or dynamic?Static:
routes change slowly over time
Dynamic:routes change more quickly
periodic updatein response to link cost changes
26
Network Layer 4-51
A Link-State Routing Algorithm
Dijkstra’s algorithmnet topology, link costs known to all nodes
accomplished via “link state broadcast” all nodes have same info
computes least cost paths from one node (‘source”) to all other nodes
gives forwarding tablefor that node
iterative: after k iterations, know least cost path to k dest.’s
Notation:c(x,y): link cost from node x to y; = ∞ if not direct neighborsD(v): current value of cost of path from source to dest. vp(v): predecessor node along path from source to vN': set of nodes whose least cost path definitively known
Network Layer 4-52
Dijsktra’s Algorithm1 Initialization:2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = ∞7 8 Loop9 find w not in N' such that D(w) is a minimum 10 add w to N'11 update D(v) for all v adjacent to w and not in N' : 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N'
27
Network Layer 4-53
Dijkstra’s algorithm: example
Step012345
N'u
uxuxy
uxyvuxyvw
uxyvwz
D(v),p(v)2,u2,u2,u
D(w),p(w)5,u4,x3,y3,y
D(x),p(x)1,u
D(y),p(y)∞
2,x
D(z),p(z)∞ ∞
4,y4,y4,y
u
yx
wv
z2
21
3
1
1
2
53
5
Network Layer 4-54
Dijkstra’s algorithm: example (2)
u
yx
wv
z
Resulting shortest-path tree from u:
vxywz
(u,v)(u,x)(u,x)(u,x)(u,x)
destination link
Resulting forwarding table in u:
28
Network Layer 4-55
Dijkstra’s algorithm, discussionAlgorithm complexity: n nodes
each iteration: need to check all nodes, w, not in Nn(n+1)/2 comparisons: O(n2)more efficient implementations possible: O(nlogn)
Oscillations possible:e.g., link cost = amount of carried traffic