Internet dan Jaringan Komputer PENGANTAR TCP/IP DAN ROUTING Dr. Tb. Maulana Kusuma mkusuma@staff.gunadarma.ac.id http://staffsite.gunadarma.ac.id/mkusuma Magister Manajemen Sistem Informasi 0 Internet Protocol (IP) Magister Manajemen Sistem Informasi 1 IP Addressing Basics Symbolic names are easier to remember a string, such as www.course.com, than a numeric address, such as 199.95.728—computers are the opposite They deal with network addresses in the form of bit patterns that translate into decimal numbers IP uses a three-part addressing scheme, as follows: Symbolic Logical numeric Physical numeric Magister Manajemen Sistem Informasi 2 IP Addressing Basics In keeping with the layered nature of network models, it makes sense to associate the MAC layer address with the Data Link layer (or TCP/IP Network Access layer, if you prefer to think in terms of that model), and to associate IP addresses with the Network layer (or the TCP/IP Internet layer) As data moves through intermediate hosts between the original sender and the ultimate receiver, it does so between pairs of machines, where each pair resides on the same physical network Magister Manajemen Sistem Informasi 3 IP Addressing Basics At the Network layer, the original sender’s address is represented in the IP source address field in the IP packet header, and the ultimate recipient’s address is represented in the IP destination address field in the same IP packet header The IP destination address value, in fact, is what drives the sometimes-long series of intermediate transfers, or hops, which occur as data makes its way across a network from sender to receiver Magister Manajemen Sistem Informasi 4 Anatomy of an IP Address Numeric IP addresses use dotted decimal notation when expressed in decimal numbers, and take the form n.n.n.n., in which n is guaranteed to be between zero and 255 for each and every value The numeric values in dotted decimal representations of numeric IP addresses are usually decimal values, but may occasionally appear in hexadecimal (base 16) or binary (base 2) notation Magister Manajemen Sistem Informasi 5 Anatomy of an IP Address Duplication of numeric IP addresses is not allowed because that would lead to confusion Also, there is a notion of “neighborhood” when it comes to interpreting numeric IP addresses Proximity between two numeric IP addresses (especially if the difference is only in the rightmost one or two octets) can sometimes indicate that the machines to which those addresses correspond reside close enough together to be on the same general network, if not on the same physical cable segment Magister Manajemen Sistem Informasi 6 IP Address Classes Initially, these addresses were further subdivided into five classes, from Class A to Class E For the first three classes of addresses, divide the octets as follows to understand how they behave: Class A n Class B n.n Class C n.n.n h.h.h h.h h If more than one octet is part of the network or host portion of the address, then the bits are simply concentrated to determine the numeric address Magister Manajemen Sistem Informasi 7 IP Address Classes The network portion of that address is 10, whereas the host portion is 12.120.2, treated as a three-octet number Address Classes D and E are for special uses Class D addresses are used for multicast communications, in which a single address may be associated with more than one network host machine This is useful only when information is broadcast to more than one recipient at a time so it should come as no surprise that video and teleconferencing applications, for example, use multicast addresses Magister Manajemen Sistem Informasi 8 More About Class A Addresses Expressed in binary form (ones and zeroes only), Class A addresses always take the form: 0bbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb The leading digit is always zero, and all other digits can be either ones or zeroes On any IP network, addresses consisting of all zeroes and all ones are reserved for special uses, so of those 128 possible network addresses, only those from 00000001 to 01111110 (or 1 to 126, in decimal terms) are considered usable Magister Manajemen Sistem Informasi 9 More About Class A Addresses The address for network 10 is reserved for private network use Also, by convention, the address 127.n.n.n is reserved for loopback testing (or checking the integrity and usability of a TCP/IP protocol stack installed on any computer Magister Manajemen Sistem Informasi 10 More About Class B Addresses Class B addresses always take the form: 10bbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb The leading two digits are 10, and the remaining digits can be either ones or zeroes RFC 1918 stipulates that 16 Class B addresses, from 172.16.0.0 to 172.32.255.255, are reserved for private use This means that the maximum number of public IP addresses for Class B is 16,382-16, or 16,366 Magister Manajemen Sistem Informasi 11 Class B Address Facts and Figures Magister Manajemen Sistem Informasi 12 More About Class C Addresses Class C addresses always take the form: 110bbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb The leading three digits are 110, and the remaining digits can be either ones or zeroes Note that this scheme reduces the total number of networks possible by the most significant three bits Magister Manajemen Sistem Informasi 13 More About Address Classes D and E Class D addresses always take the form: 1110bbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb Class E addresses always take the form: 11110bbb.bbbbbbbb.bbbbbbbb.bbbbbbbbb Class D is used for multicast addresses so that multiple users can “share” a single IP address and receive the same broadcast across a network from a single transmission Magister Manajemen Sistem Informasi 14 The Vanishing IP Address Space IP addresses were assigned for public use, they were assigned on a per-network basis With the ever-increasing demand for public IP addresses for Internet access, it should come as no surprise that, as early as the mid-1990s, experts began to predict that the Internet would “run out” of available IP addresses Magister Manajemen Sistem Informasi 15 The Vanishing IP Address Space The causes for concern have abated somewhat, Here’s why: The technocrats at the IETF introduced a new way to carve up the IP address space—Classless Inter-Domain Routing (CIDR) A brisk trade in existing IP network addresses sprung up during the same time RFC 1918 reserves three ranges of IP addresses for private use—a single Class A (10.0.0.0-10.255.255.255), 16 Class Bs (172.16.0.0-172.31.255.255), AND 256 Class Cs (192.168.0.0-192.168.255.255). When used in tandem with a technology called Network Address Translation (a.k.a NAT), private IP addresses can help lift the “cap” on public IP addresses Magister Manajemen Sistem Informasi 16 IP Networks, Subnets, and Masks If two network interfaces are on the same physical network, they can communicate directly with one another at the MAC layer In fact, each of the three primary IP address classes— namely A, B, and C—also has an associated default subnet mask Magister Manajemen Sistem Informasi 17 IP Subnets and Supernets A subnet mask is a special bit pattern that “blocks off” the network portion of an IP address with an all-ones pattern The reason why concepts like subnets and supernets are important for TCP/IP networks is because each of these ideas refers to a single “local neighborhood” on such a network, seen from a routing perspective Magister Manajemen Sistem Informasi 18 IP Subnets and Supernets Thus, a subnet mask that is larger than the default mask for the address in use divides a single network IP address into multiple subnetworks The network prefix identifies the number of bits in the IP address, counting from the left that represents the actual network address itself, and the additional two bits of subnetting represent the bits that were borrowed from the host portion of that IP address to extend the network portion Magister Manajemen Sistem Informasi 19 IP Subnets and Supernets The entire network address, including the network prefix and the subnetting bits, is called the extended network prefix This activity of stealing bits from the host portion of further subdivide the network portion of an address is called subnetting a network address, or subnetting Magister Manajemen Sistem Informasi 20 IP Subnets and Supernets When a computer on one subnet wishes to communicate with a computer on another subnet, traffic must be forwarded from the sender to a nearby IP gateway to send the message on its way from one subnet to another Supernetting takes the opposite approach: by combining contiguous network addresses, it steals bits from the network portion and uses them to create a single, larger contiguous address space for host addresses Magister Manajemen Sistem Informasi 21 Calculating Subnet Masks The simplest form of subnet masking uses a technique called constant-length subnet masking (CLSM), in which each subnet includes the same number of stations and represents a simple division of the address space made available by subnetting into multiple equal segments Another form of subnet masking uses a technique called variable-length subnet masking (VLSM) and permits a single address to be subdivided into multiple subnets, in which subnets need not all be the same size Magister Manajemen Sistem Informasi 22 Calculating Supernets Supernets “steal” bits from the network portion of an IP address to “lend” those bits to the host part As part of how they work, supernets permit multiple IP network addresses to be combined and make them function together as if they represent a single logical network Magister Manajemen Sistem Informasi 23 Classless Inter-Domain Routing (CIDR) CIDR gets its name from the notion that it ignores the traditional A, B, and C class designations for IP addresses, and can therefore set the network-host ID boundary wherever it wants to, in a way that simplifies routing across the resulting IP address spaces Magister Manajemen Sistem Informasi 24 Classless Inter-Domain Routing (CIDR) Creating a CIDR address is subject to the following limitations: All the addresses in the CIDR address must be contiguous When address aggregation occurs, CIDR address blocks work best when they come in sets that are greater than one, and equal to some lower-order bit pattern that corresponds to all ones CIDR addresses are commonly applied to Class C addresses To use a CIDR address on any network, all routers in the routing domain must “understand” CIDR notation Magister Manajemen Sistem Informasi 25 CIDR Notation CIDR notation of an IP address: 192.0.2.0/18 "18" is the prefix length. It states that the first 18 bits are the network prefix of the address (and 14 bits are available for specific host addresses) CIDR notation can replace the use of subnetmasks (but is more general) IP address 128.143.137.144 and subnetmask 255.255.255.0 becomes 128.143.137.144/24 CIDR notation allows to drop traling zeros of network addresses: 192.0.2.0/18 can be written as 192.0.2/18 Magister Manajemen Sistem Informasi 26 CIDR address blocks CIDR notation can nicely express blocks of addresses Blocks are used when allocating IP addresses for a company and for routing tables (route aggregation) CIDR Block Prefix /27 /26 /25 /24 /23 /22 /21 /20 /19 /18 /17 /16 /15 /14 /13 # of Host Addresses 32 64 128 256 512 1,024 2,048 4,096 8,192 16,384 32,768 65,536 131,072 262,144 524,288 Magister Manajemen Sistem Informasi 27 Public Versus Private IP Addresses The private IP address ranges may be expressed in the form of IP network addresses, as shown in Table 2-4 Private IP addresses have one other noteworthy limitation Magister Manajemen Sistem Informasi 28 Public Versus Private IP Addresses Some IP services require what’s called a secure end-toend connection—IP traffic must be able to move in encrypted form between the sender and receiver without intermediate translation Most organizations need public IP addresses only for two classes of equipment: Devices that permit organizations to attach networks to the Internet Servers that are designed to be accessible to the Internet Magister Manajemen Sistem Informasi 29 Managing Access to IP Address Information Although use of private IP addresses mandates NAT or a similar address substitutions or masquerade capability, some organizations elect to use address substitutions or masquerade even when they use perfectly valid public IP addresses on their internal networks Proxy servers can provide what is sometimes called reverse proxying This permits the proxy server to front for servers inside the boundary by advertising only the proxy server’s address to the outside world, and then forwarding only legitimate requests for service to internal servers for further processing Magister Manajemen Sistem Informasi 30 Obtaining Public IP Addresses Unless you work for an organization that has possessed its own public IP addresses since the 1980s (or acquired such addresses through merger or acquisition), it’s highly likely that whatever public IP addresses your organization uses were issued by the very same ISP who provides your organization with Internet access Because all devices accessible to the Internet must have public IP addresses, changing providers often means going through a tedious exercise called IP renumbering Magister Manajemen Sistem Informasi 31 IP Addressing Schemes To the uninitiated, it may appear that all these IP addresses are randomly assigned, or perhaps generated automatically by some computer somewhere A great deal of thought has gone into the strategy for allocating IP addresses around the world Magister Manajemen Sistem Informasi 32 The Network Space There are a number of critical factors that typically constrain IP addressing schemes, and we look at these in two groups The first group of constraints determines the number and size of networks These are: Number of physical locations Number of network devices at each location Amount of broadcast traffic at each location Availability of IP addresses Delay caused by routing from one network to another Magister Manajemen Sistem Informasi 33 IPv6 - IP Version 6 IP Version 6 Is the successor to the currently used IPv4 Specification completed in 1994 Makes improvements to IPv4 (no revolutionary changes) One (not the only !) feature of IPv6 is a significant increase in of the IP address to 128 bits (16 bytes) IPv6 will solve – for the foreseeable future – the problems with IP addressing 1024 addresses per square inch on the surface of the Earth. Magister Manajemen Sistem Informasi 34 IPv6 Header 32 bits ve rs ion (4 bits ) Traffic Clas s (8 bits ) Payload Le ngth (16 bits ) Flow Labe l (24 bits ) Ne xt He ade r (8 bits ) Hop Lim its (8 bits ) Source IP addre s s (128 bits ) De s tination IP addre s s (128 bits ) Magister Manajemen Sistem Informasi 35 IPv6 vs. IPv4: Address Comparison IPv4 has a maximum of 232 4 billion addresses IPv6 has a maximum of 2128 = (232)4 4 billion x 4 billion x 4 billion x 4 billion addresses Magister Manajemen Sistem Informasi 36 Notation of IPv6 addresses Convention: The 128-bit IPv6 address is written as eight 16-bit integers (using hexadecimal digits for each integer) CEDF:BP76:3245:4464:FACE:2E50:3025:DF12 Short notation: Abbreviations of leading zeroes: CEDF:BP76:0000:0000:009E:0000:3025:DF12 CEDF:BP76:0:0:9E :0:3025:DF12 “:0000:0000:0000” can be written as “::” CEDF:BP76:0:0:FACE:0:3025:DF12 CEDF:BP76::FACE:0:3025:DF12 IPv6 addresses derived from IPv4 addresses have 96 leading zero bits. Convention allows to use IPv4 notation for the last 32 bits. ::80:8F:89:90 ::128.143.137.144 Magister Manajemen Sistem Informasi 37 IPv6 Provider-Based Addresses The first IPv6 addresses will be allocated to a provider-based plan 010 Registry Provider Subscriber Subnetwork Interface ID ID ID ID ID Type: Set to “010” for provider-based addresses Registry: identifies the agency that registered the address The following fields have a variable length (recommeded length in “()”) Provider: ID of Internet access provider (16 bits) Subscriber: ID of the organization at provider (24 bits) Subnetwork: ID of subnet within organization (32 bits) Interface: identifies an interface at a node (48 bits) Magister Manajemen Sistem Informasi 38 Transmission Control Protocol (TCP) Magister Manajemen Sistem Informasi 39 Understanding Connectionless Transport Protocols Connectionless protocols provide the simplest kind of transport services because they simply package messages, taken as is from the TCP/IP Application layer, into datagrams A datagram slaps a header onto the higher-layer data and passes it to the IP layer, where that datagram is fitted with an IP header and packetized, after which it may be transmitted across the network Magister Manajemen Sistem Informasi 40 Understanding Connectionless Transport Protocols This method is called best-effort delivery UDP runs up to 40% faster than TCP, under some conditions, because it does next to nothing It’s also typical for connectionless protocols to handle the following kinds of tasks: Message checksum Higher-layer protocol identification Magister Manajemen Sistem Informasi 41 User Datagram Protocol (UDP) It’s appropriate to provide the following detailed description for UDP: No reliability mechanisms No delivery guarantees No connection handling Identifies Application layer protocol conveyed Checksum for entire message carried in UDP header No buffering services No segmentation Magister Manajemen Sistem Informasi 42 UDP Header Fields and Functions UDP is defined in RFC 768 When the Protocol field of an IP header contains the value 17 (0x11), the UDP header follows the IP header Magister Manajemen Sistem Informasi 43 UDP Port Numbers and Processes Magister Manajemen Sistem Informasi 44 Understanding Connection-Oriented Protocols Connection-oriented protocols create a logical connection directly between two peers on an internetwork Connection-oriented protocols track the transfer of data, and ensure it arrives successfully through acknowledgements and sequence number tracking An acknowledgement is a positive response, indicating a set of data arrived Magister Manajemen Sistem Informasi 45 Understanding Connection-Oriented Protocols Connection-oriented peers use sequence number tracking to identify the amount of data transferred, and any out-of-order packets Connection-oriented protocols have a timeout mechanism that indicates when a host waited too long for a communication, and such communication should be assumed lost Connection-oriented protocols also have a retry mechanism that enables them to recover lost data by retransmitting it a specified number of times Magister Manajemen Sistem Informasi 46 Transmission Control Protocol (TCP) TCP offers connection-oriented services with sequencing, error recovery, and a sliding window mechanism Because of TCP’s end-to-end reliability and flexibility, TCP is the preferred transport method for applications that transfer large quantities of data and require reliable delivery services TCP hosts create a virtual connection with each other using a handshake process Magister Manajemen Sistem Informasi 47 Transmission Control Protocol (TCP) TCP transfers data as a continuous stream of bytes, with no knowledge of the underlying messages or message boundaries that might be contained in that byte stream Magister Manajemen Sistem Informasi 48 TCP Startup Connection Process (TCP Handshake) TCP offers a connection-oriented transport that begins with a handshake between two hosts One host initiates the handshake to another host to: (a) (b) (c) Ensure the destination host is available Ensure the destination host is listening on the destination port number Inform the destination host of the initiator’s sequence number so the two sides can track data as it is transferred Magister Manajemen Sistem Informasi 49 TCP Handshake Is a Three-Packet Process Magister Manajemen Sistem Informasi 50 TCP Connection Termination The TCP connection termination process requires four packets Magister Manajemen Sistem Informasi 51 TCP Sequence and Acknowledgement Process The sequence and acknowledgement process guarantees that packets are ordered properly and protects against missing segments During the handshake process, each side of the connection selects its own starting sequence number During the TCP startup and teardown sequences, the Sequence Number and Acknowledgement Number fields increment by one, even though no valid data is sent or received Magister Manajemen Sistem Informasi 52 TCP Congestion Control Congestion is the overloading of the network or a receiver Overloading a receiver occurs when the number of data bytes is greater than the advertised window The current window is always the lesser of what the network and receiver can handle When TCP data is received, it is placed in this TCP buffer area Magister Manajemen Sistem Informasi 53 TCP Congestion Control TCP has four defined congestion control mechanisms to ensure the most efficient use of bandwidth, and quick error and congestion recovery TCP supports windowing—the process of sending numerous data packets in sequence without waiting for an intervening acknowledgement The four mechanisms, defined in detail in RFC 2581, are: Slow start Congestion Avoidance Fast Retransmit Fast Recovery Magister Manajemen Sistem Informasi 54 Network Window and Receiver Window Determine the Current Congestion Window Size Magister Manajemen Sistem Informasi 55 TCP Congestion Control Slow Start When a TCP host starts up, the size of the congestion window is not known The initial value of the window being used is twice the sender’s MSS setting Congestion Avoidance Once the window size has increased using the Slow Start algorithm, if an error occurs (a timeout), the window size is divided in half Next, the Congestion Avoidance algorithm is used to increase the window size in a linear manner Magister Manajemen Sistem Informasi 56 TCP Congestion Control Fast Retransmit / Fast Recovery When an out-of-order data segment is received, the receiver should immediately send duplicate ACKs The Fast Recovery process dictates that when a host receives three duplicate ACKs, it must immediately start retransmitting the lost segments, without waiting for the retransmission timer to expire Magister Manajemen Sistem Informasi 57 TCP Header Fields and Functions You should recognize some characteristics of the TCP header, such as the Source and Destination Port Number fields The definitions for the Source Port Number Field and Destination Port Number Field are the same as those for the UDP fields Magister Manajemen Sistem Informasi 58 Common and Appropriate Uses for TCP and UDP Given that TCP is robust and reliable, and UDP is not, why would any Application layer protocol or service choose UDP for transport when TCP is readily available? The short answer to that question is overhead For some lightweight services, such as messenger service, TCP is overkill, and UDP is used instead Magister Manajemen Sistem Informasi 59 Common and Appropriate Uses for TCP and UDP For applications, such as RIP, that rely on regular updates of routing tables, and track timeout values as part of ordinary behavior, the extra reliability of TCP isn’t necessary, and UDP is used instead TCP was designed in an era when 300-bps communications was considered fast, and when noisy lines or intermittent communications problems made long-haul, reliable transmission of data inherently risky without access to a robust, reliable transport service TCP is a more important transport than UDP, and is still used for the majority of TCP/IP Application layer protocols and services Magister Manajemen Sistem Informasi 60 Routing Magister Manajemen Sistem Informasi 61 Understanding Routing We start our discussion by explaining the routing table This table is a database that lives in the memory of the router Entries in this database are known as “routes” and consist of a network address, a “next hop” (routing jargon for the IP address of the next router in the path to the destination), various metrics, and vendor-specific information Magister Manajemen Sistem Informasi 62 Understanding Routing A routing table is a compilation of all the networks that the router can reach The routing table is used as follows: When a packet is received on a network interface, the first thing the router must do is find out where the packet wants to go, so the router reads the first field in the IP header, which is the Destination Address, and then looks in the Network field of its routing table for a match Magister Manajemen Sistem Informasi 63 Understanding Routing A route entry can be placed in a routing table in three basic ways The first way is through direct connection The second is that it can be manually configured The third way that an entry can be placed in a routing table is dynamically, by using a routing protocol Routers use routing protocols to share information about the various networks on an internetwork Magister Manajemen Sistem Informasi 64 Understanding Routing Thus, you simply configure the protocol on each router, and the routers will convey Network Layer Reachability Information (NLRI) to each other Routed protocols are Layer 3 protocols that are used to get packets through an internetwork There are two primary ways to group routing protocols The first is by the method they use to communicate Magister Manajemen Sistem Informasi 65 Understanding Routing The two primary “flavors” employed by routing protocols are distance vector and link-state The routing protocols used inside a routing domain are called Interior Gateway Protocols (IGPs), and the routing protocols used to connect these routing domains are known as Exterior Gateway Protocols (EGPs) Magister Manajemen Sistem Informasi 66 Distance Vector Routing Protocols There are several distance vector routing protocols in use today The most popular by a wide margin is Routing Information Protocol (RIP), followed by a Cisco proprietary protocol called Interior Gateway Routing Protocol (IGRP) These protocols have several things in common that distinguish them from link-state protocols Magister Manajemen Sistem Informasi 67 Distance Vector Routing Protocols The second major distinction is that they “route by rumor” Magister Manajemen Sistem Informasi 68 Link-State Routing Protocols Link-state routing protocols differ from distance vector routing protocols in two primary ways The first is that they do not router by rumor The second major difference is that they do not periodically broadcast their entire tables Magister Manajemen Sistem Informasi 69 Link-State Routing Protocols In this configuration, Routers A, B, and C send Hello packets to Network 1 As they hear each other’s Hello packets, each router builds an adjacencies database Magister Manajemen Sistem Informasi 70 Areas, Autonomous Systems, and Border Routers Extremely large networks can be broken down into regions called Autonomous Systems (ASs) These Autonomous Systems are under the same administrative control The routers that connect Autonomous Systems are called Autonomous System Border Routers (ASBRs) Magister Manajemen Sistem Informasi 71 An Exterior Gateway Protocol Is Used to Connect Two Autonomous Systems Magister Manajemen Sistem Informasi 72 Interior Gateway Protocols (IGPs) Interior Gateway Protocols are used to exchange routing information within an AS These protocols are also referred to as intra-domain routing protocols The most commonly used IGPs are Routing Information Protocol (RIP) (versions 1 and 2) and Open Shortest Path First (OSPF) Magister Manajemen Sistem Informasi 73 Enhanced Interior Gateway Routing Protocol (EIGRP) IGRP was developed in the 1980s by Cisco Systems in an effort to provide a more efficient interior gateway protocol IGRP was updated in the early 1990s—the updated version is called Enhanced Interior Gateway Routing Protocol (EIGRP) Magister Manajemen Sistem Informasi 74 Exterior Gateway Protocols (EGPs) Exterior Gateway Protocols are used to exchange routing information between Autonomous Systems These protocols are also referred to as inter-domain routing protocols Interestingly, the name Exterior Gateway Protocol was assigned to the first implementation of this type of routing Magister Manajemen Sistem Informasi 75 Border Gateway Protocol (BGP) BGP is a distance vector protocol and is the replacement for EGP The current version of BGP is version 4, which is defined in RFC 1771 BGP offers three types of routing operations: Inter-autonomous system routing Intra-autonomous system routing Pass-through autonomous system routing Magister Manajemen Sistem Informasi 76 Typical BGP Design Magister Manajemen Sistem Informasi 77 Border Gateway Protocol (BGP) Figure 10-15 illustrates how BGP is used for interautonomous system routing When BGP is configured for intra-autonomous system routing, the BGP routers are located within the same AS Pass-through autonomous system routing enables BGP peer routers to exchange routing information across an AS that does not support BGP Magister Manajemen Sistem Informasi 78