Home Categories Other Resources articles Tutorial

TCP/IP addressing and subnetting a network

TCP/IP Address Classes

3.7/5.0 (17 votes total)
Rate:

Team uCertify
July 24, 2006


Team uCertify
Founded in 1996, uCertify is a leading provider of exam preparation solutions for certification exams of all the major IT vendors. uCertify products provide certification candidates a complete coverage of exam objectives with extremely realistic practice tests, comprehensive study notes and guides and other value added features to help them to excel in the exams. The continuously growing range of uCertify products include Exam Simulation PrepKits and Collections (a PrepKit bundle for a specific certification) for MCSE 2003, MCSA, MCDBA, MCAD, OCA, OCP, A+, Network+, Security+, CIW Associate, CIW Professional, SCJP and other significant certifications.
Team uCertify has written 8 articles for WebKnowHow.
View all articles by Team uCertify...

The network ID uniquely identifies a network within a larger TCP/IP internetwork (a network of networks) on which a host is found. All the nodes that are within a common network use the same network ID within their full IP address. The other part of an IP address is the host ID, also known as a host address, which uniquely identifies a TCP/IP host (a workstation, server, router, or other TCP/IP device) within each network. An IP address is segmented into four sections of 8-bit octets. They are denoted in dotted decimal notations. The octets are converted to decimal (base-10 numbering system) and separated by periods.

The following is an example of a TCP/IP address:

BINARY FORMAT DECIMAL FORMAT
10000011.01101011.00010000.11001000 131.107.16.200


Classes of IP addresses:


IP addresses are divided into five classes: A, B, C, D, and E. These classes define the number of bits that can be used for the network ID and the host ID of each address. Class A, B, and C IP addresses are used for assignment to TCP/IP hosts.


Class A: In a Class A IP address, the first octet of the IP address is always between 0 and 127 and represents the network ID, and the remaining three octets are used to represent the unique host ID on the network. There are a maximum of 128 Class A network numbers, and each number is capable of supporting 16,777,214 unique hosts. In this type of IP addresses; the first and the last network numbers are reserved. Hence, there are potentially 126 Class A networks and the actual range of the first octet is always between 1 and 126. In a class A IP address, the highest order binary bit (the leftmost bit of the 32-bit binary number) is always 0.
Class B:If the first octet of an IP address is between 128 and 191, it is a Class B IP address. In a Class B IP address, the first two octets (starting from the left) are used to represent the network numbers and the remaining two represent the unique host ID on the network. An example of a Class B IP address is 167.20.91.203 where 167.20 is the network number and 91.203 is the host ID. There are 16,384 Class B networks and each network can support a maximum of 65,534 unique hosts. In a Class B address, the two leftmost binary bits are always 10.
Class C:If the first octet of an IP address is between 192 and 223, it is a Class C IP address. In a Class C IP address, the first three octets (starting from the left) are used to represent the network numbers and the remaining octet stands for representing the unique host. An example of a Class C IP address is 192.168.1.2 where 192.168.1 is the network number and the host ID is 2. Therefore, there are 2,097,152 Class C network numbers and each network can support a maximum of 254 unique hosts. In a Class C address, the three leftmost binary bits are always 110.
Class D: If the first octet of an IP address is between 224 and 239, it is a Class D address. Class D addresses are used for multicasting to a group of IP hosts and are not assigned to individual devices on a TCP/IP network. In a Class D IP address, the four leftmost binary bits are always 1110.
Class E:If the first octet of an IP address is in the range of 240-255, it is a Class E address. Like Class D addresses, Class E addresses also cannot be assigned to individual devices on a TCP/IP network. Instead, they are reserved for experimental and future use. In a Class E address, the four leftmost binary bits are always 1111.
Loopback addresses: Loopback addresses are IP addresses with 127 in their first octet. These addresses are used to test TCP/IP configuration and hence cannot be used for assignment to individual hosts on a TCP/IP network. The most frequently used loopback address is 127.0.0.1.


IP address table:


