Download presentation
Presentation is loading. Please wait.
Published by윤혜 채 Modified over 5 years ago
1
Chapter 4 Network Layer Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 All material copyright J.F Kurose and K.W. Ross, All Rights Reserved Network Layer
2
Chapter 4: network layer
Lecture goals: understand principles behind network layer services: network layer service models forwarding versus routing how a router works routing (path selection) broadcast, multicast instantiation, implementation in the Internet Network Layer
3
Chapter 4: outline 4.1 introduction
4.2 virtual circuit and datagram networks 4.3 what’s inside a router 4.4 IP: Internet Protocol datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms link state distance vector hierarchical routing 4.6 routing in the Internet RIP OSPF BGP 4.7 broadcast and multicast routing Network Layer
4
Network layer transport segment from sending to receiving host
application transport network data link physical transport segment from sending to receiving host on sending side encapsulates segments into datagrams on receiving side, delivers segments to transport layer network layer protocols in every host, router router examines header fields in all IP datagrams passing through it network data link physical application transport network data link physical Network Layer
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
6
Connection, connection-less service
datagram network provides network-layer connectionless service virtual-circuit network provides network-layer connection service analogous to TCP/UDP connecton-oriented / connectionless transport-layer services, but: service: host-to-host no choice: network provides one or the other implementation: in network core Network Layer
7
Virtual circuits “source-to-dest path behaves much like telephone circuit” performance-wise network actions along source-to-dest path call setup, teardown for each call before data can flow each packet carries VC identifier (not destination host address) every router on source-dest path maintains “state” for each passing connection link, router resources (bandwidth, buffers) may be allocated to VC (dedicated resources = predictable service) Network Layer
8
Virtual circuits: signaling protocols
used to setup, maintain teardown VC used in ATM, frame-relay, X.25 not used in today’s Internet application transport network data link physical application transport network data link physical 5. data flow begins 6. receive data 4. call connected 3. accept call 1. initiate call 2. incoming call Network Layer
9
Datagram networks no call setup at network layer
routers: no state about end-to-end connections no network-level concept of “connection” packets forwarded using destination host address application transport network data link physical application transport network data link physical 1. send datagrams 2. receive datagrams Network Layer
10
Datagram or VC network: why?
Internet (datagram) data exchange among computers “elastic” service, no strict timing req. many link types different characteristics uniform service difficult “smart” end systems (computers) can adapt, perform control, error recovery simple inside network, complexity at “edge” ATM (VC) evolved from telephony human conversation: strict timing, reliability requirements need for guaranteed service “dumb” end systems telephones complexity inside network Network Layer
11
The Internet network layer
host, router network layer functions: transport layer: TCP, UDP IP protocol addressing conventions datagram format packet handling conventions routing protocols path selection RIP, OSPF, BGP network layer forwarding table ICMP protocol error reporting router “signaling” link layer physical layer Network Layer
12
32 bit destination IP address
IP datagram format IP protocol version number ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier header checksum time to live 32 bit source IP address head. len type of service flgs fragment offset upper layer 32 bit destination IP address options (if any) total datagram length (bytes) header length (bytes) “type” of data for fragmentation/ reassembly max number remaining hops (decremented at each router) upper layer protocol to deliver payload to e.g. timestamp, record route taken, specify list of routers to visit. how much overhead? 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead Network Layer
13
IP addressing: introduction
IP address: 32-bit identifier for host, router interface interface: connection between host/router and physical link routers typically have multiple interfaces host typically has one active interface (e.g., wired Ethernet, wireless ) one IP address associated with each interface = 223 1 1 1 Network Layer
14
IP addressing: introduction
Q: how are interfaces actually connected? A: wired Ethernet interfaces connected by Ethernet switches A: wireless WiFi interfaces connected by WiFi base station Network Layer
15
Subnets IP address: what’s a subnet ? subnet part - high order bits
host part - low order bits what’s a subnet ? device interfaces with same subnet part of IP address can physically reach each other without intervening router subnet network consisting of 3 subnets Network Layer
16
IP addressing: how to get a block?
Q: how does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers allocates addresses manages DNS assigns domain names, resolves disputes Network Layer
17
IP addresses: how to get one?
Q: How does a host get IP address? hard-coded by system admin in a file Windows: control-panel->network->configuration->tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server DHCP is also called as “plug-and-play” protocol Network Layer
18
DHCP: Dynamic Host Configuration Protocol
goal: allow host to dynamically obtain its 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 want to join network (more shortly) DHCP overview: DORA concept host broadcasts “DHCP discover” msg [optional] DHCP server responds with “DHCP offer” msg [optional] host requests IP address: “DHCP request” msg DHCP server sends address: “DHCP ack” msg Network Layer
19
DHCP client-server scenario
/24 arriving DHCP client needs address in this network /24 /24 Network Layer
20
DHCP client-server scenario
DHCP server: DHCP discover src : , 68 dest.: ,67 yiaddr: transaction ID: 654 arriving client DHCP offer src: , 67 dest: , 68 yiaddrr: transaction ID: 654 lifetime: 3600 secs DHCP request src: , 68 dest:: , 67 yiaddrr: transaction ID: 655 lifetime: 3600 secs DHCP ACK src: , 67 dest: , 68 yiaddrr: transaction ID: 655 lifetime: 3600 secs Network Layer
21
DHCP: example DHCP UDP IP Eth Phy DHCP DHCP connecting laptop needs its IP address, addr of first-hop router, addr of DNS server: use DHCP DHCP DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in Ethernet DHCP DHCP UDP IP Eth Phy DHCP Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server router with DHCP server built into router Ethernet demuxed to IP demuxed, UDP demuxed to DHCP Network Layer
22
DHCP: example DHCP DCP server formulates DHCP ACK containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server DHCP UDP IP Eth Phy encapsulation of DHCP server, frame forwarded to client, demuxing up to DHCP at client DHCP UDP IP Eth Phy DHCP DHCP router with DHCP server built into router client now knows its IP address, name and IP address of DSN server, IP address of its first-hop router DHCP Network Layer
23
NAT: network address translation
rest of Internet local network (e.g., home network) 10.0.0/24 all datagrams leaving local network have same single source NAT IP address: ,different source port numbers datagrams with source or destination in this network have /24 address for source, destination (as usual) Network Layer
24
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 devices can change addresses of devices in local network without notifying outside world can change ISP without changing addresses of devices in local network devices inside local net not explicitly addressable, visible by outside world (a security plus) Network Layer
25
NAT: network address translation
implementation: NAT router must: 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
26
NAT: network address translation
NAT translation table WAN side addr LAN side addr 1: host sends datagram to , 80 2: NAT router changes datagram source addr from , 3345 to , 5001, updates table , , 3345 …… …… S: , 3345 D: , 80 1 S: , 80 D: , 3345 4 S: , 5001 D: , 80 2 S: , 80 D: , 5001 3 4: NAT router changes datagram dest addr from , 5001 to , 3345 3: reply arrives dest. address: , 5001 Network Layer
27
ICMP: internet control message protocol
used by hosts & routers to communicate network-level information error reporting: unreachable host, network, port, protocol echo request/reply (used by ping) 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 description echo reply (ping) dest. network unreachable dest host unreachable dest protocol unreachable dest port unreachable dest network unknown dest host unknown source quench (congestion control - not used) echo request (ping) route advertisement router discovery TTL expired bad IP header Network Layer
28
Traceroute and ICMP source sends series of UDP segments to dest
first set has TTL =1 second set has TTL=2, etc. unlikely port number when nth set of datagrams arrives to nth router: router discards datagrams and sends source ICMP messages (type 11, code 0) ICMP messages includes name of router & IP address when ICMP messages arrives, source records RTTs stopping criteria: UDP segment eventually arrives at destination host destination returns ICMP “port unreachable” message (type 3, code 3) source stops 3 probes 3 probes 3 probes Network Layer
29
IPv6: motivation initial motivation: 32-bit address space soon to be completely allocated. additional motivation: header format helps speed processing/forwarding header changes to facilitate QoS IPv6 datagram format: fixed-length 40 byte header (20 byte in IPv4) no fragmentation allowed Network Layer
30
IPv6 datagram format priority: identify priority among datagrams in flow flow Label: identify datagrams in same “flow.” next header: identify upper layer protocol for data ver pri flow label payload len next hdr hop limit source address (128 bits) destination address (128 bits) data 32 bits Network Layer
31
Other changes from IPv4 checksum: removed entirely to reduce processing time at each hop options: allowed, but outside of header, indicated by “Next Header” field ICMPv6: new version of ICMP additional message types, e.g. “Packet Too Big” Network Layer
32
Transition from IPv4 to IPv6
not all routers can be upgraded simultaneously how will network operate with mixed IPv4 and IPv6 routers? tunneling: IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers IPv4 header fields UDP/TCP payload IPv6 source dest addr IPv6 header fields IPv4 payload IPv4 source, dest addr IPv6 datagram IPv4 datagram Network Layer
33
Interplay between routing, forwarding
routing algorithm determines end-end-path through network routing algorithm forwarding table determines local forwarding at this router local forwarding table dest address output link address-range 1 address-range 2 address-range 3 address-range 4 3 2 1 IP destination address in arriving packet’s header 1 2 3 Network Layer
34
Routing algorithm Routing Algorithm Q: static or dynamic? static:
The main function of the network layer is routing packets from the source machine to the destination machine. Q: static or dynamic? static: routes change slowly over time dynamic: routes change more quickly periodic update in response to link cost changes Network Layer
35
A Link-State Routing Algorithm
Link State Routing: Each router must do the following: Discover its neighbors and learn their network addresses. Measure the delay or cost to each of its neighbors Construct & send this packet to all other routers. Choose the shortest path to every other router. Network Layer
36
A Link-State Routing Algorithm
Dijkstra’s algorithm net 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 table for that node iterative: after k iterations, know least cost path to k destinations notation: c(x,y): link cost from node x to y; = ∞ if not direct neighbors D(v): current value of cost of path from source to dest. v p(v): predecessor node along path from source to v N': set of nodes whose least cost path definitively known Network Layer
37
Dijsktra’s Algorithm 1 Initialization: 2 N' = {u} 3 for all nodes v
if v adjacent to u then D(v) = c(u,v) else D(v) = ∞ 7 8 Loop 9 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' : D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known shortest path cost to w plus cost from w to v */ 15 until all nodes in N' Network Layer
38
Dijkstra’s algorithm: example
D(v) p(v) D(w) p(w) D(x) p(x) D(y) p(y) D(z) p(z) Step N' u ∞ 7,u 3,u 5,u 1 uw ∞ 11,w 6,w 5,u 2 uwx 14,x 11,w 6,w 3 uwxv 14,x 10,v 4 uwxvy 12,y 5 uwxvyz w 3 4 v x u 5 7 y 8 z 2 9 notes: construct shortest path tree by tracing predecessor nodes ties can exist (can be broken arbitrarily) Network Layer
39
Dijkstra’s algorithm: example
w 3 4 v x u 5 7 y 8 z 2 9 resulting forwarding table in u: v x y w z (u,w) (u,x) destination link Network Layer
40
Distance vector algorithm
Distance Vector algorithm: Distance vector routing algorithms operate by having each router maintain a table (i.e., a vector) giving the best known distance to each destination and which line to use to get there. These tables are updated by exchanging information with the neighbors Network Layer
41
Hierarchical routing The hierarchical routing is used, the routers are divided into what we will call regions, with each router knowing all the details about how to route packets. routers in same AS run same routing protocol “intra-AS” routing protocol routers in different AS can run different intra-AS routing protocol gateway router: at “edge” of its own AS has link to router in another AS Network Layer
42
Intra-AS Routing also known as interior gateway protocols (IGP)
most common intra-AS routing protocols: RIP: Routing Information Protocol OSPF: Open Shortest Path First Network Layer
43
RIP ( Routing Information Protocol)
Routing Information Protocol (RIP): The Routing Information Protocol (RIP) is one of the oldest distance-vector routing protocols which employ the hop count as a routing metric. RIP prevents routing loops by implementing limit on the number of hops allowed in a path from source to destination. Network Layer
44
OSPF (Open Shortest Path First)
OSPF supports three kinds of connections and networks: Point-to-point lines between exactly two routers. Multi-access networks with broadcasting (e.g., most LANs). Multi-access networks without broadcasting (e.g., most packet-switched WANs). Network Layer
45
Internet inter-AS routing: BGP
Border Gateway Protocol (BGP) : The Border Gateway Protocol (BGP) is the protocol backing the core routing decisions on the Internet. It maintains a table of IP networks or 'prefixes' which designate network reach ability among autonomous system(AS). It is described as a path vector protocol. Network Layer
46
Broadcast routing Sending a packet to all destinations simultaneously is called broadcasting; various methods have been proposed for doing it. deliver packets from source to all other nodes flooding: in which every incoming packet is sent out on every outgoing line except the one it arrived on. when node receives broadcast packet, sends copy to all neighbors Network Layer
47
Spanning tree Spanning Tree Protocol (STP) is a network protocol that builds a logical loop-free topology for Ethernet networks. The basic function of STP is to prevent bridge loops and the broadcast radiation that results from them. Network Layer
48
Shortest path tree multicast forwarding tree: tree of shortest path routes from source to all receivers Dijkstra’s algorithm R1 R2 R3 R4 R5 R6 R7 2 1 6 3 4 5 s: source LEGEND router with attached group member router with no attached group member Notes: 3.3 Network Layer: Multicast Routing Algorithms link used for forwarding, i indicates order link added by algorithm i Network Layer
49
Chapter 4: done! 4.1 introduction
4.2 virtual circuit and datagram networks 4.3 what’s inside a router 4.4 IP: Internet Protocol datagram format, IPv4 addressing, ICMP, IPv6 4.5 routing algorithms link state, distance vector, hierarchical routing 4.6 routing in the Internet RIP, OSPF, BGP 4.7 broadcast and multicast routing understand principles behind network layer services: network layer service models, forwarding versus routing how a router works, routing (path selection), broadcast, multicast instantiation, implementation in the Internet Network Layer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.