410 likes | 540 Views
An Introduction to Computer Networks. Lecture 8: Internetworking. University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani. Outline. Internetworking Best Effort Service Model Segmentation and Reassembly (SAR) Global Addressing Scheme Packet forwarding.
E N D
An IntroductiontoComputer Networks Lecture 8: Internetworking University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Introduction to Computer Network
Outline • Internetworking • Best Effort Service Model • Segmentation and Reassembly (SAR) • Global Addressing Scheme • Packet forwarding. Introduction to Computer Network
Internetworking • Communication between networks, either directly connected or switched • Problems: • Different Networking technologies (Heterogeneity). • So many Networks (Scaling). • Surviving in case of failure. • Different services • etc., • Some terminologies: • “internetworking” refer to an arbitrary collection of connected networks. • “Internet” the global internetwork. Introduction to Computer Network
Goals of the DARPA project • Connect existing networks • initially ARPANET and ARPA packet radio network • Survivability • ensure communication service even in the presence of network and router failures • Support multiple types of services • Must accommodate a variety of networks • Allow distributed management • Allow host attachment with a low level of effort • Allow resource accountability Introduction to Computer Network
IP Internet • Concatenation of Networks or “networks of Networks”. • “R” is routers and “H” is hosts. Network 1 (Ethernet) H7 R3 H8 H2 H1 H3 Network 4 Network 2 (Ethernet) (point-to-point) R1 R2 H4 Network 3 (FDDI) H5 H6 Introduction to Computer Network
IP Internet (cont) • Protocol Stack • Everything is running on top of IP, “IP over everything” H1 H8 TCP TCP R2 R3 R1 IP IP IP IP IP FDDI PPP ETH ETH ETH FDDI PPP ETH Introduction to Computer Network
Service Model • Connectionless (datagram-based) • Best-effort delivery (unreliable service) • packets are lost. No recover from lost. • packets are delivered out of order • duplicate copies of a packet are delivered • packets can be delayed for a long time • Datagram format 0 4 8 16 19 31 TOS Length Version HLen Ident Flags Offset TTL Protocol Checksum • Contains all information • for routing of a packet. SourceAddr DestinationAddr Pad Options (variable) (variable) Data Introduction to Computer Network
Packet Headers • The current Version is 4 or IPv4. • HLen- the Header Length: from 5-15 in 32-bit words. • Length- the total length of the packet including headers. Max length is 64K. • TTL: Time To Live is expressed in second. It is to prevent packet from permanently circulating in a loop. • Protocol: specify the packet application ex. 1 for ICMP. It is for demultiplexing to higher layer protocols. • Checksum: is a 1-complement error checksum for the header only. Introduction to Computer Network
Packet Headers (Cont) • TOS: type of Service • Precedence Specify the priority • Type of Services Specify routing, for instance cheapest, fastest and more reliable • D for Delay • T for Throughput • R for Reliability • C for low cost. • Note: Precedence is only for inside channel queuing. Introduction to Computer Network
Packet Headers (Cont) • Options If C set, the option will copied to all fragments. Otherwise, only to the first one. • Class 0 for control • Class 2 for debugging and measurement. Options are rarely used in today except for ‘loose’ and ‘strict’ source routing parameters. ‘loose’ and ‘strict’ source option sometimes, is used for IP encapsulation in another IP or “Tunneling” Introduction to Computer Network
Fragmentation and Reassembly • Flags • DF: Don’t Fragment • MF: More Fragment coming In fragmentation, IP copy the original header and only modify The length, which is the new length, and offset. Offset is used for reassembly. • Note: Fragmentation may degrade the network performance. That is why the IP packet should be the same of TCP packets Modern TCP implement “Path MTU discovery”. It start with large packet and with DF set flag, if it passed TCP keeps the same packet size, otherwise, it reduces it. Introduction to Computer Network
Fragmentation and Reassembly (cont) • Each network has a Maximum Transfer Unit size, MTU • Strategy • fragment when necessary (MTU < Datagram) • try to avoid fragmentation at source host • re-fragmentation is possible • fragments are self-contained datagrams • use CS-PDU (not cells) for ATM • delay reassembly until destination host • do not recover from lost fragments Introduction to Computer Network
H1 R1 R2 R3 H8 ETH IP (1400) FDDI IP (1400) PPP IP (512) ETH IP (512) PPP IP (512) ETH IP (512) PPP IP (376) ETH IP (376) Example • Packet delivery from host H1 to host H8 Introduction to Computer Network
Start of header Ident = x Offset = 0 0 Rest of header 1400 data bytes Start of header Ident = x 1 Offset = 0 Rest of header 512 data bytes Start of header Ident = x 1 Offset = 512 Rest of header 512 data bytes Start of header Ident = x 0 Offset = 1024 Rest of header 376 data bytes Example (cont) The packets are fragmented as: Introduction to Computer Network
Addressing • Each host in the network is identified by an address having the following property. • globally unique • hierarchical: network + host • Address Classes • Class D for Multicasting • Class E for experiments • Address Notation • 10.3.2.4 • 128.96.33.81 • 192.12.69.77 7 24 Network A: 0 Host 14 16 B: 1 0 Network Host 21 8 C: 1 1 0 Network Host Introduction to Computer Network
IP Addresses • Example: • Class “A” address www.mit.edu • 18.181.0.31 • (18<128 => Class A) • Class “B” address mekong.stanford.edu • 171.64.74.155 • (128<171<128+64 => Class C) www.ece.ut.ac.ir • 194.225. Introduction to Computer Network
Addressing in IP • IP addresses are names of interfaces • Domain Name System (DNS) names are names of hosts • DNS binds host names to interfaces • Routing binds interface names to paths Introduction to Computer Network
How to assign IP Addresses? • Manually • Uniqueness • Too much and tedious job • Dynamically: use DHCP: Dynamic Host Configuration Protocol. Introduction to Computer Network
Making a Forwarding Decision IP Address Space Class A Class B Class C D Class A Routing Table: Class B 212.17.9.4 Exact Match Class C 212.17.9.0 Port 4 212.17.9.0 Introduction to Computer Network
Forwarding Datagrams • Every datagram contains a destination address. • “Network ID” uniquely identifies a physical network. • All hosts and routers sharing a Network ID share same physical network. Introduction to Computer Network
Forwarding an IP Router • Lookup packet DA in forwarding table. • If known, forward to correct port. • If unknown, drop packet. • Decrement TTL, update header Checksum. • Forward packet to the outgoing interface. • Transmit packet onto link. Introduction to Computer Network
Address Translation • Map IP addresses into physical addresses • destination host • next hop router • Techniques • encode physical address in host part of IP address • table-based • ARP • table of IP to physical address bindings • broadcast request if IP address not in table • target machine responds with its physical address • table entries are discarded if not refreshed Introduction to Computer Network
ARP Details • Request 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 • Notes • table entries timeout in about 10 minutes • update table with source when you are the target • update table if already have an entry • do not refresh table entries upon reference Introduction to Computer Network
0 8 16 31 Hardware type = 1 ProtocolT ype = 0x0800 HLen = 48 PLen = 32 Operation SourceHardwareAddr (bytes 0 – 3) SourceHardwareAddr (bytes 4 – 5) SourceProtocolAddr (bytes 0 – 1) SourceProtocolAddr (bytes 2 – 3) TargetHardwareAddr (bytes 0 – 1) T argetHardwareAddr (bytes 2 – 5) T argetProtocolAddr (bytes 0 – 3) ARP Packet Format • HLen = Hardware Address Length • PLen = Protocol Address Length Introduction to Computer Network
Internet Control Message Protocol (ICMP) • Echo (ping) • Redirect (from router to source host) • Destination unreachable (protocol, port, or host) • TTL exceeded (so datagrams don’t cycle forever) • Checksum failed • Reassembly failed • Cannot fragment Introduction to Computer Network
Tunneling • Big companies having different networks want to connect them together. • Virtual Private Network (VPN) • Use leased line to connect networks. • Use Internet (Shared line). • Sloution • Encapsulate packets in R1 in IP packets for destination R2. Internet R2 Network 2 Network 1 R1 Virtual line Introduction to Computer Network
IP Address Problem (1991) • Inefficient use of Hierarchical Address Space • class C with 2 hosts (2/255 = 0.78% efficient) • class B with 256 hosts (256/65535 = 0.39% efficient) • Address space depletion • In danger of running out of classes A and B • Class C too small for most domains • Very few class A – IANA (Internet Assigned Numbers Authority) very careful about giving • Class B – greatest problem Introduction to Computer Network
Solutions for IP Address • Better utilize address space • Subnetting • Supperneting • Locally use unofficial IP addresses (NATing) • Use wider IP addresses • New version of IP, IPv6. Introduction to Computer Network
Subnetting • Add another level to address/routing hierarchy: subnet • Subnet masks define variable partition of host part • Subnets visible only within site Network number Host number Class B address 0000000000000000 1111111111111111111 Subnet mask (255.255.0.0) Network number Subnet ID Host ID Subnetted address Introduction to Computer Network
Net host Subnet mask: 255.255.255.128. Subnet number: 128.96.34.0 111….1.0xxx….x 128.96.34.15 128.96.34.1 H1 R1 Subnet mask: 255.255.255.128 128.96.34.130 Subnet number: 128.96.34.128 128.96.34.139 128.96.34.129 H2 R2 H3 128.96.33.1 128.96.33.14 Subnet mask: 255.255.255.0 Subnet number: 128.96.33.0 Subnet Example Subnet Forwarding table at router R1 Subnet # Subnet Mask Next Hop 128.96.34.0 255.255.255.128 interface 0 128.96.34.128 255.255.255.128 interface 1 128.96.33.0 255.255.255.0 R2 Introduction to Computer Network
Forwarding Algorithm D = destination IP address for each entry (SubnetNum, SubnetMask, NextHop) D1 = SubnetMask & D if D1 = SubnetNum if NextHop is an interface deliver datagram directly to D else deliver datagram to NextHop • Use a default router if nothing matches • Not necessary for all 1s in subnet mask to be contiguous • Can put multiple subnets on one physical network • Subnets not visible from the rest of the Internet Introduction to Computer Network
Supernetting • Assign block of contiguous network numbers to nearby networks • Called CIDR: Classless Inter-Domain Routing • Represent blocks with a single pair (first_network_address, count) • Restrict block sizes to powers of 2 • Use a bit mask (CIDR mask) to identify block size • All routers must understand CIDR addressing Introduction to Computer Network
IP Address Utilization (‘98) http://www.caida.org/outreach/resources/learn/ipv4space/ Introduction to Computer Network
142.12/19 Classless AddressingCIDR Class-based: A B C D 0 232-1 Classless: 128.9.0.0 65/8 128.9/16 0 232-1 216 128.9.16.14 Introduction to Computer Network
128.9.19/24 128.9.25/24 128.9.16/20 128.9.176/20 Most specific route = “longest matching prefix” Classless AddressingCIDR 128.9/16 0 232-1 128.9.16.14 Introduction to Computer Network
Forwarding Datagrams 128.17.20.1 e.g. 128.9.16.14 => Port 1 R2 Prefix Next-hop Port 3 65/8 128.17.16.1 R1 R3 1 2 128.9/16 128.17.14.1 2 1 128.9.16/20 128.17.14.1 3 7 128.9.19/24 128.17.10.1 128.9.25/24 128.17.14.1 2 R4 128.9.176/20 128.17.20.1 1 142.12/19 128.17.16.1 3 128.17.16.1 Introduction to Computer Network
Requires Routing Table Default Routing Default Routing Default Routing R1 R2 R3 R4 R5 Introduction to Computer Network
Inside a Router 3. 1. Output Scheduling 2. Forwarding Table Interconnect Forwarding Decision Forwarding Table Forwarding Decision Forwarding Table Forwarding Decision Introduction to Computer Network
NAT: Network Address Translation • IP addresses need to be unique when we are going outside of our network. • We can use whatever IP address as long as we are functioning inside our own network. Introduction to Computer Network
IP Version 6 • Features • 128-bit addresses (classless) • multicast • real-time service • authentication and security • autoconfiguration • Any cast address • protocol extensions • Header • 40-byte “base” header • extension headers (fixed order, mostly fixed length) • No fragmentation • source routing • authentication and security • other options Introduction to Computer Network
IPV6: Packet format • Next header: IP option and protocol fields in IPv4. If options (i.e. fragmentation) indicated by this field, otherwise, it is protocol fields. 0 4 16 24 31 12 FlowLabel Version TrafficClass PayloadLen NextHeader HopLimit SourceAddr (16 bytes) … DestinationAddr (16 bytes) … Next header/ Data Introduction to Computer Network