1DT066 Distributed Information System
Total Page:16
File Type:pdf, Size:1020Kb
1DT066 Distributed Information System Chapter 4 Network Layer CHAPTER 4: NETWORK LAYER Chapter goals: ¢ Understand principles behind network layer services: network layer service models forwarding vs routing how a router works routing (path selection) dealing with scale advanced topics: IPv6, mobility ¢ Implementation in the Internet 1 CHAPTER 4: NETWORK LAYER ¢ 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 IPv6 ESSENCE OF NETWORKING LAYER A B Data Link Physical 2 NETWORK LAYER application ¢ transport segment from transport network sending to receiving host data link physical network network ¢ on sending side data link data link network Network Layer physical physical encapsulates segments into data link physical network network datagrams data link data link physical physical ¢ on receiver side, delivers network network data link data link segments to transport layer physical physical network ¢ network layer protocols in data link physical application every host, router transport network network data link network data link ¢ router examines header network physical data link physical data link physical fields in all IP datagrams physical passing through it TWO KEY NETWORK-LAYER FUNCTIONS ¢ forwarding: move packets from router’s input to correct router output ¢ routing: determine route taken by packets from source to destination. routing algorithms (e.g., OSPF, BGP) 3 Interplay of forwarding and routing Value in arriving packet’s header 1 0111 2 3 routing algorithm local forwarding table header output value link 0100 3 0101 2 0111 2 1001 1 CHAPTER 4: NETWORK LAYER ¢ 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 NETWORK LAYER CONNECTION AND CONNECTION-LESS SERVICE ¢ Datagram network provides network-layer connectionless service ¢ VC network provides network-layer connection service VIRTUAL CIRCUITS “source-to-dest path behaves like a telephone circuit” performance benefits network actions along source-to-dest path ¢ 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) 5 VC FORWARDING TABLE VC number 12 22 32 1 3 2 Forwarding table in Interface northwest router: number Incoming interface Incoming VC # Outgoing interface Outgoing VC # 1 12 3 22 2 63 1 18 3 7 2 17 1 97 3 87 … … … … Routers maintain connection state information! VIRTUAL CIRCUITS: SIGNALING PROTOCOLS ¢ used in ATM, frame-relay, X.25 ¢ not used in today’s Internet application 6. Receive data application transport 5. Data flow begins transport network 4. Call connected 3. Accept call network data link 1. Initiate call 2. incoming call data link physical physical 6 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 packets between same source-dest pair may take different paths application application transport transport network network data link 1. Send data 2. Receive data data link physical physical 4 billion FORWARDING TABLE possible entries! Destination Address Range Link Interface 11001000 00010111 00010000 00000000 through 0 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 through 1 11001000 00010111 00011000 11111111 11001000 00010111 00011001 00000000 through 2 11001000 00010111 00011111 11111111 Otherwise 3 7 LONGEST PREFIX MATCHING Prefix Match Link Interface 11001000 00010111 00010___ ________ 0 11001000 00010111 00011000 ________ 1 11001000 00010111 00011___ ________ 2 Otherwise 3 Examples: DEST: 11001000 00010111 00010110 10100001 Which interface? DEST: 11001000 00010111 00011000 10101010 Which interface? CHAPTER 4: NETWORK LAYER ¢ 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 IPv6 8 ROUTER ARCHITECTURE OVERVIEW Two key router functions: ¢ run routing algorithms/protocol (RIP, OSPF, BGP) ¢ forwarding datagrams from incoming to outgoing link CHAPTER 4: NETWORK LAYER ¢ 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 IPv6 9 THE INTERNET NETWORK LAYER Host, router network layer functions: Transport layer: TCP, UDP Routing protocols IP protocol • path selection • addressing conventions Network • RIP, OSPF, BGP • datagram format layer • packet handling conventions forwarding table ICMP protocol • error reporting • router “signaling” Link layer Physical layer CHAPTER 4: NETWORK LAYER ¢ 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 IPv6 10 IP DATAGRAM FORMAT IP protocol version 32 bits number total datagram header length head. type of length (bytes) ver length (bytes) len service fragmentation/ “type” of data fragment flgs reassembly 16-bit identifier offset max number time to upper header remaining hops live layer checksum (decremented at each router) 32 bit source IP address 32 bit destination IP address upper layer protocol to deliver payload to Options (if any) Data (variable length, typically a TCP or UDP segment) IP FRAGMENTATION & REASSEMBLY ¢ Network links have MTU (max.transfer size) largest possible link-level frame. fragmentation: ¢ Large IP datagram divided in: 1 large (“fragmented”) within net out: 3 small one datagram becomes several datagrams “reassembled” only at final destination IP header bits used to identify, order related fragments reassembly 11 IP FRAGMENTATION AND REASSEMBLY length ID fragflag offset Example =4000 =x =0 =0 ❒ 4000 byte Network Layer One large datagram becomes datagram several smaller datagrams ❒ MTU = 1500 bytes length ID fragflag offset =1500 =x =1 =0 1480 bytes in data field length ID fragflag offset =1500 =x =1 =185 offset = 1480/8 length ID fragflag offset =1040 =x =0 =370 4-2 3 CHAPTER 4: NETWORK LAYER ¢ 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 IPv6 12 IP ADDRESSING: INTRODUCTION 223.1.1.1 ¢ IP address: 32-bit 223.1.2.1 identifier for host, 223.1.1.2 router interface 223.1.1.4 223.1.2.9 ¢ 223.1.2.2 interface: connection 223.1.1.3 223.1.3.27 between host/router and physical link router’s typically have 223.1.3.1 223.1.3.2 multiple interfaces host typically has one interface 223.1.1.1 = 11011111 00000001 00000001 00000001 IP addresses associated 223 with each interface 1 1 1 SUBNETS ¢ IP address: subnet part (high order bits) host part (low order bits) ¢ What is a subnet ? device interfaces with same subnet part of IP address can physically reach each other without intervening router subnet host part part 11001000 00010111 00010000 00000000 200.23.16.0/24 13 223.1.1.0/24 223.1.2.0/24 SUBNETS ¢ To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet. 223.1.3.0/24 Subnet mask: /24 223.1.1.2 SUBNETS 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 14 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 host part part 11001000 00010111 00010000 00000000 200.23.16.0/23 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 a server “plug-and-play” 15 DHCP: DYNAMIC HOST CONFIGURATION PROTOCOL Goal: allow host to dynamically obtain its IP address from network server when it joins network Allows reuse of addresses 223.1.2.1 A 223.1.1.1 DHCP server 223.1.1.2 223.1.1.4 223.1.2.9 B 223.1.2.2 arriving DHCP 223.1.1.3 223.1.3.27 E client needs address in this 223.1.3.2 223.1.3.1 network DHCP CLIENT-SERVER SCENARIO arriving DHCP server: 223.1.2.5 DHCP discover client src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 Network Layer DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs time DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 4-3 Lifetime: 3600 secs 2 16 IP ADDRESSES: HOW TO GET ONE? Q: How does network get subnet part of IP addr? A: It’s allocated portion of its provider ISP’s address space ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. …. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23 HIERARCHICAL ADDRESSING: ROUTE AGGREGATION Hierarchical addressing allows efficient advertisement of routing information: Network Layer Network Organization 0 200.23.16.0/23 Organization 1 “Send me anything 200.23.18.0/23 with addresses Organization 2 beginning .