Chapter 4 Network Layer Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 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 see the animations; and 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) that you mention their source (after all, we’d like people to use our book!) If you post any slides 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-2012 J.F Kurose and K.W. Ross, All Rights Reserved Network Layer
Chapter 4: network layer chapter 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
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
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
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 destination routing algorithms Network Layer
Interplay between routing and forwarding 1 2 3 0111 value in arriving packet’s header routing algorithm local forwarding table header value output link 0100 0101 1001 routing algorithm determines end-to-end-path through network forwarding table determines local forwarding at this router Network Layer
3rd important function : Connection setup 3rd important function in some network architectures: ATM, frame relay, X.25 before datagrams flow, two end hosts and intervening routers establish virtual connection (VC) routers get involved network vs transport layer connection service: network: between two hosts (may also involve intervening routers in case of VCs) transport: between two processes Network Layer
Network service model Q: What service model for “channel” transporting datagrams from sender to receiver? example services for individual datagrams: guaranteed delivery guaranteed delivery with less than 40 msec delay example services for a flow of datagrams: in-order datagram delivery guaranteed minimum bandwidth to flow restrictions on “changes in inter-packet spacing (jitter)” Security Network Layer
Network layer service models: Guarantees ? Network Architecture Internet ATM Service Model best effort CBR ABR Congestion feedback no (inferred via loss) no yes Bandwidth none constant rate guaranteed minimum Loss no yes Order no yes Timing no yes CBR: Constant Bit Rate ABR: Available Bit Rate Network Layer
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
Connection, connection-less service datagram network provides network-layer connectionless service virtual-circuit network provides network-layer connection service analogous to TCP/UDP connection-oriented / connectionless transport-layer services, but: Network layer - service: host-to-host Network layer - no choice: network provides either one or the other, but not both Network layer - implementation: in network core Network Layer
Virtual circuits (VCs) “source-to-dest path behaves much like telephone circuit” Performance is almost guaranteed 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
VC implementation a VC consists of: path from source to destination VC numbers, one number for each link along path entries in forwarding tables in routers along path packet belonging to VC carries VC number (rather than dest address) VC number can be changed on each link. new VC number comes from forwarding table Network Layer
VC forwarding table VC routers maintain connection state information! 22 12 32 1 3 2 VC number interface number forwarding table in northwest router: Incoming interface Incoming VC # Outgoing interface Outgoing VC # 1 12 3 22 2 63 1 18 3 7 2 17 1 97 3 87 … … … … VC routers maintain connection state information! Network Layer
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
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
Datagram forwarding table 4 billion IP addresses, so rather than individual destination address list “range of addresses” list (aggregate table entries) routing algorithm 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
Datagram forwarding table Destination Address Range 11001000 00010111 00010000 00000000 through 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 11001000 00010111 00011000 11111111 11001000 00010111 00011001 00000000 11001000 00010111 00011111 11111111 otherwise Link Interface 1 2 3 Q: but what happens if ranges don’t divide up so nicely? Network Layer
Longest prefix matching when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address. Destination Address Range 11001000 00010111 00010*** ********* 11001000 00010111 00011000 ********* 11001000 00010111 00011*** ********* otherwise Link interface 1 2 3 examples: DA: 11001000 00010111 00010110 10100001 which interface? DA: 11001000 00010111 00011000 10101010 which interface? Network Layer
Datagram or VC network: why? Internet (datagram) data exchange among computers “elastic” service, no strict timing req. “smart” end systems (computers) can adapt, perform control, error recovery simple inside network, complexity at “edge” ATM (VC) evolved from telephony “dumb” end systems telephones complexity inside network Network Layer
Chapter 4: outline 4.1 introduction 4.2 virtual circuit and datagram networks 4.3 what’s inside a router (skip) 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
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
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
IP datagram format Network Layer
Link MTU vs. Path MTU vs. MSS Maximum Transmission Unit (MTU) is defined by the maximum payload size of the Layer 2 frame. Link MTU: The max packet size that can be transmitted over a link Path MTU: The minimum link MTU of all links in a path between a source and a destination Layer 3 payload determines Layer 4 Maximum Segment Size (MSS) MAC Header (Path MTU) Transport Layer
IP fragmentation, reassembly network links have MTU - largest possible link-level frame different link types, different MTUs large IP datagram divided (“fragmented”) within net one datagram becomes several datagrams “reassembled” only at final destination IP header bits used to identify, order related fragments … fragmentation: in: one large datagram out: 3 smaller datagrams reassembly … Network Layer
IP fragmentation, reassembly ID =x offset =0 flags =010 length =4000 example: 4000 byte datagram MTU = 1500 bytes ID =x offset =0 flags =001 length =1500 =185 =370 =000 =1040 one large datagram becomes several smaller datagrams 1480 bytes in data field (20 bytes in head) offset = 1480/8 offset = 2960/8 Network Layer
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
IP addressing: introduction 223.1.1.1 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 or two interfaces (e.g., wired Ethernet, wireless 802.11) IP addresses associated with each interface 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9 223.1.3.27 223.1.1.3 223.1.2.2 223.1.3.1 223.1.3.2 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1 Network Layer
IP addressing: introduction 223.1.1.1 Q: how are interfaces actually connected? A: we’ll learn about that in chapter 5, 6. 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9 A: wired Ethernet interfaces connected by Ethernet switches (or hubs) 223.1.3.27 223.1.1.3 223.1.2.2 A: wireless WiFi interfaces connected by WiFi base station 223.1.3.1 223.1.3.2 For now: don’t need to worry about how one interface is connected to another (with no intervening router) Network Layer
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 223.1.1.1 223.1.1.2 223.1.2.1 223.1.1.4 223.1.2.9 223.1.2.2 223.1.1.3 223.1.3.27 subnet 223.1.3.2 223.1.3.1 network consisting of 3 subnets Network Layer
Subnets 223.1.1.0/24 223.1.2.0/24 223.1.3.0/24 223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.9 223.1.3.2 223.1.3.1 subnet 223.1.1.2 223.1.3.27 223.1.2.2 223.1.2.1 recipe to determine the subnets, detach each interface from its router, creating islands of isolated networks each isolated network is called a subnet subnet mask: /24 Network Layer
Subnets 223.1.1.2 how many? 223.1.1.1 223.1.1.4 223.1.1.3 223.1.9.2 223.1.7.0 223.1.9.1 223.1.7.1 223.1.8.1 223.1.8.0 223.1.2.6 223.1.3.27 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 Network Layer
Classful Addressing 0~127 128~191 192~223 224~239 240~255 Network Layer
Classful Addressing Class A, B and C addresses are divided into 2 parts : (fixed sized) Netid and Hostid. Network Layer
Classful Addressing – blocks in class A Class A addresses are wasted!!! Network Layer
Classful Addressing – blocks in class B Many class B addresses are wasted too. Network Layer
Classful Addressing – blocks in class C Class C blocks are too small for most businesses. Network Layer
Masking Concept Given an address from a block of addresses, we can find the network address (netid) by ANDing with a mask. Network Layer
Masking Concept - Default masks - Network address (netid) can be found by applying the default mask to any of the addresses in the block (including itself). - The masked address retains the netid of the block and sets the hostid to zero. Network Layer
IP addressing: CIDR CIDR: Classless InterDomain Routing subnet portion of address of “arbitrary length” address format: a.b.c.d/x, where x is # bits in subnet portion of address subnet part host part 11001000 00010111 00010000 00000000 200.23.16.0/23 Network Layer
IP addressing: CIDR Subnet mask Used by every machine to determine which part of IP address is to be used for the “subnet address” 255.255.255.128 /25 255.255.255.192 /26 . 255.255.255.254 /31 Network Layer