IPv4 addresses are 32-bit numbers represented in dotted decimal notation (four base ten numbers separated by three dots), as follows: 192.168.5.23
It looks like this in binary: 11000000.10101000.00000101.00010111
An IP address is made up of two parts:
ID of the network :The initial component of an address that is shared by all hosts on the same network.
ID of the host : The second portion of the address is a collection of bits that are unique in pattern to each host on the same network.
How can you figure out the network ID and host ID from an IP address like 192.168.5.23? You can’t do it by yourself. To identify the network ID and host ID elements of an IP address, a subnet mask is required.
A subnet mask is just a string of ones followed by a certain amount of zeros, always totalling 32 bits. 255.255.255.0 is an example of a popular subnet mask.
It looks like this in binary:
You should remember that 0 = 00000000 and 255 = 11111111 at this point.
The network ID section of an IP address is the portion of the IP address that matches with the ones of the subnet mask when you line up an IP address with a matching subnet mask in binary.
The host ID is the part that corresponds with the zeros. You can see this in dotted decimal with basic IP addresses, but you’ll need to see it in binary to really comprehend how computers function.
The subnet mask for the IP address 192.168.5.23 is 255.255.255.0. Convert these integers to binary and compare the whole IP address to the ones and zeros of the subnet mask.
|Table 1.4-1: Determining the Network ID and Host ID|
The Internet Assigned Numbers Authority (IANA) was established to facilitate the dispersion of IP addresses and to ensure that no companies on the Internet utilised duplicate IP addresses. IANA tracks and distributes IP numbers to those who need them.
IANA was originally overseen by a single individual (the well-known Jon Postel) until 1998, when the Internet Corporation for Assigned Names and Numbers (ICANN) was formed.
IANA has expanded significantly, and currently manages five Regional Internet Registries (RIRs) that provide IP addresses to big ISPs and enterprises. The American Registry for Internet Numbers is the RIR for North America (ARIN).
IANA is managed by the Internet Corporation for Assigned Names and Numbers (ICANN). For additional information, go to www.icann.org.
Initially, the Internet Assigned Numbers Authority (IANA) distributed IP numbers in a dignified manner.
Make a mental note of the IP class ranges! Any IP address should be able to tell you what class it belongs to. Here’s a tip to assist you: The first binary octet of a Class A address is always 0 (0xxxxxxx);
the first binary octet of a Class B address is always 10 (10xxxxxx); the first binary octet of a Class C address is always 110 (110xxxxx); the first binary octet of a Class D address is always 1110 (1110xxxx); and the first binary octet of a Class E address is (1111xxxx).
|First Decimal Value||Addresses||Hosts per Network ID|
|Class D||224–239||220.127.116.11–18.104.22.168||Not assigned to hosts, used for multicasting|
|Class E||240–255||240.0.0.0–255.255.255.255||Not assigned to hosts, used for experimental purposes|
The first octet (8 bits) of a Class A network block with a subnet mask of 255.0.0.0 is used to create the network ID, while the final three octets (24 bits) are used to determine the host ID.
The first number would be shared by all hosts in network 10.0.0.0, for example. When you have three octets to deal with for hosts, you have a huge amount of options—over 16 million potential number combinations (not that you would ever make a network with 16 million hosts).
The first two octets of a Class B block with a subnet mask of 255.255.0.0 are used to define the network ID. The first two integers, for example, would be shared by all hosts in the 172.30.0.0 network.
This leaves two octets for host IDs, allowing for up to 65,534 distinct hosts per Class B network ID.
The first three octets of a Class C block with a subnet mask of 255.255.255.0 are used to specify solely the network ID. For example, all hosts on the 192.168.1.0 network would share the first three digits.
The host IDs are defined exclusively by the final octet, leaving just 254 potential addresses.
Multicast class blocks are used in one-to-many communication, such as streaming video conferencing, and when routers communicate with one another using routing protocols.
Multicasting is designated for Class D addresses, while Class E addresses are reserved for rare experimental reasons. (These were formerly referred to as reserved addresses.)
There are additionally two reserved patterns for host bits. The network ID is represented by all host bits being zeros (no matter how many host bits there are).
A Class A network with a subnet mask of 255.0.0.0, for example, has a network ID of 10.0.0.0. (24 host bits are zeros). The network’s broadcast address is represented by all host bits being ones (no matter how many host bits there are).
For example, a Class A network with a subnet mask of 255.0.0.0 has a broadcast address of 10.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255 (24 host bits are ones).
How do these two patterns in the host section, reserving all zeros and all ones, relate to the blocks? 224 = 16,777,216 for Class A, which has 24 host bits.
Because the host component cannot include all zeros or all ones, you remove two from the final number to obtain the number of possible host IDs, which in this instance is 16,777,214. Class B (65,536 2 = 65,534) and Class C (256 2 = 254) host addresses follow the same pattern.
Public vs. Private
Private IP addresses, which are a subset of public IP addresses, are also available. Private addresses will be dropped by Internet backbone routers, therefore such addresses will never be used on the Internet.
These private IP addresses are available to everyone, but they’re best utilised using Network Address Translation (NAT). The ranges of addresses that are categorised as private IP addresses are as follows:
10.0.0.0 to 10.255.255.255 (1 Class A network with a 255.0.0.0 subnet mask)
172.16.0.0 to 172.31.255.255 (16 Class B networks with a 255.255.0.0 subnet mask)
192.168.0.0 to 192.168.255.255 (256 Class C networks using a subnet mask of 255.255.255.0)
All other IP addresses in Classes A, B, and C are public IP addresses, which means they may be routable and used on the Internet.
For the CompTIA Network+ test, be sure you can recognise the difference between a private and a public IP address fast.
According to RFC 1519, “Classless Inter-Domain Routing (CIDR): An Address Assignment and Aggregation Strategy,” classless inter-domain routing (CIDR) was created in 1993 to overcome the following three problems:
The class B network address space has been depleted. One of the root causes of this issue is the absence of a network class that is suitable for mid-sized businesses; class C, with a maximum of 254 host addresses, is too small, while class B, with up to 65,534 addresses, is too big for most businesses.
Routing tables in Internet routers are growing faster than existing software, hardware, and humans can keep up with.
The 32-bit IP address space will eventually run out.
Subnetting and variable-length subnet masking were used to tackle the first challenge (VLSM). The second difficulty was handled using the notion of supernetting, and the third problem was solved using the IPv6 protocol, which is a new protocol.
Subnetting is the process of dividing a single network ID into numerous smaller networks, commonly known as subnets. Subnetting is a process in which an organisation is given a block of addresses and then divides the block into different subnets.
An ISP or RIR performs classless addressing (one of the CIDR components). An ISP, for example, is given a block of addresses, which it divides into many subnets of varying sizes and then assigns to consumers the smaller individual subnets.
Consider CIDR to be the ISP or RIR’s subnetting. When compared to class blocks, subnetting allows for a far more efficient use of IP addresses.
It also allows you to divide a network for security (by separating a bank of public access computers from your more private PCs) and bandwidth management (by dividing a highly utilised LAN from one that isn’t).
To pass the CompTIA Network+ test, you must know how to subnet.
The subnet mask is the foundation of subnetting.
To begin, CIDR notation means that instead of writing the subnet mask in dotted decimal base 10 notation, such as 255.255.255.0, and saying “two fifty five, dot, two fifty five, dot, two fifty five, dot, two fifty five, dot, two fifty five, dot, two fifty five, dot, zero,” you can write it as /24 and say “slash twenty four.”
To put it another way, take the network ID, add a slash, and then a number that indicates the number of ones in the subnet mask. 192.168.1.0/24, for example.
You may expand an existing /8, /16, or /24 subnet mask by adding extra ones and removing the equivalent amount of zeros. Let’s imagine you have a 50-computer Internet café, 40 of which are for public use and 10 of which are utilised in the back office for accounting and other purposes. 192.168.4.0/24 is your network ID.
You decide to construct subnets to prevent anybody using public systems from accessing your private workstations. You also have Wi-Fi and wish to put wireless clients on their own subnet (no more than ten).
When it comes to subnetting, there are two things to keep in mind. To get the amount of subnets you need, start with the supplied subnet mask and add additional ones to the right (replace the zeros with ones). Second, put the dots out of your mind. Subnets are no longer defined by them.
Subnetting should never be attempted without first converting to binary. A large number of technicians are “victims of the dots.” They’re so accustomed to dealing with class licences that they overlook the fact that subnets are more than simply /8, /16, and /24 networks.
There’s no reason why network IDs have to terminate with dots. At least according to the computers, having subnets that finish in the intervals between the periods, such as /26, /27, or even /22, is totally OK.
The key is to revert to thinking about network IDs and subnet masks as binary integers rather than dotted decimal numbers.
Let’s start subnetting the 192.168.4.0/24 network of the café. To make the /24 subnet a /25 subnet, change a zero on the subnet mask to a one:
Calculating the Number of Hosts
Before you proceed any further, you must first answer the following question: How many hosts can you have on a /24 network? You might say 192.168.4.1 to 192.168.4.254 = 254 hosts if you used dotted decimal notation.
Instead, do it from the binary. There are eight zeros in a /24 network that may be used as the host ID:
254 = 00000001 to 11111110
There’s a basic arithmetic problem here: 2x – 2, where x is the subnet mask’s number of zeros:
2 + 28 = 254
You can always find the number of hosts for a given subnet if you remember this easy formula. This is really important! Keep this in mind!
What is the maximum number of hosts you can have on a network using a /26 subnet mask?
A /26 subnet has 6 zeros remaining after the 26 ones since a subnet mask always contains 32 bits. Total hosts: 26 – 2 = 62
Excellent! Knowing how to calculate the number of hosts for a given subnet mask will come in handy later, as you’ll see.
Let’s create some subnets now. A single network ID is used to start all subnetting. In this case, you’ll need to split the café’s 192.168.4.0/24 network ID into three separate network IDs: one for public computers, one for private PCs, and one for wireless clients.
The current subnet mask is the fundamental instrument for subnetting. Make a binary version of it. At the end of the ones, draw a line.
Draw a second line one digit to the right of the first. You’ve now divided the subnet mask into three sections, which we’ll refer to as the default subnet mask (DSM), the network ID extension (NE), and the hosts (from left to right) (H). These aren’t industry jargon, so they won’t appear on the CompTIA Network+ test, but they’re a useful technique that makes subnetting much simpler.
Putting the subnet mask together
You now have a subnet mask of /25. Most folks who are just learning how to subnet start to panic at this time. The thought that a /25 subnet mask won’t fit into one of the three attractive subnets of 255.0.0.0, 255.255.0.0, or 255.255.255.0 is a hurdle for them. “That can’t be right!” they thought.
Only 255s and 0s are used in subnet masks.” That is incorrect. A subnet mask is made up of a series of ones and zeros. Only to input data onto computers, people convert it to dotted decimal. As a result, change /25 to dotted decimal. Begin by writing 25 ones, then 7 zeros. (Subnet masks must always be 32 binary digits long.)
Every eight digits should have a period between them:
Then, in dotted decimal, transform the result:
Prepare yourself for subnet masks that include more than 255s and 0s. Here are a few samples of entirely legal subnet masks to get you started. To see for yourself, convert them to binary.
When subnetting a network ID, you must follow the rules and conventions established by the people who created TCP/IP to guarantee that your new subnets can communicate with each other and bigger networks correctly.
All you have to know about subnetting is to start with a starting subnet mask and gradually increase the subnet extension until you have the desired number of subnets.
The number of subnets you construct is calculated using the formula 2y, where y is the number of bits in the subnet mask that are changed from host bits (zeroes) to network bits (ones).
255.255.255.0 is the initial subnet. It’s simply a single digit if you change the network ID extension over one digit: 21.
That single number can only be a one or a zero, giving you two subnets. You just have one issue: the café requires three subnets, not two! So, let’s subnet the original /24 down to /26. By adding two digits to the network ID, four additional network IDs are created: 4 + 22 = Convert the original network ID—192.168.4.0—into binary to view each of these network IDs.
Then, towards the end, add the four separate network ID extensions.
Return to dotted decimal with these four network IDs.
|Network ID||Host Range||Broadcast Address|
After the network ID, the host ranges begin with the first address accessible. The first is self-evident, since the network ID finishes with a 0 in the fourth octet, implying that the first host has a 1 in the fourth octet.
Because the broadcast address is the final accessible address on the subnet, the last number available in the host range is one number before the start of the following network ID.
Congratulations! You’ve just subnetted 192.168.4.0/24, a single network ID, into four new network IDs!
The café only requires three subnets, but you established four, therefore you now have an additional subnet. You’ll typically construct more subnets than you need since subnets are generated by powers of two—welcome to subnetting.IPv6 subnetting is quite different. An RIR will get a /23 from IANA and convert it to a /32 for an ISP using CIDR. The ISP, in turn, will subnet each client site’s /32 into a /48, which will be subnetted into a /64 for each network. ISPs often assign the /56 prefix to houses. For each network, the home router will convert this to a /64. A /64 prefix is used in all IPv6 networks (the IPv6 term for subnet mask).
When a network is subnetted, each subnet will always have the same number of hosts. This “one-size-fits-all” strategy isn’t scalable. Consider two physically linked routers in a subnet where only two addresses are required. You’re wasting 28 addresses if your subnetting strategy only allows for 30 hosts per subnet! Subnetting a subnet using variable-length subnet masking (VLSM) enables an internetwork to have distinct subnet masks (which translates to varying sizes) for different networks. In a word, regard one of your subnets as a big classful network and further subnet it. One or more of the /26 subnets in the above example might be changed to a /27, /28, /29, or /30 subnet. You’ll now have networks of various sizes with various masks. It also enables an ISP or RIR to provide consumers with a variety of network sizes from the outset.
Routers do supernetting, which merges several destination network entries into a single entry. The fewer rows a router has to analyse to decide how to route a packet, the more efficient it will be. In a router’s routing table, for example, instead of 192.168.4.0/24, 192.168.5.0/24, 192.168.6.0/24, and 192.168.7.0/24 (all of which have the same next-hop IP address on the router), supernetting merges those four networks into a single entry that represents all four networks: 192.168.4.0/22.
Each network has a 1 in the 4s column of the third octet, in addition to the precise first two octets:
00000101 = 5 00000110 = 6 00000111 = 7 00000100 = 4 00000101 = 5 00000110 = 6 00000111 = 7
The new /22 mask tells the router to stop looking at the address after this column.
It’s worth noting that supernetting shifts the network border to the left, while subnetting shifts it to the right.