TCP/IP addressing and subnetting When you configure the TCP/IP protocol on a Windows computer, the TCP/IP configuration settings require: An IP address A subnet mask A default gateway To configure TCP/IP correctly, it's necessary to understand how TCP/IP networks are addressed and divided into networks and subnetworks.
TCP/IP addressing and subnetting The success of TCP/IP as the network protocol of the Internet is largely because of its ability to connect together networks of different sizes and systems of different types. These networks are arbitrarily defined into three main classes (along with a few others) that have predefined sizes. Each of them can be divided into smaller subnetworks by system administrators. A subnet mask is used to divide an IP address into two parts. One part identifies the host (computer), the other part identifies the network to which it belongs.
IP address An Internet Protocol (IP) address is the unique identifying number assigned to every device connected to the internet. An IP address definition is a numeric label assigned to devices that use the internet to communicate. Computers that communicate over the internet or via local networks share information to a specific location using IP addresses. Every device with an internet connection has an IP address, whether it's a computer, laptop, IoT device, or even toys. The IP addresses allow for the efficient transfer of data between two connected devices, allowing machines on different networks to talk to each other.
Introduction of Classful IP Addressing An IP address is an address that has information about how to reach a specific host, especially outside the LAN. An IP address is a 32-bit unique address having an address space of 2 32 . Classful IP addressing is a way of organizing and managing IP addresses, which are used to identify devices on a network. Think of IP addresses like street addresses for houses; each device on a network needs its unique address to communicate with other devices.
IP address classification The IP addresses can be classified into two classes: Public address: This address considered as any valid address assigned to any user, and the organization who is responsible for registering IP ranges called Internet Service Providers (ISPs), and this address will be unique. Private Address: Any number or address assigned to a device on a private TCP/IP Local Area Network that is accessible only within the Local Area Network.
IP address versions IP addresses have two distinct versions or standards. The Internet Protocol version 4 (IPv4) address is the older of the two, which has space for up to 4 billion IP addresses and is assigned to all computers. The more recent Internet Protocol version 6 (IPv6) has space for trillions of IP addresses, which accounts for the new breed of devices in addition to computers. There are also several types of IP addresses, including public, private, static, and dynamic IP addresses .
IPv4 Address An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a host or a router to the Internet; an IP address is the address of the interface. It is a unique number assigned to every device that connects to the internet or a computer network. It’s like a home address for your computer, smartphone, or any other device, allowing it to communicate with other devices. An IPv4 address has an address space of 2 32 or 4,294,967,296.
IPv6 Address IPv6 or Internet Protocol Version 6 is a network layer protocol that allows communication to take place over the network. IPv6 was designed by the Internet Engineering Task Force (IETF) in December 1998 with the purpose of superseding IPv4 due to the global exponentially growing internet of users. IPv6 protocol is being used and deployed more often, especially in mobile phone markets. IP address determines who and where you are in the network of billions of digital devices that are connected to the Internet. IPv6 has a 128-bit address length and it is meant to work in tandem with IPv4, which is still in widespread use today, and eventually replace it.
IPv4 Address: Dotted-decimal notation IP v4 addresses are normally expressed in dotted-decimal format, with four numbers separated by periods, such as 192.168.123.132. To understand how subnet masks are used to distinguish between hosts, networks, and subnetworks, examine an IP address in binary notation.
IPv4 Address: Binary is the language of digital electronic communication. Binary is another name for Base2 numbering. Our usual numbering system is Base 10. Computers use binary because it is easily represented as electrical signals in memory or digital values on a storage media. The (8) eight binary values found in a single octet of an IP address are 128 64 32 16 8 4 2 1
IPv4 Address The IPv4 address is divided into two parts: Network ID and Host ID. The main purpose of an IPv4 address is to identify devices on a network and ensure that data sent from one device reaches the correct destination. Example : When you type a website address into your browser, your device uses the IPv4 address to find and connect to the server where the website is hosted. Think of an IPv4 address as a phone number for your device. Just as you dial a specific number to reach a particular person, devices use IPv4 addresses to connect and share information.
IPv4 Address: binary conversion table IP addresses can be displayed in three typical formats: Dotted-decimal notation is the format that is typically used for displaying the IP address in a human-readable format. An example of dotted-decimal notation is 192.168.1.100 Binary notation is the format that systems on the network use to process the address. An example of binary notation is 11000000.10101000.00000001.01100100. Hexadecimal notation is the format typically used when identifying IPv6 addresses. An example of hexadecimal notation of an IPv4 address is C0.A8.01.64
IPv4 Address: binary For example , the dotted-decimal IP address 192.168.123.132 is (in binary notation) the 32-bit number 11000000101010000111101110000100. This number may be hard to make sense of, so divide it into four parts of eight binary digits. These 8-bit sections are known as octets. The example IP address, then, becomes 11000000.10101000.01111011.10000100. This number only makes a little more sense, so for most uses, convert the binary address into dotted-decimal format (192.168.123.132). The decimal numbers separated by periods are the octets converted from binary to decimal notation.
How IPv4 Address works For a TCP/IP wide area network (WAN) to work efficiently as a collection of networks, the routers that pass packets of data between networks don't know the exact location of a host for which a packet of information is destined. Routers only know what network the host is a member of and use information stored in their route table to determine how to get the packet to the destination host's network. After the packet is delivered to the destination's network, the packet is delivered to the appropriate host. For this process to work, an IP address has two parts. The first part of an IP address is used as a network address, the last part as a host address. If you take the example 192.168.123.132 and divide it into these two parts, you get 192.168.123. Network .132 Host or 192.168.123.0 - network address. 0.0.0.132 - host address.
How IPv4 Address works One of the benefits of classful addresses is that they provide a hierarchy to the network through the use of the network ID. This translates into an efficient routing environment because it is easy for a router to determine what networks can be grouped together and treated as a single routing entry.
Classes of IP addresses Different networks have different sizes. Basically, there are many small networks and few large networks. To provide efficient use of 32-bit address space, IPv4 defined several address classes and associated address formats: Class A: allows 128 networks, 16 million hosts each. The IP address start from 1.0.0.0 to 127.255.255.255 , and the mask address is 255.0.0.0 Class B: allows 16,382 networks, 65,534 hosts each. The IP address start from 128.0.0.0 to 191.255.255.255 , and the mask address is 255.255.0.0 Class C: allows 2 million networks, 254 hosts each. The IP address start from 192.0.0.0 to 223.255.255.255 , and the mask address is 255.255.255.0 Class D: multicast networks The IP address start from 224.0.0.0 to 239.255.255.255. Class E: reserved for future use. From 240 to 255 and the 255.255.255.255 used for broadcast to all the subnet.
Structure of IPv4 Address
IPv4 Address: examples Change the following IPv4 addresses from binary notation to dotted-decimal notation. a. 10000001 00001011 00001011 11101111 b. 11000001 10000011 00011011 11111111 c. 11100111 11011011 10001011 01101111 d. 11111001 10011011 11111011 00001111 Solution We replace each group of 8 bits with its equivalent decimal number (see Appendix B) and add dots for separation: a. 129.11.11.239 b. 193.131.27.255 c. 231.219.139.111 d. 249.155.251.15
IPv4 Address: examples Change the following IPv4 addresses from dotted-decimal notation to binary notation. a. 111.56.45.78 b. 221.34.7.82 c. 241.8.56.12 d. 75.45.34.78 Solution We replace each decimal number with its binary equivalent: a. 01101111 00111000 00101101 01001110 b. 11011101 00100010 00000111 01010010 c. 11110001 00001000 00111000 00001100 d. 01001011 00101101 00100010 01001110
IPv4 Address: examples Find the error, if any, in the following IPv4 addresses: a. 111.56.045.78 b. 221.34.7.8.20 c. 75.45.301.14 d. 11100010.23.14.67 Solution a. There should be no leading zeroes (045). b. We may not have more than 4 bytes in an IPv4 address. c. Each byte should be less than or equal to 255. d. A mixture of binary notation and dotted-decimal notation.
IPv4 Address: examples Change the following IPv4 addresses from binary notation to hexadecimal notation. a. 10000001 00001011 00001011 11101111 b. 11000001 10000011 00011011 11111111 Solution We replace each group of 4 bits with its hexadecimal equivalent. Note that 0X (or 0x) is added at the beginning or the subscript 16 at the end. a. 0X810B0BEF or 810B0BEF 16 b. 0XC1831BFF or C1831BFF 16
Strategies to Conserve Addresses Several strategies have been developed and implemented to help the Internet community on how provides a good managing of IP addresses. These strategies help reduce the load on Internet routers and help administrators use globally unique IP addresses more efficiently. There are two common strategies, which are: Private Addressing Classless Inter-Domain Routing (CIDR)
Private Address It means If the internetwork is limited to one organization, the IP addresses need only be unique within that organization. Only networks that interface with public networks such as the Internet need public addresses. Using public addresses on the outside and private addresses for inside networks is very effective. Private Addresses:- RFC1918 designates three ranges of IP addresses as private: 10.0.0.0 through 10.255.255.255 172.16.0.0 through 172.31.255.255 192.168.0.0 through 192.168.255.255
Classful Addressing The 32-bit IP address is divided into five sub-classes. These are given below: Class A Class B Class C Class D Class E Each of these classes has a valid range of IP addresses. Classes D and E are reserved for multicast and experimental purposes respectively. The order of bits in the first octet determines the classes of the IP address. The class of IP address is used to determine the bits used for network ID and host ID and the number of total networks and hosts possible in that particular class. Each ISP or network administrator assigns an IP address to each device that is connected to its network.
Classful addressing
Class A IP addresses belonging to class A are assigned to the networks that contain a large number of hosts. The network ID is 8 bits long. The host ID is 24 bits long. The higher-order bit of the first octet in class A is always set to 0. The remaining 7 bits in the first octet are used to determine network ID. The 24 bits of host ID are used to determine the host in any network. The default subnet mask for Class A is 255.x.x.x. Therefore, class A has a total of: 2^24 – 2 = 16,777,214 host ID IP addresses belonging to class A ranges from 0.0.0.0 – 127.255.255.255.
Class B IP address belonging to class B is assigned to networks that range from medium-sized to large-sized networks. The network ID is 14 bits long. The host ID is 16 bits long. The higher-order bits of the first octet of IP addresses of class B are always set to 10. The remaining 14 bits are used to determine the network ID. The 16 bits of host ID are used to determine the host in any network. The default subnet mask for class B is 255.255.x.x. Class B has a total of: 2^14 = 16384 network address 2^16 – 2 = 65534 host address IP addresses belonging to class B ranges from 128.0.0.0 – 191.255.255.255.
Class C IP addresses belonging to class C are assigned to small-sized networks. The network ID is 24 bits long. The host ID is 8 bits long. The higher-order bits of the first octet of IP addresses of class C is always set to 110. The remaining 21 bits are used to determine the network ID. The 8 bits of host ID are used to determine the host in any network. The default subnet mask for class C is 255.255.255.x. Class C has a total of: 2^21 = 2097152 network address 2^8 – 2 = 254 host address IP addresses belonging to class C range from 192.0.0.0 – 223.255.255.255.
Class D IP address belonging to class D is reserved for multi-casting . The higher-order bits of the first octet of IP addresses belonging to class D is always set to 1110. The remaining bits are for the address that interested hosts recognize. Class D does not possess any subnet mask. IP addresses belonging to class D range from 224.0.0.0 – 239.255.255.255.
Class E IP addresses belonging to class E are reserved for experimental and research purposes. IP addresses of class E range from 240.0.0.0 – 255.255.255.255. This class doesn’t have any subnet mask. The higher-order bits of the first octet of class E are always set to 1111. Range of Special IP Addresses 169.254.0.0 – 169.254.0.16 : Link-local addresses 127.0.0.0 – 127.255.255.255 : Loop-back addresses 0.0.0.0 – 0.0.0.8 : used to communicate within the current network.
Rules for Assigning Host ID Host IDs are used to identify a host within a network. The host ID is assigned based on the following rules: Within any network, the host ID must be unique to that network. A host ID in which all bits are set to 0 cannot be assigned because this host ID is used to represent the network ID of the IP address. A Host ID in which all bits are set to 1 cannot be assigned because this host ID is reserved as a broadcast ID or address to send packets to all the hosts present on that particular network. The formula for the number of Hosts on any network or subnet is 2^H – 2 Where H i s the number of 0s at the end of the mask The 2 subtracted represent the Network and Broadcast IDs
Rules for Assigning Network ID Hosts that are located on the same physical network are identified by the network ID, as all host on the same physical network is assigned the same network ID. The network ID is assigned based on the following rules: The network ID cannot start with 127 because 127 belongs to the class A address and is reserved for internal loopback functions. All bits of network ID set to 1 are reserved for use as an IP broadcast address and therefore, cannot be used. All bits of network ID set to 0 are used to denote a specific host on the local network and are not routed and therefore, aren’t used.
Port Address Translation (PAT). It’s another technique used to convert the private address to public. During PAT, each computer on LAN is translated to the same IP address (public), but with a different port number assignment. This way is much better than the NAT because we can use one public address to translate any private address, therefore we saved the cost. The table below shows the process of the PAT The port address will be any random number in the allowed range, that the device created it when wants to access the internet. The packet will contain the port number that assign to the device that wants to access the internet and through this port number, the router when get the response message will translate it and make map this message to it is private address based on the port number.
Subnets As the number of distinct local networks grows, managing them become a serious headache. Every time a new network is installed the system administrator must contact NIC to get a new network number. The solution to the problem is to allow a network to be split into several independent parts for internal use but still act like a single network to the outside world. In the internet literature these parts are called subnets . Subnetting means divide or separate the single network into multiple networks that can reduce the loading from one network. The advantage of using subnetting is:- 1. Reduce the traffic and the increase the performance. 2. The smaller network can easier to manage.
Subnets For example, If we have a class B with a Flat Network, the number of host will be more than 2 16 =65536 hosts, So the problem is here, that managing this network with this number of host is too tricky and the performance of this network will get down because of the heavy load. In other word, any single broadcast can slowdown the network. Therefore, the solution is the subnetting .
Subnet Mask The second item, which is required for TCP/IP to work, is the S ubnet mask . The subnet mask is used by the TCP/IP protocol to determine whether a host is on the local subnet or on a remote network. In TCP/IP, the parts of the IP address that are used as the network and host addresses aren't fixed. Unless you have more information, the network and host addresses above can't be determined. This information is supplied in another 32-bit number called a subnet mask. The subnet mask is 255.255.255.0 in this example. It isn't obvious what this number means unless you know 255 in binary notation equals 11111111. So, the subnet mask is 11111111.11111111.11111111.00000000.
Subnet Mask A mask is a 32-bit binary number that is expressed in dotted decimal notation. By default, a mask contains two fields, the network field and the host field. These correspond to the network number and the locally administered part of the network address. When an administrator subnets, they are adjusting the way they view the IP address. Table 1: Default masks for classful addressing
Cont … Routers and hosts still assume class subnet masks by default: Class A /8 255.0.0.0 Class B /16 255.255.0.0 Class C /24 255.255.255.0 The figure below gives an example to class C mask address: The first three octets represent the network part and the last octet represent the host part.
Cont … There three important things that should be taken into our account when we thinking about subnetting:- Network address – the first one Broadcast address – the last one Host addresses – everything in between As well as, to find the number of hosts per subnet. We can use formal 2 x -2, where (x) is the number of unmasked bits (0’s) .
Cont … For example, in 11000000, the number of zeros gives us 2 6 – 2 =62 hosts. In this example, there are 62 hosts per subnet and we make subtract because the first IP address reserve for the network address and the last one for the network broadcast. While when we want to find number of networks, we can use this formal 2 y Where Y represent the number of masked bits, (1’s). For example, in 11000000, the number of ones gives us =4
Cont … In any subnet, there are certain addresses that cannot be assigned to an individual device because they have a special purpose. The subnet address is the first address in a range that identifies the subnet. The broadcast address is the last address in the range, and all hosts on the subnet receive traffic if anything is sent to it. Assume that a subnet address is 172.31.9.0 with a mask of 255.255.255.0 . The subnet address is 172.31.9.0 , and the broadcast address is 172.31.9.255 .
Classless Inter-Domain Routing (CIDR ) Classless Inter Domain Routing (CIDR) is a method for assigning IP addresses without using the standard IP address classes like Class A, Class B or Class C. In CIDR , an IP address is represented as A.B.C.D /n , where "/n" is called the IP prefix or network prefix. The IP prefix identifies the number of significant bits used to identify a network. Example, 192.9.205.22 /18 means, the first 18 bits are used to represent the network and the remaining 14 bits are used to identify hosts.
Classless Inter-Domain Routing (CIDR ) It’s basically the method that ISPs (Internet Service Providers) use to allocate an amount of addresses to a company, a home—a customer. They provide addresses in a certain block size When you receive a block of addresses from an ISP, what you get will look something like this: 192.168.10.32/28. This is telling you what your subnet mask is. The slash notation (/) means how many bits are turned on (1s). The Class A default subnet mask, which is 255.0.0.0. This means that the first byte of the subnet mask is all ones (1s), or 11111111. When referring to a slash notation, you need to count all the 1s bits to figure out your mask. The 255.0.0.0 is considered a /8 because it has 8 bits that are 1s—that is, 8 bits that are turned on
Subnetting Class C Addresses In a Class C address, only 8 bits are available for defining the hosts that subnet bits start at the left and go to the right without skipping bits. This means that the only Class C subnet masks can be the following: The Fast Way Method: Subnetting a Class C Address start by using the second subnet mask available with a Class C address, which borrows 2 bits for subnetting The 1s represent the subnet bits, and the 0’s represent the host bits available in each subnet. 192 provides 2 bits for subnetting and 6 bits for defining the hosts in each subnet.