TCP/IP and OSI Model Lecture 9 IP Kuang-hua Chen Department of Library and Information Science National Taiwan University Network Access layer This layer corresponds to the Physical and Data Link layers of the OSI model. TCP/IP has been shown to run over almost any type of network connection from FDDI to radio wave. Internet layer This layer roughly matches up with the Network layer of the OSI model. Both of these layers are responsible for moving data to other devices on the network. 9-2 TCP/IP and OSI Model (Continued) TCP/IP and OSI Model (Continued) Host-to-Host layer This one is similar to the Transport layer of the OSI model. The job of these layers is to communicate between peers on the network. Almost all devices on a TCP/IP network are considered hosts. Process/Application layer The fourth layer does the same job as the top three layers of the OSI model. Provide network services RIP OSPF 9-3 9-4 The Internet IP Addressing 9-5 9-6 1
IP Address Format Special IP Address 9-7 9-8 TCP/IP Suite TCP/IP Suite (Continued) Internet Protocol (IP) Internet Control Message Protocol (ICMP) RIP and OSPF Transmission Control Protocol (TCP) User Datagram Protocol (UDP) Address Resolution Protocol (ARP) Domain Name System (DNS) File Transfer Protocol Simple Mail Transfer Protocol Dynamic Host Configuration Protocol Telnet Network File System 9-9 9-10 Internet Protocol Internet Protocol (Continued) The Internet Protocol (IP) is a connectionless protocol that sits in the Network layer level of the OSI model. The job of IP is to address and route packets accordingly through the network. An IP header is attached to each packet and includes the source address, destination address, and other information used by the receiving host. Another job of IP is to fragment and reassemble packets that were split up in transit. The packet is split up, and then each piece gets a new IP header and is sent on its way to the final destination. When the final host receives the packets, it is up to IP to put all the pieces back together to form the original data. 9-11 9-12 2
Internet Layer IP Header IP Header Contains: Source IP Address (32 bits) Destination IP Address (32 bits) Total size of the datagram (including the data) Protocol Version Protocol Type (TCP or UDP) A few others... The header is followed by a block of data 9-13 9-14 Type of Service Example of Fragmentation Priority Delay Throu ghput Reliabi lity Reserve In theory, {D,T,R} fields allow routers to make choices A satellite link with high throughput and high delay A leased line with low throughput and low delay In practice, current routers ignore Type of Service fields A datagram with 636 data bytes arrives at a network with a maximum length restriction of 256 bytes (including header) Assume the IP header length is the minimum possible of 20 bytes Two possible fragmentations Each fragment except for the last is the maximum length possible All fragments are as nearly equal in length as possible 9-15 9-16 First Approach to Fragmentation (1/2) First Approach to Fragmentation (2/2) The maximal data length of the network is 256 20 = 236 The data length has to be the multiple of 8 bytes 29*8=232 < 236 The length of data to be sent is 636 = 232 + 232 + 172 3 fragments are created for transmission First fragment Total Length = 252 (20+232) Fragment Offset = 0 Second fragment Total Length = 252 (20+232) Fragment Offset = 29 ( 8 bytes ) Third fragment Total Length = 192 (20+172) Fragment Offset = 58 More = 0 9-17 9-18 3
Second Approach to Fragmentation (1/2) Header Checksum 636/3= 212, 216=27*8 bytes, 208=26*8 bytes, and 212 bytes First fragment Total Length = 236 (20+216) Fragment Offset = 0 Second fragment Total Length = 228 (20+208) Fragment Offset = 27 Third fragment Total Length = 232 (20+212) Fragment Offset = 53 More = 0 Header checksum is used to make sure no header information has been changed during transmission The sender sum every 16 bits in header The result is represented in one s complement and put in field of header checksum The receiver then sum every 16 bits in header The result has to be zero (1111111111111111) 9-19 9-20 One s Complement Notation Fragmentation on-the-road n is maximal bits used to represent integer -k = (2 n -1)-k = 11111111 (n bits) k Assume n = 8-6 = (2 8-1) 6 = 11111111 00000110 =11111001 00000000 2 is 0 10 11111111 2 is 0 10 Maximum Transmission Unit (MTU) consideration All machines are required to accept fragments of 576 bytes at least H1 Net1 (MTU=1500) R Net1 (MTU=1000) H2 9-21 9-22 Fragmentation on-the-road (continued) IP Options IP Header Data 1 Data 2 Data 3 IP Header Data 1 IP Header Data 2 IP Header Data 3 Security Specifies how secret the datagram is Strict source routing Gives the complete path to be followed Loose source routing Gives a list of routers not to be missed Record route Makes each router append its IP address Timestamp Makes each router append its IP address and timestamp 9-23 9-24 4
RIP and OSPF Routing Information Protocol (RIP) and Open Shortest Path First (OSPF) are two routing protocols in the Internet Protocol suite. RIP uses the number of routers (hops) between the originating computer and the destination to decide the best way to route a packet. OSPF uses much more information than just the number of hops to make a decision. The hop count, the speed of the connection between the hops, and the load balancing to calculate the best way to route packets. Internet Control Message Protocol The Internet Control Message Protocol (ICMP) provides error reporting for IP. Some common types of errors that ICMP can report are Destination Unreachable, Congestion, Echo Request, and Echo Reply (used with the PING command). 9-25 9-26 Principal ICMP Message Types Address Resolution Protocol Data link layer serves the network layer but it does not know the IP address ARP maps IP address to MAC address Maintain a configuration file to map IP address to MAC address 9-27 9-28 IP Address MAC Address 9-29 5