Where to buy Submit Orders
Home / Resources / Blog & News

What is IP Address and Subnet Mask?



This article will introduce you what is ip address and subnet mask. You can learn how to subnet on this page. Let's get started.

The Internet communicates based on the TCP/IP protocol. When configuring TCP/IP protocol, each device needs three settings:

1. ip address 2. subnet mask 3. default gateway


To configure TCP/IP correctly, you must understand these and how to divide subnets Mask. Be focused, this article will spend you about 15mins.

The composition of IP address: Networks and hosts

The ip address is also called InternetProtocolAddress, is composed of 4 bytes of data, and each byte is composed of 8 bits, so each ip address has 32 bits. The ip address is assigned to each device running in the TCP/IP network, including switches, routers, computers, printers, etc., each of which has an independent ip address. For example, 11000000 01010001 11111110 10000010, after converting the binary address to decimal, it becomes a standard ip address type:


ipv4 address

IP address types

IP addresses are divided into classes A, B, C, D, and E. The last two  are special addresses that have nothing to do with users. The following will introduce Type A, Type B, and Type C ip addresses.


Note: The address ( whose byte is 0 corresponds to the existing host. Therefore, the ip address ( whose every byte in the ip address is 1 is the broadcast address of the existing subnet.


ipv4 address classes


Class A address:

 The first bit of category A must be 0. 

Address range:

Default subnet mask: or 0xFF000000 (hexadecimal) Generally used for large networks.

Class B address:

The first 2 bits of the Class B address are fixed at 10. 

Address range:

The default subnet mask: or 0xFFFF0000 (hexadecimal) Generally used in medium-scale networks.

Class C address:

The first 3 bits are fixed at 110.

Address range: 

Subnet mask: or 0xFFFFFF00 (hexadecimal) Generally used in small networks.

What is Subnet mask?

To make the TCP/IP wide area network work efficiently, the router that transmits the data packet between the local area networks does not know the exact location of the destination host of the data packet. The router only knows which local area network the host is a member of, and uses the information stored in its routing table to determine how to send the packet to the target host's network.


Accordingly, we can use the subnet mask to segment existing ip addresses into network addresses and host addresses. Therefore, it is possible to determine which subnet the host is on.


The subnet mask also consists of 8 bytes, 32 bits. The 1 part of the subnet mask is represented as the network address, and the 0 part is the host address.


Assuming that is the subnet mask of the ip in this example:

11000000 01010001 11111110 10000010 (ip address

111111111 111111111 11111111 10000000 (subnet mask


AND ( && )  the two, the address obtained is the network address

11000000 01010001 1111110 1000000 (The network address is


Invert the subnet mask and then perform the AND operation( && )  with the ip address to obtain the host address:

11000000 01010001 11111110 10000010 (ip address

00000000 00000000 0000001 011111111 (reverse the subnet mask)


Calculation results:

0000000 0000000 0000000 00000010 (The host address is

In this case, the data packet reaches the subnet, and the destination address is


However, in reality, we will not use binary or decimal data to represent the subnet mask. We will use a method called CIDR: (Classless Inter-Domain Routing). We need to understand this kind of network representation.


The format is as: The first number is our network address, the following 28 means using 28 bits to represent the network bits, and 32-28=4 bits to represent the host bits.


Through CIDR, we can clarify two pieces of information:

Network address:

Subnet mask:


Subnet mask



















Why are we Subnetting?

Subnetting can further reduce network traffic. If there is no reliable router, network traffic may cause the entire network to stop, but with a router, most of the traffic will stay in the local network, and only packets destined for external networks will traverse the router. The router adds broadcast domains. Hence the more broadcast domains there are, the smaller the subnet domains each broadcast is divided into, and the smaller the network traffic for each network segmentation.


The subnet division can be regarded as insufficient network bit, so find the host bit to borrow. Taking the above example, is a class C address, and its subnet mask should be, but it is actually, and the last byte becomes 11110000. Here is the network bit borrowed 4 bits from the host. Then the subnet mask creates 2^4 subnets, and 4 is the borrowed bits. The number of hosts contained in each subnet is 2^4 -2, where 4 is the number of hosts that have not been borrowed. 2 is the address when the host bits are all 1 and all 0.


What is the network address and host address of ip address How many subnets are there? How many hosts are there in each subnet?


If you don't understand how to calculate, come to contact QSFPTEK customer service staff to get the answer. QSFPTEK has a team of technical engineers to serve our users. See you in the next blog.


Note: Part of the content reference: https://en.wikipedia.org/wiki/IP_address


Contact us