340 likes | 508 Views
Lecture 11: The Network Layer. ITCS 6166/8166 091 Spring 2007 Jamie Payton Department of Computer Science University of North Carolina at Charlotte February 14, 2007. Slides adapted from: Congestion slides for Computer Networks: A Systems Approach (Peterson and Davis)
E N D
Lecture 11:The Network Layer ITCS 6166/8166 091 Spring 2007 Jamie Payton Department of Computer Science University of North Carolina at Charlotte February 14, 2007 Slides adapted from: Congestion slides for Computer Networks: A Systems Approach (Peterson and Davis) Chapter 3 slides for Computer Networking: A Top Down Approach Featuring the Internet (Kurose and Ross)
Announcements • Homework 2 • Due: Feb. 16 at 5 pm • Submit through WebCT • Homework 3 • Available! • Due: Feb. 21
Homework 3 Helpful Tips • TCP timeout • Doubles after a packet loss • Simple form of congestion control • TCP congestion window • At the conceptual level • Doubles each RTT • In implementation • Window size increases by 1 MSS for every ACK
The Network Layer • Function of network layer • Provide end-to-end connectivity • Addressing • Forwarding and Routing • Two network types • Connection-oriented • Virtual circuit networks • Connectionless • Datagram networks
Network Layer Overview:Forwarding and Routing • 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 destination • forwarding: process of getting through single interchange
Network Layer Overview:Forwarding and Routing routing algorithm local forwarding table header value output link 0100 0101 0111 1001 3 2 2 1 value in arriving packet’s header 1 0111 2 3
Network Layer Overview:Network Service Models • Network service model defines characteristics of end-to-end transport 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
Network Layer Overview:Network Layer Service Models Guarantees ? Network Architecture Internet ATM ATM ATM ATM Service Model best effort CBR VBR ABR UBR Congestion feedback no (inferred via loss) no congestion no congestion yes no Bandwidth none constant rate guaranteed rate guaranteed minimum none Loss no yes yes no no Order no yes yes yes yes Timing no yes yes no no
Network Layer Overview:Connections • Have two types of networks • Connection-oriented • Connectionless • Similar to services in transport layer, but • service: host-to-host • no choice: network provides one or the other • implementation: in network core • Support different network service models
Virtual Circuit Networks • Provide connection-oriented service through virtual circuits (VC) • Connection process • Connection setup • Data transfer • Connection teardown • Router maintains state for every connection • Possible services provided • In-order packet delivery • Guaranteed bandwidth • Guaranteed maximum jitter • Examples: ATM networks
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 • VC number can be changed on each link. • New VC number comes from forwarding table
VC number 22 32 12 3 1 2 interface number VC Forwarding Table Forwarding table in NW 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 … … … … Routers maintain connection state information!
Datagram Networks • Provide connectionless network-layer transport through datagram networks • Packets are sent independently of each other • Each packet has full set of control information • Sent using destination address • Every switch needs to be able to handle any packet • No need for per-connection state • Services • “Best-effort” • Not in-order delivery • No guarantees on bandwidth, jitter • Used in the Internet!
Internet Network Layer • Relies on: • Internet Protocol (IP) • Data format and transfer • Internet Control Message Protocol (ICMP) • Error handling • Routing protocols • Determines forwarding tables Network Layer
IP Protocol • IP packet format • 20 byte header • + options • + data • IP header • Version • Source and destination addresses • Length • Upper layer protocol • Time-to-live (TTL) • Header checksum • Fields for “fragmentation”
Network links have MTU (max. transfer size) largest possible link-level frame different link types, different MTUs Large IP datagram is “fragmented” one datagram becomes several datagrams “reassembled” at final destination IP header bits used to identify, order related fragments IP Fragmentation & Reassembly fragmentation: in: one large datagram out: 3 smaller datagrams reassembly
length =1500 length =1500 length =4000 length =1040 ID =x ID =x ID =x ID =x fragflag =0 fragflag =1 fragflag =1 fragflag =0 offset =0 offset =0 offset =370 offset =185 One large datagram becomes several smaller datagrams IP Fragmentation and Reassembly Example • 4000 byte datagram • MTU = 1500 bytes 1480 bytes in data field offset = 1480/8
Overview of IP Addressing • A 32-bit globally unique identifier for an interface • Typically written in dotted-decimal notation: 192.168.0.1 • IP address assignment • In blocks of neighboring IP addresses: “subnets” • Notation: lowest address / prefix: 192.168.0.128/25 • Allocation of addresses is crucial for routing
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 interface IP addresses associated with each interface 223.1.1.2 223.1.2.1 223.1.3.27 223.1.3.1 223.1.3.2 223.1.2.2 IP Addressing 223.1.1.1 223.1.2.9 223.1.1.4 223.1.1.3 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1
IP address: 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 Subnets 223.1.1.1 223.1.2.1 223.1.1.2 223.1.2.9 223.1.1.4 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
Recipe 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.1.0/24 223.1.2.0/24 223.1.3.0/24 Subnets Subnet mask: /24
host part subnet part 11001000 0001011100010000 00000000 200.23.16.0/23 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
IP Addresses: How to Get One? Q: How does host get IP address? • hard-coded by system admin in a file • Wintel: control-panel->network->configuration->tcp/ip->properties • UNIX: /etc/rc.config • DHCP:Dynamic Host Configuration Protocol: dynamically get address from as server • “plug-and-play” (more in next chapter)
IP Addresses: How to Get One? Q: How does network get subnet part of IP addr? A: gets 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
200.23.16.0/23 200.23.18.0/23 200.23.30.0/23 200.23.20.0/23 . . . . . . Hierarchical Addressing: Route Aggregation Hierarchical addressing allows efficient advertisement of routing information: Organization 0 Organization 1 “Send me anything with addresses beginning 200.23.16.0/20” Organization 2 Fly-By-Night-ISP Internet Organization 7 “Send me anything with addresses beginning 199.31.0.0/16” ISPs-R-Us
200.23.16.0/23 200.23.18.0/23 200.23.30.0/23 200.23.20.0/23 . . . . . . Hierarchical Addressing ISPs-R-Us has a more specific route to Organization 1 Organization 0 “Send me anything with addresses beginning 200.23.16.0/20” Organization 2 Fly-By-Night-ISP Internet Organization 7 “Send me anything with addresses beginning 199.31.0.0/16 or 200.23.18.0/23” ISPs-R-Us Organization 1
IP Addressing 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 Address Translation (NAT) • Limited number of IP addresses • Block of addresses reserved for “local” use • 10.*.*.* and 192.168.*.* • Network address translator • Connects local net through single outside IP address
3 1 2 4 S: 10.0.0.1, 3345 D: 128.119.40.186, 80 S: 138.76.29.7, 5001 D: 128.119.40.186, 80 1: host 10.0.0.1 sends datagram to 128.119.40.186, 80 2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table S: 128.119.40.186, 80 D: 10.0.0.1, 3345 S: 128.119.40.186, 80 D: 138.76.29.7, 5001 NAT: Network Address Translation NAT translation table WAN side addr LAN side addr 138.76.29.7, 5001 10.0.0.1, 3345 …… …… 10.0.0.1 10.0.0.4 10.0.0.2 138.76.29.7 10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345 3: Reply arrives dest. address: 138.76.29.7, 5001
Internet Network Layer • Relies on: • Internet Protocol (IP) • Data transfer • Internet Control Message Protocol (ICMP) • Error handling • Routing protocols • Determines forwarding tables Network Layer
Used by hosts & routers to communicate network-level information Error reporting Unreachable host Unreachable Network Unreachable Port Unknown Protocol Echo request/reply Used by ping Network-layer “above” IP: ICMP msgs carried in IP datagrams ICMP message: Type Code First 8 bytes of IP datagram causing error ICMP: Internet Control Message Protocol
ICMP Messages TypeCodedescription 0 0 echo reply (ping) 3 0 dest. network unreachable 3 1 dest host unreachable 3 2 dest protocol unreachable 3 3 dest port unreachable 3 6 dest network unknown 3 7 dest host unknown 4 0 source quench (congestion control - not used) 8 0 echo request (ping) 9 0 route advertisement 10 0 router discovery 11 0 TTL expired 12 0 bad IP header
Internet Network Layer • Relies on: • Internet Protocol (IP) • Data transfer • Internet Control Message Protocol (ICMP) • Error handling • Routing protocols • Determines forwarding tables Network Layer
Summary • Network Layer • Connection versus connectionless • Virtual Circuits vs. Datagram Networks • Network Layer Functions • Addressing • Next time: Forwarding and Routing