Presentation on theme: "TCP/IP TCP/IP architecture"— Presentation transcript:
1 TCP/IP TCP/IP architecture IP (Internet Protocol) and ICMP (Internet Control Message Protocol)TCP (Transmission Control Protocol)/UDP (Used Datagram Protocol)Internet RoutingMulticast routingIPV6, DHCP (Dynamic Host Configuration Protocol) and mobile IP (if time is allowed)
2 TCP/IP is a suite of protocols Application protocols: HTTP, FTP, SMTP(over TCP) and SNMP, DNS (over UDP)ApplicationApplication2. TCP: connection-oriented whileUDP: connectionless3. IP: connectionless datagram, routing andpossible fragmentation, congestion controlTCPUDP4. Complementary protocols with IP: ICMP, ARP.5. Different physical networks.ICMPIPARPRARP6. IP provides best-effort connectionless service7. (Hierarchical) IP address. Intradomain andinterdomain routing, subnet, supernet.PhysicalnetworkFigure 8.1
3 4. In general, data link frames changes each hop. Header may contain other informationsuch as sequence number in TCP PDUs.HTTP Request2. Upper layer PDUs encapsulatedin lower layer PDUs, generallykeep unchanged during their travelingHeader contains source and destination port numbersTCP Header3. Some fields of IP datagram packets are modifiedduring its way to destination.Header contains: source and destination IP addresses; transport protocol typeIP Header4. In general, data link frames changes each hop.Header contains: source and destination physical addresses; network protocol typeFCSEthernet HeaderFigure 8.2
4 Machine AMachine BApplicationApplicationTransportRouter/GatewayTransportInternetInternetInternetNetwork InterfaceNetwork InterfaceNetwork InterfaceNetwork 1Network 21. Upper layer is just based on lower layer’s service, not implementation.2. Routers/gateways route packets from source to destination3. PDUs are passed down in sender, ups and downs in routers, up in receiver.Figure 8.3
5 IP protocol—the heart of TCP/IP architecture IP packetIP addressingSubnet addressingIP routingSupernetting –CIDR (Classless Interdomain Routing)Address resolution / Reverse address resolutionFragmentation / /reassemblyICMP (Internet Control Message Protocol).
6 IP version 4 headerVersion IHL Type of Service Total LengthIdentification Flags Fragment OffsetTime to Live Protocol Header ChecksumSource IP AddressDestination IP AddressOptions Padding0.Fixed length of 20 bytes and variable-length up to 40 byte options then data.1. Version: 4: current version, 5: real time stream packet (ST2), 6: IPng or IPv6.2. IHL (Internet Header Length) in unit of 32-bit words, 5 if no options.3. Type of Service: 3-bit priorities with 0 (normal) to 7 (control packet), 4 bits tags of requirements: delay, throughput, reliability, and cost. 1 unused bit.4. Total Length: header + data, maximum packet length:216-1 = bytes.5. Identification, Flags, Fragment Offset: used for fragmentation and reassembly.6. TTL (Time-to-Live): amount of time for a packet to live, mostly interpret as # of hops.7. Protocol: 6: TCP, 17: UDP, 1: ICMP 8. Header checksum: internet Checksum algorithm, only on header, whenever TTL change, checksum needed to be recomputed.9. Source & destination address. 10: options: security level, source routing, timestamps11: padding: make the header a multiple of 32-bit words.Figure 8.4
7 Router’s work for IPWhen network interface passes over IP packet to IP layerCompute the header checksum which is compared with the checksum in the header.If valid, IP entity updates TTL and recompute checksumLook up routing table to find next hopForward to the next hop.
8 IP addressing A computer may have multiple IP addresses 32 bit address with two level hierarchies:network ID + host IDRouting could be based on network IDs to reduce the size of routing tableNetwork Ids are assigned by Internet Network Information Center while host IDs are assigned by local network administrator.Five classes of networks and different number of bits for network IDs and host IDs.
9 Five classes of IP addresses Bit position:Class ANet IDHost IDClass B1 0Net IDHost IDClass CNet IDHost IDClass DMulticast addressClass EReserved for experiments1.Class A: 7 bit network ID and 24 bit host ID, so 126 networks & 16 million hosts per network.2.Class B: 14 bit network ID and 16 bit host ID, so networks & hosts per network.3. Class C: 21 bit network ID and 8 bit host ID, so 2 million networks and 254 hosts per network4. Class D: multicast addresses6. Class E: reserved.7. ID with all 1s or all 0s has special purpose. All 1s means broadcast, all 0s means this.Figure 8.5
10 IP address --IDs with all 1s and all 0s Network ID host IDall 1s all 1s broadcast to local networknot all 1s all 1s broadcast to the specified networkall 1s not all 1s broadcast to the specified host on all networks (?)all 0s all 0s this hostall 0s not all 0s the specified host on this networknot all 0s all 0s the specified network127.x.y.z: x, y, z could be anything. Used for loopback.When a host send a packet with this address, the packet will be returned to the host. Two usages: interprocess communication on a local host via TCP/IP ; debugging purpose.
11 IP address—dotted decimal notation Four bytes denoted as four decimal numbersClass A:toClass B:toClass C:totoClass D:Class E:to
12 Subnet addressingOriginaladdressSubnettedNet IDHost ID1 0Subnet IDClass B problems: a class B network (typical a university network) has about 64000hosts. Big burden on administrator. Moreover a campus may need multiple localnetworks.Therefore another hierarchical level: subnet.Advantage of subneting is that outside hosts still see the hosts within the networkas two levels.The length of subnet ID is variable. The subnet ID and its length is determined bysubnet mask.A subnet mask consists of all 1s in network ID and subnet ID but all 0s in host ID.Figure 8.6
13 Design of subnetsSuppose a university is assigned class B network:Assume this university has many LANs but each LAN has no more than 100 hosts.Therefore 7 bits for hosts are enough.As a result, 9 bits for subnetworks.The subnet mask will be, i.e.,If given a IP address: , find its subnet ID:i.e.,and==i.e.,The hosts within this subnet have IP addresses fromto
14 Address assignment with subnets and subnet routing To the rest ofthe Internet1.A site with class B IP address:2. Outside see all packets to any host withinthe network is to get the packets tonetwork3. Suppose a packet with arrive at R1 from outside:R1 finds the subnet first by doing the following:& =&= i.e.,R1 looks up its routing table for , which has the next hop: (R2)R1 forwards the packet to R2. R2 does similarly to find it is H5 and forwards to H5.Figure 8.7
15 IP routingIP entities in sender and routers work together to route a packet from source to destination.Sender’s IP entity first looks up its routing table. If the destination is directly connected to it by a link or a LAN, the sender sends the packet to the destination directlyOtherwise, the sender will send the packet to default router, which is directly connected to the sender.The router first check whether a packet is for itself. If yes, pass up to its upper layer. Otherwise look up its routing table to find the next hop and forward to the next hop.The routing table:Destination IP, next hop ID, outgoing interface, flagsFlags: H flag, H=1 to a host, H=0: to a networkG flag: G=1 to gateway, G=0: to destination
16 The order to search routing table For complete destination address, if found, then forward a packet according to next hop IP and flag G. OtherwiseFor destination network ID. otherwiseFor default router, otherwiseAn ICMP “host unreachable error” is sent back to the sender.
17 Routing table example: H5 (send an IP packet to )H1H2R1To the rest ofH3H4the InternetR2H5Destination next-hop flags interfaceH lo0Default G emd0emd0Figure 8.7
18 Routing example Suppose H5’s routing table Destination next-hop flags interfaceH lo0Default G emd0emd0H5 will find default router and forward to itR2’s routing tableR2 uses default router to forward the packet.Destination next-hop flags interfaceH lo0Default G emd0emd1emd1
19 Routing example (cont.) R1’s routing tableDestination next-hop flags interfaceH lo0emd0emd1G emd1R2 find the entry for destination IP: and sends out to emd0.
20 CIDR: classless interdomain routing Historical story:1987, a few visionaries predicted: 100,000 networks someday, most experts pooh-poohed.100,000th network connected in 1996.Problem: IP addresses soon run out of availability.classful addresses wastes millions of address spaceThree bears problem: A too large, C too small, need class BBut class B is still too large for many organizations.Solution: CIDR (Classless InterDomain Routing)Allocate remaining class C networks in variable-size blocks.Examples: if a organization needs 2000 hosts, then allocate it a block of addresses, i.e., 8 contiguous class C networks. If need 8000 hosts, then allocate a block of 8192 addresses, i.e., 32 contiguous class C networks.
21 CIDR: classless interdomain routing (cont.) Suppose an organization is allocated four contiguous class C networks:, , ,Question: how to treat these four contiguous networks as one from outside?Network mask which will mask out one common prefix for these four networks.Question: what is the network mask for these four networks?The common prefix:Therefore, network mask: , i.e.,In routing table, instead of putting all four networks entries, just put one entry:/22, where 22 indicates the network mask is 22 bits.CIDR is also called supernetting because it “supernets” multiple networks into one.
22 A few discussions about CIDR it is possible that both supernet /22 and /20 appear in the routing table.Therefore, the IP address will match both of them.Solution: longest prefix match will match /22.A prefix of arbitrary length, along with the network mask of the same length, indicates a network number.The multiple contiguous networks can not begin at a random class C network address but must begin at certain boundary.E.g., 16 contiguous networks (i.e., 4096 addresses) can not begin at Instead, they must lie on a 4096-byte boundary. Such as begin from throughGo to Tanenbaum for more discussion.
23 Fragmentation and Reassembly MTU (maximum transmission unit): a network generally has its MTUEthernet: 1500 bytes, FDDI: 4464 bytesFragmentation an IP packet if it is larger than MTUReassembly all packets of an IP packet into the original IP packet at receiver.
24 Packet fragmentation Fragmentation takes place at the sender / routers SourceRouterDestinationIPIPNetworkNetworkFragmentation takes place at the sender / routersReassembly takes place at the receiver.Figure 8.9
25 Fragmentation fields in IP header Identification (16 bits): identify which IP packet a particular fragment belongs to. Unique regarding IP packets destined to the same host.Flags (3 bits): one unused, one is “don’t fragment” (DF) bit, another is “more fragment” (MF). When DF is 1, then the IP packet is not allowed to fragment. At this time, if the packet is longer than the underlying MTU, then the packet will be discarded and an error will be sent to source.Offset (13 bits): indicate the location of a fragment in a packet. Since maximum IP packet length is 216, the offset is in the unit of 216/213 =8 bytes.In summary: an IP packet with DF=0 is fragmented into several fragments with the same identification, all of which set MF=1 except the last fragment which keeps its IP packet’s MF. The receiver will reassembly all these segments with the same identification into its original IP packet based on the three fields in these fragments.
26 Example—fragment a IP packet Suppose a packet of 20 header plus 1484 data arrives at an X.25network having an MTU of 576 bytes, do the fragmentation.Analysis: maximum fragment=576-20=556 bytes.556 is not the multiple of 8, thus set data length to 552.break 1484 into Therefore 3 fragments.Total length ID MF OffsetxxxxOriginal packetFragment 1Fragment 2Fragment 3
27 Further segmentation Suppose the next network has MTU 324. So data is =304, which is a multiple of 8Fragment 1: xFragment 11: xFragment 12: xFragment 2: xFragment 21: xFragment 22: xFragment 3: xFragment 31: xFragment 32: x
28 A few words about fragmentation Question: Do all the fragments travel along the same path?NO.Question: can reassembly be done by routers, not by receiver?NO.Because fragments will travel along possible different paths,a router can not get all the fragments corresponding a packet2. Even it happens that all the fragments arrive at the same router whichcan reassembly them, it is possible that the reassembled packet befragmented again.3. Fragmentation is easy but reassembly is difficult because the fragmentsmay arrive out of order, letting routers do reassembly will make routerscomplicated, thus violate IP motivation and end-to-end argument.Fragmentation results in subtle performance penalty: if any fragment lost or error,All fragments needs to be retransmitted.
29 Address Resolution –ARP (Address Resolution Protocol) H1H2H3H4ARP request (what is the MAC address of ?)ARP response (my MAC address is A-C5-3B-94)The way for a host to find the physical address for a IP address.Suppose H1 wants to find the physical address of H3:1. H1 broadcasts a ARP request: what is the MAC address of ?2. (only) H3 gives ARP response: my MAC address is A-C5-3B-94.H1 will cache H3’s MAC address for future use. Timer is needed to remove the cachedpair of IP and MAC addresses after certain time in case of MAC address change.Figure 8.8
30 RARP---Reverse Address Resolution Protocol The MAC address of a host may be known, but the IP address is not.E.g., a diskless computer at boot time can read its MAC address but does not know its IP address, which is stored at a server.RARP: getting IP address of a MAC address.The host broadcasts a RARP request: what is the IP address of such a MAC addressThe server containing the IP address gives RARP response: the IP address of such a MAC address is so so.
31 ICMP: Intenet Control Message Protocol Deal with error and control messagesICMP messages are encapsulated in IP packet, but ICMP is considered in the same layer as IP.Some message types: echo request/reply, timestamp request/reply, destination unreachable, source quench, redirect, time exceeded, parameter problemExamples:echo request/reply is used by ping program.Time exceeded message is used in traceroute program:Source host (running traceroute) sends messages to the destination with TTL incremented by one per message, beginning from 1.When a message arrive at a router and its TTL =0, the router will send a time exceeded message back to source host, with the router included in the message.