Class 1st Octet Range Network ID Host ID Number of networks Number of Host ID's per network Assignable to Hosts?
A 1-126 w x.y.z 126 16,777,214 Yes
B 128-191 w.xy.z 16,392 65,534 Yes
C 192-223 w.x.y z 2,097,150 254 Yes
D 224-239 N/A N/A N/A N/A No
E 240-255 N/A N/A N/A N/A No
Loopback 127 N/A N/A N/A N/A No


Note: w, x, y, or z represents an octet of an IP address.


There are some rules about valid IP addresses, which are described as follows:


 

  1. The first octet of an IP address must fall within the following ranges:
    • 1-126
    • 128-191
    • 192-223
  2. A valid IP address cannot start with 0, 127, or 224-255.
  3. The host ID of the IP address cannot be all binary 0s or 1s.
  4. The decimal value of any octet in an IP address cannot be greater than 255.
  5. An IP address cannot be greater than 255.


Subnet Masks:Network IDs and host IDs within an IP address are distinguished by using a subnet mask. It tells a TCP/IP host how to interpret IP addresses by defining what portion of IP address is network ID and what portion is host ID. A subnet mask uses consecutive bit groups of all 0s or 1s. All 1s identify the network ID and all 0s identify the host ID portions of an IP address. Hence, a 255 in a subnet mask indicates that the corresponding octet in an IP address is a part of a network number. On the other hand, a 0 in a subnet mask indicates that the corresponding octet in the IP address is a part of the host ID.


For example, the following is an example of a 32-bit subnet mask used with the IP address

131.107.16.200:11111111.11111111.00000000.00000000

By analyzing this subnet mask, one can know the IP address Class. As in the above example, we can see that there are sixteen 1s and sixteen 0s, which indicates that the IP address belongs to the Class B network.


IP address class Default subnet mask (in decimal) Default subnet mask (in binary)
Class A 255.0.0.0 11111111.00000000.00000000.00000000
Class B 255.255.0.0 11111111.11111111.00000000.00000000
Class C 255.255.255.0 11111111.11111111.11111111.00000000


Subnet masks are used by hosts to determine their network numbers and to know whether the destination host is on the same network or on a different network. Subnet masks are referenced in either dotted notation or Classless Inter Domain Routing (CIDR) notation. CIDR notation notes the number of binary 1s in the subnet mask. This number is placed at the end of the network ID.


An example of a CIDR notation for Class B IP addresses is shown as follows:


Network ID Subnet Mask CIDR Notation
192.168.1.0 255.255.255.0 192.168.1.0/24
172.16.0.0 255.255.0.0 172.16.0.0/16


In the above example of subnet mask (in the CIDR Notation column), the value of 24 refers to 24 binary 1 bits in the subnet mask. Since, in the subnet mask, there are three 255s and each value of 255 represents 8 bits, there are 8*3=24 binary 1 bits in the mask.


Subnetting an IP network number:


Subnetting is a process of subdividing a single IP network into multiple smaller networks with unique subnetted network IDs in order to reduce the size of the broadcast domain and better utilize the bits in the host ID. It is accomplished by modifying the subnet mask values. Subnetted network IDs are created by using bits from the host ID of the original class-based network ID.

Example 1:


A class B network of 139.12.0.0 can have up to 65,534 nodes. Due to a large number of nodes, the broadcast domain is very large. In this situation, subnetting is performed to make the broadcast domain smaller. Network 139.12.0.0 is subnetted by utilizing the first 8 host bits (the third octet) for the new subnetted network ID. When 139.12.0.0 is subnetted, separate networks with their own subnetted network IDs (139.12.1.0, 139.12.2.0, 139.12.3.0) are created.

Example 2:


If a subnet mask of 255.255.255.0 is applied to a Class B IP address of 174.15.0.0, the first three bytes (as is clear from the subnet mask) are represent a network ID, and only the rightmost byte is interpreted as a host ID. Although the address belongs to Class B, subnetting the third byte now can be used to define several subnetworks or subnets. Therefore, the broadcast domain will become smaller and each subnet will support fewer host IDs.


Add commentAdd comment (Comments: 1)  
Title: Subnetting October 16, 2006
Comment by Pubudu Rathnayake

very usefull article as it explains the basics of the IP classes and subnetting.

Advertisement

Partners

Related Resources

Other Resources