330 likes | 565 Views
Chapter 4 Network Layer 3: The Internet Protocol (IP). Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu. Announcements. Reminder: Programming assignment #1 is due Feb. 19
E N D
Chapter 4Network Layer 3:The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu
Announcements • Reminder: Programming assignment #1 is due Feb. 19 • Part of Homework #2 available later today on Web site, the traceroute part will be available Monday • Homework #1 solutions when we hand back graded Homework #1 • Reading Chapter 4 • 4.1 today + added material • 4.2, 4.3, 4.4 in same order • Next, IP network, packets, ARP, RARP, … Prof. Rick Han, University of Colorado at Boulder
Recap of Previous Lecture • Interconnecting Ethernet LANs • Ethernet Bridges/Switches – Layer 2 • Loops can form, causing: • Packet multiplication • Endless Looping • Solution: Create Spanning Trees • Eliminates Loops and Spanning Trees • Interconnecting Hosts and Switches via Point-to-Point Links • Asynchronous Transfer Mode (ATM) • Virtual circuits to route packets Prof. Rick Han, University of Colorado at Boulder
ATM Network • Switch packets via virtual circuit routing • Lost to Ethernet in LAN, Losing to Gig. Eth./ SONET in MAN, SONET/MPLS in WAN • Cost and complexity • But, some customers (DSL) want AAL’s guaranteed QOS for voice/video Switch C Host A Switch B Host F Switch E Switch D Prof. Rick Han, University of Colorado at Boulder
Frame Relay and X.25 • Frame Relay: • Like ATM, uses permanent virtual circuits (PVCs – more common) and SVCs • Widely deployed in 1990s • No error recovery per link – not necessary over optical fiber • X.25 is an old 1970s “public packet switching” technology • Like ATM, uses virtual circuits to interconnect “dumb” terminals • Error recovery on each link, due to noisy copper phone lines Prof. Rick Han, University of Colorado at Boulder
Bridging to Connect Remote LANs? • Network “Cloud” could be one giant bridge • Switch B keeps Ethernet MAC header, encapsulates Ethernet frame with network header, Switch E strips away network header • spanning tree and a bridge table within cloud ATM or Frame Relay Network Ethernet 1 Ethernet 2 Switch C Switch B Switch E Switch D Prof. Rick Han, University of Colorado at Boulder
Bridging to Connect Remote LANs? (2) • Problems: • Many different types of LAN’s, e.g. Token Ring and FDDI, with completely different addressing schemes • Spanning tree doesn’t scale well ATM or Frame Relay Network Undecipherable? Ethernet 1 Switch C Switch B Token Ring Switch E Switch D Prof. Rick Han, University of Colorado at Boulder
Routing to Connect Remote LANs • Internet Protocol (IP) addressing is the glue that spans heterogeneous LANs and WANs • IP hosts send IP packets via IP routers (shown in yellow) ATM/Frame Relay Switch C Router X Switch B Router Y Host 1 Switch E Switch D Host 2 Prof. Rick Han, University of Colorado at Boulder
Phy Phy ATM Link ATM Link Routing to Connect Remote LANs (2) Host 1 Router X Router Y Host 2 IP IP IP IP Tok R MAC Eth. MAC Eth. MAC Tok R MAC Phys. Phys. Phys. ATM Net. Phys. Prof. Rick Han, University of Colorado at Boulder
Routing to Connect Remote LANs (3) • Alternatively, IP directly over SONET (MANs) • Link-layer framing over fiber • Less overhead: (IP over SONET) vs. (IP over ATM over link layer (could be SONET)) IP over SONET Router C SONET Router X Router B SONET Router Y SONET SONET SONET SONET Host 1 Router E SONET Router D Host 2 Prof. Rick Han, University of Colorado at Boulder
Routing to Connect Remote LANs (4) Host 1 Router X Router Y Host 2 IP IP IP IP Tok R MAC Eth. MAC Eth. MAC SONET framing SONET framing Tok R MAC IP Net. Opt Fbr OC-? Opt Fbr OC-? Phys. Phys. Phys. Phys. • OC3=155 Mbps, OC12=622 Mbps, OC48=2.488 Gbps, OC192=10 Gbps • Competitors to SONET in MAN: Gigabit Ethernet Prof. Rick Han, University of Colorado at Boulder
Internet Backbone Take this with a grain of salt: can be a highly political prediction of what someone wants to happen Prof. Rick Han, University of Colorado at Boulder
UUNet/WorldCom • Backbone Provider • To ISP’s: • Leader at 28% • market share • Claim: there’s a • bandwidth glut on • the backbone: • ~1% bandwidth • utilization Prof. Rick Han, University of Colorado at Boulder
AT&T SONET Backbone Prof. Rick Han, University of Colorado at Boulder
Internet Topology Internet Service Provider ISP ISP Host 2 POP Host 1 POP Point of Presence Network Access Point Backbone Provider Backbone Provider NAP Also called NSP: Network Service Provider Prof. Rick Han, University of Colorado at Boulder
Internet Routing • For simplicity, assume an Internet with a homogeneous IP backbone. IP provides: • Unreliable out-of-order datagram delivery, also called “best-effort” service - no QOS guarantees, just First-Come-First-Serve (FCFS) routing IP backbone Router C Router X Router B Router Y Host 1 Router E Router D Host 2 Prof. Rick Han, University of Colorado at Boulder
Internet Protocol Packet Format IP Datagram IP Header Data (variable length) Prof. Rick Han, University of Colorado at Boulder
IP Packet Header • Big endian/network byte order: send lower order bytes first • Send bits 0-7, then 8-15, then … • Version: current version is 4, I.e. IPv4 • proposal for IPv6, which will have a different header Prof. Rick Han, University of Colorado at Boulder
IP Packet Header (2) • IHL: header length in # 32-bit words • Normally = 5, i.e. 20 byte IP headers • Max 60 bytes • Header can be variable length Prof. Rick Han, University of Colorado at Boulder
IP Packet Header (3) • Type of Service: 3-bit precedence field (unused), 4 TOS bits, 1 unused bit set to 0 • TOS bit 1 (min delay), 2 (max throughput), 3 (max reliability), 4 (min cost): only one can be set • typically all are zero, for best-effort service • DiffServ proposes to use TOS for IP QOS Prof. Rick Han, University of Colorado at Boulder
IP Packet Header (4) • Total Length: of datagram, in bytes • Max size is 65535 bytes • Identification: uniquely identifies each datagram sent by a host • Used for fragmentation and reassembly Prof. Rick Han, University of Colorado at Boulder
IP Packet Header (5) • Flags & Fragment Offset: for fragmentation • Time To Live: upper limit on # routers that a datagram may pass through • Initialized by sender, and decremented by each router. When zero, discard datagram. Stops looping Prof. Rick Han, University of Colorado at Boulder
IP Packet Header (6) • Protocol: IP needs to know to what protocol it should hand the received IP datagram • demultiplexes incoming IP datagrams into either UDP, TCP, ARP, … Prof. Rick Han, University of Colorado at Boulder
IP Packet Header (7) • Header Checksum: calculated only over header • At sender, set to 0. Compute one’s complement 16-bit sum. Insert 16-bit one’s complement of this sum. • At receiver, compute 16-bit one’s complement sum of header – should be all 1’s. If not, discard Prof. Rick Han, University of Colorado at Boulder
IP Packet Header (8) • Source and Destination IP address: 32 bits long each: • Often see written like, 12.244.92.161 • 127.0.0.1 is localhost loopback address, i.e. yourself • Various classes of IP addresses Prof. Rick Han, University of Colorado at Boulder
IP Addressing • Destination address is the key to packet routing: • IP routers only look at where the packet is headed, rather than where it came from • Source address is useful: • At receiver, to decide whether to accept incoming packet • At receiver, to send acknowledgement back to sender, e.g. TCP sends its acknowledgements • IP address is per interface, so a given router with N interfaces can have N IP addresses Prof. Rick Han, University of Colorado at Boulder
IP Addressing (2) • IP addresses are hierarchical: 12.244.92.161 • Class A • Class B • Class C • Hierarchy to handle WANs, MANs, and LANs: • Class C allows for only 256 local hosts, but 221 Class C networks – for small office nets • Class A allows many 224 local hosts, few 27 networks 7 24 0 Network Host 14 16 1 0 Network Host 21 8 1 1 0 Network Host Prof. Rick Han, University of Colorado at Boulder
IP Addressing (3) • Classes impose fixed-size network sub-fields that may not suit an organization’s needs => waste much address space • Phase out fixed classes A, B, C • Solution: classless routing, or Classless Interdomain Routing (CIDR), 1993 • Network sub-field can have any number of bits • a.b.c.d/x is CIDR notion for an IP address a.b.c.d with first x bits as network address Prof. Rick Han, University of Colorado at Boulder
IP Addressing (4) • Assigning IP addresses: • Automatically: via Dynamic Host Configuration Protocol (DHCP) – we’ll study it later • Manually: • Contact your ISP • an organization contacts its ISP for a block of allocated IP addresses • An ISP contacts one of several well-known global registries (originally managed by IANA alone) • 4 billion possible addresses • Running out? • NAT (Network Address Translation) ease the pressure – we’ll study it later • IPv6 Prof. Rick Han, University of Colorado at Boulder
IP Fragmentation and Reassembly • Fragmentation occurs when datagram exceeds MTU of underlying network • Ethernet MTU is 1500 bytes, FDDI MTU is 4500 bytes • Identifier field uniquely identifies a datagram sent from a source • Set M bit in Flags field to one to indicate more fragments to follow • Set Offset to 0 for first fragment • For second fragment, set Offset = length of data in first fragment • For N’th fragment, set Offset = sum of lengths of data in N-1 fragments Prof. Rick Han, University of Colorado at Boulder
IP Fragmentation and Reassembly (2) • For last fragment, set M in Flags field to 0, to indicate no more fragments • Each IP fragment is a full-fledged datagram • Reassembly: • Fragments can be lost • After waiting a “reasonable” amount of time, an IP end host will stop reassembly • To avoid this waiting delay due to lost fragments, the sending host should perform path MTU discovery prior to sending IP packets, and then send at the MTU of the path Prof. Rick Han, University of Colorado at Boulder
Address Resolution Protocol (ARP) • How does IP sends its packet over Ethernet? • Ethernet doesn’t understand 32-bit addresses • Need to map 32-bit to Ethernet’s “physical” 48-bit addresses • Each host builds a cache that maps IP addresses to Ethernet addresses – distributed, not centralized • If sending to a host on the same Ethernet, • First, check cache if address already present • If not, send an Ethernet’s broadcast query (all 1’s in 48-bit address), frame’s Type field set to ARP • Query contains “target” IP address, and link layer address of sending host Prof. Rick Han, University of Colorado at Boulder
Address Resolution Protocol (2) • Each host receives broadcast query and checks to see if target IP address matches its own • If match, sends a response to link-layer address of originator, containing its own link-layer address • When another host hears an ARP request • If requester is in cache, then refresh its own cache • Entries in ARP cache time out ~ every 15 min • If requester is not in cache • If host is target, then add to cache • Otherwise don’t add to cache, to keep ARP table clean Prof. Rick Han, University of Colorado at Boulder