1 / 41

ECE 4450:427/527 - Computer Networks Spring 2014

ECE 4450:427/527 - Computer Networks Spring 2014. Dr. Nghi Tran Department of Electrical & Computer Engineering. Lecture 6.2: IP. Internetworking: Discussions. For Internetworking , we shall look at few sub-problems: Interconnect links of the same type : Switches

lavonn
Télécharger la présentation

ECE 4450:427/527 - Computer Networks Spring 2014

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 4450:427/527 - Computer NetworksSpring 2014 Dr. Nghi Tran Department of Electrical & Computer Engineering Lecture 6.2: IP ECE 4450:427/527

  2. Internetworking: Discussions • For Internetworking, we shall look at few sub-problems: • Interconnect links of the same type: Switches • We consider an important of class switch: Bridges to interconnect Ethernet segments. • We also look a way to interconnect disparate networks and links: Gateways, or now mostly known as routers. We shall focus on the IP • Once we are able to interconnect a whole lot of links and networks with switches and routers, we will look at a way to find a suitable path, or route through a new working: • Paths that are efficient, loop free, etc.: Routing ECE 4450:427/527

  3. Internetworking • What is internetwork • An arbitrary collection of networks interconnected to provide some sort of host-host to packet delivery service A simple internetwork where H represents hosts and R represents routers ECE 4450:427/527

  4. IP: Internet Protocol • What is IP • IP stands for Internet Protocol • Key tool used today to build scalable, heterogeneous internetworks • It runs on all the nodes in a collection of networks and defines the infrastructure that allows these nodes and networks to function as a single logical internetwork A simple internetwork showing the protocol layers A simple internetwork showing the protocol layers ECE 4450:427/527

  5. IP: “Best Effort” Service • IP is a datagram connectionless protocol • Does not provide any type of guarantee about packet delivery • Out of order packet deliveries, duplicate packets, no error correction • If packets are lost, IP does not try to recover or retransmit (though lower or higher layer functionalities may do so) • Global addressing scheme ECE 4450:427/527

  6. IPv4: Packet Format 4-bit Header Length 8-bit Type of Service (TOS) 4-bit Version 16-bit Total Length (Bytes) 3-bit Flags 16-bit Identification 13-bit Fragment Offset 8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Options (if any) Payload ECE 4450:427/527

  7. IP Packet Format • Version number (4 bits) • Indicates the version of the IP protocol • Necessary to know what other fields to expect • Typically “4” (for IPv4), and sometimes “6” (for IPv6) • Header length (4 bits) • Number of 32-bit words in the header • Typically “5” (for a 20-byte IPv4 header) • Can be more when “IP options” are used • Type-of-Service (8 bits) • Allow packets to be treated differently based on needs • E.g., low delay for audio, high bandwidth for bulk transfer ECE 4450:427/527

  8. IP Packet Format • Total length (16 bits) • Number of bytes in the packet • Maximum size is 63,535 bytes (216 -1) • … though underlying links may impose harder limits • Fragmentation information (32 bits) • Packet identifier, flags, and fragment offset • Supports dividing a large IP packet into fragments • … in case a link cannot handle a large IP packet • Time-To-Live (8 bits) • Used to identify packets stuck in forwarding loops • … and eventually discard them from the network ECE 4450:427/527

  9. Time-to-Live (TTL) • Potential robustness problem • Forwarding loops can cause packets to cycle forever • Confusing if the packet arrives much later • Time-to-live field in packet header • TTL field decremented by each router on the path • Packet is discarded when TTL field reaches 0… • …and “time exceeded” message is sent to the source ECE 4450:427/527

  10. Protocol Field • Protocol (8 bits) • Identifies the higher-level protocol • E.g., “6” for the Transmission Control Protocol (TCP) • E.g., “17” for the User Datagram Protocol (UDP) • Important for demultiplexing at receiving host • Indicates what kind of header to expect next protocol=6 protocol=17 IP header IP header TCP header UDP header ECE 4450:427/527

  11. IP Addresses Field • Two IP addresses • Source IP address (32 bits) • Destination IP address (32 bits) • Destination address • Unique identifier for the receiving host • Allows each node/router to make forwarding decisions • Source address • Unique identifier for the sending host • Recipient can decide whether to accept packet • Enables recipient to send a reply back to source ECE 4450:427/527

  12. IP Fragmentation and Reassembly • Each network has some MTU (Maximum Transmission Unit): largest IP datagram it can carry in a frame • Ethernet (1500 bytes), FDDI (4500 bytes) • Strategy • Fragmentation occurs in a router when it receives a datagram that it wants to forward over a network which has (MTU < received datagram) • Reassembly is done at the receiving host • All the fragments carry the same identifier in the Ident field • Fragments are self-contained datagrams • IP does not recover from missing fragments ECE 4450:427/527

  13. IP Fragmentation and Reassembly IP datagrams traversing the sequence of physical networks ECE 4450:427/527

  14. IP Fragmentation and Reassembly Header fields used in IP fragmentation. (a) Unfragmented packet; (b) fragmented packets. ECE 4450:427/527

  15. IP Datagram Forwarding • Strategy • every datagram contains destination's address • if directly connected to destination network, then forward to host • if not directly connected to destination network, then forward to some router • forwarding table maps network number into next hop • each host has a default router • each router maintains a forwarding table ECE 4450:427/527

  16. Forwarding Table ECE 4450:427/527

  17. IPv4 Addressing 00001100 00100010 10011110 00000101 A unique 32-bit number Identifies an interface (on a host, on a router, …) Represented in dotted-quad notation 12 34 158 5 ECE 4450:427/527

  18. IPv4 Addressing • A host usually has a single link into network: When IP in host wants to send datagram, it does so over the link -> Boundary between host and link: interface. • IP address: technically associated with an interface, rather with the host • How about a router? • Receive datagram on a link and forward to on some other link. • How many interfaces? How many IP addresses? ECE 4450:427/527

  19. IPv4: Early Addressing • Properties • globally unique • hierarchical: network + host • 4 Billion IP address, half are A type, ¼ is B type, and 1/8 is C type • Format • Dot notation • 10.3.2.4 • 128.96.33.81 • 192.12.69.77 ECE 4450:427/527

  20. 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 host part subnet part 11001000 0001011100010000 00000000 200.23.16.0/23 ECE 4450:427/527

  21. Subnets 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 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 ECE 4450:427/527

  22. Subnet and Subnet Mask 223.1.1.0/24 223.1.2.0/24 223.1.3.0/24 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. Subnet mask: /24 Or 255.255.255.000 ECE 4450:427/527

  23. Subnets 223.1.1.2 How many? 223.1.1.1 223.1.1.4 223.1.1.3 223.1.7.0 223.1.9.2 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 ECE 4450:427/527

  24. ARP: Address Resolution Protocol Question: how to determine MAC address of B knowing B’s IP address? • Each IP node (host, router) on LAN has ARP table in ARP module • ARP table: IP/MAC address mappings for some LAN nodes < IP address; MAC address; TTL> • TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min) 137.196.7.78 1A-2F-BB-76-09-AD 137.196.7.23 137.196.7.14 LAN 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 137.196.7.88 ECE 4450:427/527

  25. ARP: Same LAN • A wants to send datagram to B, and B’s MAC address not in A’s ARP table. • A broadcastsARP query packet, containing B's IP address • dest MAC address = FF-FF-FF-FF-FF-FF • all machines on LAN receive ARP query • B receives ARP packet, replies to A with its (B's) MAC address • frame sent to A’s MAC address (unicast) • A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) • ARP is “plug-and-play”: • nodes create their ARP tables without intervention from net administrator ECE 4450:427/527

  26. ARP: Packet Format • HardwareType: type of physical network (e.g., Ethernet) • ProtocolType: type of higher layer protocol (e.g., IP) • HLEN & PLEN: length of physical and protocol addresses • Operation: request or response • Source/Target Physical/Protocol addresses ECE 4450:427/527

  27. Addressing: Routing to another LAN 111.111.111.110 E6-E9-00-17-BB-4B B 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F walkthrough: send datagram from A to B via R. • focus on addressing - at both IP (datagram) and MAC layer (frame) • assume A knows B’s IP address • How can A know whether B is in the same subnet/network? • assume A knows B’s MAC address (how?) • assume A knows IP address of first hop router, R (how?) • assume A knows MAC address of first hop router interface (how?) – How many MAC addresses? A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D ECE 4450:427/527

  28. Addressing: Routing to another LAN MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy 111.111.111.110 E6-E9-00-17-BB-4B B 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F • A creates IP datagram with IP source A, destination B • A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D ECE 4450:427/527

  29. Addressing: Routing to another LAN MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP Eth Phy IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy 111.111.111.110 E6-E9-00-17-BB-4B B 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F • frame sent from A to R • frame received at R, datagram removed, passed up to IP A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D ECE 4450:427/527

  30. Addressing: Routing to another LAN IP Eth Phy MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP Eth Phy IP src: 111.111.111.111 IP dest: 222.222.222.222 111.111.111.110 E6-E9-00-17-BB-4B B 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F • R forwards datagram with IP source A, destination B • R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D ECE 4450:427/527

  31. Addressing: Routing to another LAN IP Eth Phy MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP Eth Phy IP src: 111.111.111.111 IP dest: 222.222.222.222 111.111.111.110 E6-E9-00-17-BB-4B B 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F • R forwards datagram with IP source A, destination B • R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D ECE 4450:427/527

  32. Addressing: Routing to another LAN IP Eth Phy MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222 111.111.111.110 E6-E9-00-17-BB-4B B 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F • R forwards datagram with IP source A, destination B • R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D ECE 4450:427/527

  33. IP Addresses: How to get one? • MAC address: configured in adapter, globally unique • IP address: • Not only be unique on a given internetwork, but needs to reflect the structure of the internetwork • Not possible to be configured once into host; Hosts might change to another network: IP needs to be reconfigurable • Usually, automatic configuration methods are required: Dynamic Host Configuration Protocol (DHCP): Textbook, 3.2.7 ECE 4450:427/527

  34. A day in the life: Connecting to Internet browser DNS server Comcast network 68.80.0.0/13 school network 68.80.2.0/24 web page web server Google’s network 64.233.160.0/19 64.233.169.105 ECE 4450:427/527

  35. A day in the life: Connecting to Internet DHCP UDP IP Eth Phy DHCP UDP IP Eth Phy DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP • connecting laptop needs to get its own IP address, addr of first-hop router, addr of DNS server: use DHCP • DHCP request encapsulatedin UDP, encapsulated in IP, encapsulated in 802.1 Ethernet router (runs DHCP) • Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server • Ethernet demuxed to IP demuxed, UDP demuxed to DHCP ECE 4450:427/527

  36. A day in the life: Connecting to Internet DHCP UDP IP Eth Phy DHCP UDP IP Eth Phy DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP • DHCP server formulates DHCP ACK containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server • encapsulation at DHCP server, frame forwarded (switch learning) through LAN, demultiplexing at client router (runs DHCP) • DHCP client receives DHCP ACK reply Client now has IP address, knows name & addr of DNS server, IP address of its first-hop router ECE 4450:427/527

  37. A day in the life: ARP (before DNS, HTTP) ARP ARP Eth Phy ARP query ARP reply DNS UDP IP Eth Phy DNS DNS DNS • before sending HTTPrequest, need IP address of www.google.com:DNS • DNS query created, encapsulated in UDP, encapsulated in IP, encapsulated in Eth. In order to send frame to router, need MAC address of router interface: ARP • ARP query broadcast, received by router, which replies with ARP reply giving MAC address of router interface • client now knows MAC address of first hop router, so can now send frame containing DNS query ECE 4450:427/527

  38. NAT rest of Internet local network (e.g., home network) 10.0.0/24 10.0.0.1 10.0.0.4 10.0.0.2 138.76.29.7 10.0.0.3 Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual) All datagrams leaving local network have same single source NAT IP address: 138.76.29.7, different source port numbers ECE 4450:427/527

  39. NAT 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 ECE 4450:427/527

  40. NAT 3 2 1 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 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 ECE 4450:427/527

  41. NAT: Network Address Translation • NAT is controversial: • routers should only process up to layer 3 • violates end-to-end argument: Hosts should be talking directly with each other, without interfereing nodes modifying IP addresses and port numbers • Address shortage should instead be solved by IPv6 But like it or not, NAT becomes an important component of the Internet ECE 4450:427/527

More Related