410 likes | 420 Views
Data Communication and Networks. Lecture 8 Internet Protocols October 31, 2002 Joseph Conron Computer Science Department New York University conron@cs.nyu.edu. millions of connected computing devices: hosts, end-systems pc’s workstations, servers PDA’s phones, toasters
E N D
Data Communication and Networks Lecture 8 Internet Protocols October 31, 2002 Joseph Conron Computer Science Department New York University conron@cs.nyu.edu
millions of connected computing devices: hosts, end-systems pc’s workstations, servers PDA’s phones, toasters running network apps communication links fiber, copper, radio, satellite routers: forward packets (chunks) of data thru network What’s the Internet: Components view
protocols: control sending, receiving of msgs e.g., TCP, IP, HTTP, FTP, PPP Internet: “network of networks” loosely hierarchical public Internet versus private intranet Internet standards RFC: Request for comments IETF: Internet Engineering Task Force What’s the Internet: Components view
communication infrastructure enables distributed applications: WWW, email, games, e-commerce, database., voting, more? communication services provided: connectionless connection-oriented What’s the Internet: a service view
roughly hierarchical national/international backbone providers (NBPs) e.g. BBN/GTE, Sprint, AT&T, IBM, UUNet interconnect (peer) with each other privately, or at public Network Access Point (NAPs) regional ISPs connect into NBPs local ISP, company connect into regional ISPs local ISP local ISP NAP NAP Internet structure: network of networks regional ISP NBP B NBP A regional ISP
Connectionless Operation • Corresponds to datagram mechanism in packet switched network • Each NPDU treated separately • Network layer protocol common to all DTEs and routers • Known generically as the internet protocol • Internet Protocol • One such internet protocol developed for ARPANET • RFC 791 (Get it and study it) • Lower layer protocol needed to access particular network
Connectionless Internetworking • Advantages • Flexibility • Robust • No unnecessary overhead • Unreliable • Not guaranteed delivery • Not guaranteed order of delivery • Packets can take different routes • Reliability is responsibility of next layer up (e.g. TCP)
REVIEW:Layered protocol model of computer networks • Reduce complexity by "layering" protocols • Solve at most a few challenges in each layer • E.g. • Lower layer eliminates all physical noise errors • Upper layer resends lost messages • Each layer offers services to the layer above • Enable improvements to PART of the network
Layers And Protocol Software • Protocol software follows layering model • One software module per layer • Modules cooperate • Incoming or outgoing data passes from one module to another • Entire set of modules known as stack
Why layering? Dealing with complex systems: • explicit structure allows identification, relationship of complex system’s pieces • layered reference model for discussion • modularization eases maintenance, updating of system • change of implementation of layer’s service transparent to rest of system • e.g., change in gate procedure doesn’t affect rest of system • layering considered harmful?
application: supporting network applications ftp, smtp, http transport: host-host data transfer tcp, udp network: routing of datagrams from source to destination ip, routing protocols link: data transfer between neighboring network elements ppp, ethernet physical: bits “on the wire” application transport network link physical Internet protocol stack
M M H H H H H H H H H H H H t t t t l n l t n n t n M M M M application transport network link physical application transport network link physical M M Protocol layering and data Each layer takes data from above • adds header information to create new data unit • passes new data unit to layer below source destination message segment datagram frame
Internet Protocol (IP) • Only protocol at Layer 3 • Defines • Internet addressing • Internet packet format • Internet routing • RFC 791 (1981)
IP Address Details • 32 Bits - divided into two parts • Prefix identifies network • Suffix identifies host • Global authority assigns unique prefix to network (IANA) • Local administrator assigns unique suffix to host
multicast address 1110 network host 110 network 10 host IP Addresses given notion of “network”, let’s examine IP addresses: “class-full” addressing: class 1.0.0.0 to 127.255.255.255 A network 0 host 128.0.0.0 to 191.255.255.255 B 192.0.0.0 to 223.255.255.255 C 224.0.0.0 to 239.255.255.255 D 32 bits
Classes and Network Sizes • Maximum network size determined by class of address • Class A large • Class B medium • Class C small
Subnets and Subnet Masks • Allow arbitrary complexity of internetworked LANs within organization • Insulate overall internet from growth of network numbers and routing complexity • Site looks to rest of internet like single network • Each LAN assigned subnet number • Host portion of address partitioned into subnet number and host number • Local routers route within subnetted network • Subnet mask indicates which bits are subnet number and which are host number
host part network part 11001000 0001011100010000 00000000 200.23.16.0/23 IP addressing: CIDR • classful addressing: • inefficient use of address space, address space exhaustion • e.g., class B net allocated enough addresses for 65K hosts, even if only 2K hosts in that network • CIDR:Classless InterDomain Routing • network portion of address of arbitrary length • address format: a.b.c.d/x, where x is # bits in network portion of address
Internet Packets • Contains sender and destination addresses • Size depends on data being carried • Called IP datagram • Two Parts Of An IP Datagram • Header • Contains source and destination address • Fixed-size fields • Data Area (Payload) • Variable size up to 64K • No minimum size
IP datagram format IP protocol version number 32 bits total datagram length (bytes) header length (bytes) type of service head. len ver length for fragmentation/ reassembly fragment offset “type” of data flgs 16-bit identifier max number remaining hops (decremented at each router) upper layer time to live Internet checksum 32 bit source IP address 32 bit destination IP address upper layer protocol to deliver payload to E.g. timestamp, record route taken, specify list of routers to visit. Options (if any) data (variable length, typically a TCP or UDP segment)
network links have MTU (max.transfer size) - largest possible link-level frame. different link types, different MTUs large IP datagram divided (“fragmented”) within net one datagram becomes several datagrams “reassembled” only 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 =4000 length =1040 length =1500 ID =x ID =x ID =x ID =x fragflag =0 fragflag =1 fragflag =0 fragflag =1 offset =0 offset =0 offset =1480 offset =2960 IP Fragmentation and Reassembly One large datagram becomes several smaller datagrams
IP Semantics • IP is connectionless • Datagram contains identity of destination • Each datagram sent/ handled independently • Routes can change at any time
IP Semantics (continued) • IP allows datagrams to be • Delayed • Duplicated • Delivered out-of-order • Lost • Called best effort delivery • Motivation: accommodate all possible networks
ICMP • Internet Control Message Protocol • RFC 792 (get it and study it) • Transfer of (control) messages from routers and hosts to hosts • Feedback about problems • e.g. time to live expired • Encapsulated in IP datagram • Not reliable
ICMP Packet Format • The first 4 bytes of the same format for all messages, the remainder differs from one message to the next 8-bit type 8-bit code 16-bit checksum contents depend on type and code
ICMP Error Messages • When an ICMP error message is sent, the message always contains the IP header and the first 8 bytes of the IP datagram that caused the problem • ICMP has rules regarding error message generation to prevent broadcast storms
ICMP Echo Command • Used by “ping” and “tracert” • When a destination IP host receives an ICMP echo command, it returns and ICMP “echo reply” • Ping uses this to determine if a path to a destination (and its return path) are “up” • Tracert uses echo in a clever way to determine the identities of the routers along the path (by “scoping” TTL).
ICMP Unreachable Error • Unreachable errors are generated for a number of reasons • network unreachable • host unreachable type (3) code (0-15) 16-bit checksum unused (must be 0) IP header (including options) + first 8 bytes of IP datagram data
ICMP Redirect Errors • The ICMP redirect error is sent by a router to a sender of an IP datagram when the datagram should have been sent to a different router.
Sending a Redirect • How can a router make this decision? • Assume a host sends an IP datagram to R1. This routing decision is often made because R1 is the default router • R1 receives the datagram and determines that R2 is the next-hop router • When it sends the datagram to R2, R1 detects that it is sending it out the same interface on which the datagram arrived. • R1 sends an ICMP redirect to the host, telling it to send future datagrams to that destination to R2
Address Resolution Problem • Suppose we know the IP Address of a local system (one to which we are connected) • We would like to send an IP packet to that system. • The link layer (ethernet, for instance) only knows about MAC addresses! • How do we determine the MAC address associated with the IP address?
ARP • Address resolution provides a mapping between two different forms of addresses • 32-bit IP addresses and whatever the data link uses • ARP (address resolution protocol) is a protocol used to do address resolution in the TCP/IP protocol suite (RFC826) • ARP provides a dynamic mapping from an IP address to the corresponding hardware address
ARP Protocol • A knows B's IP address, wants to learn physical address of B • A broadcasts ARP query pkt, containing B's IP address • all machines on LAN receive ARP query • B receives ARP packet, replies to A with its (B's) physical layer address • A caches (saves) IP-to-physical address pairs until information becomes old (times out) • soft state: information that times out (goes away) unless refreshed
ARP Cache • The cache maintains the recent IP to physical address mappings • Each entry is aged (usually the lifetime is 20 minutes) forcing periodic updates of the cache • ARP replies are often broadcast so that all hosts can update their caches
ARP Packet Format 8 16 31 Hardware Type Protocol Type Hardware Size Protocol Size Operation Sender’s Hardware Address (for Ethernet 6 bytes) Sender’s Protocol Address (for IP 4 bytes) Target Hardware Address Target Protocol Address Destination IP Address
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