How To Mask IP Address

Last Updated 3/27/2017

In computer networks, a subnetwork or subnet is a range of logical addresses within the address space that is assigned to an organization. Subnetting is a hierarchical partitioning of the network address space of an organization (and of the network nodes of an autonomous system) into several subnets. Routers constitute borders between subnets. Communication to and from a subnet is mediated by one specific port of one specific router, at least momentarily.

A typical subnet is a physical network served by one router, for instance an Ethernet network (consisting of one or several Ethernet segments or local area networks, interconnected by network switches and network bridges) or a Virtual Local Area Network (VLAN). However, subnetting allows the network to be logically divided regardless of the physical layout of a network, since it is possible to divide a physical network into several subnets by configuring different host computers to use different routers.

The address to all nodes in a subnet starts with the same binary sequence, which is its network id and subnet id. In IPv4, the subnet may be identified by its base address and subnet mask.

Network address and logical address

The term network address sometimes refers to logical address, i.e. network layer address such as the IP address, and sometimes to the first address (the base address) of a classful address range to an organization.

Computers and devices that are part of internetworking network such as the Internet all have a logical address. The network address is unique to that device and can either be dynamically or statically configured. This address allows the device to communicate with other devices connected to the network. The most common network addressing scheme is IPv4. The IPv4 network address consists of a 32 bit address divided into 4 octets and a subnet mask of like size. In order to facilitate the routing process the address is divided into two pieces, the network address and the host address. This works much like a postal address where the network address would represent the city and the host address would represent the street address. The subnet mask is used in conjunction with the network address to determine which part of the address is the network address and which part is the host address.

Binary subnet masks

While subnet masks are often represented in dot-decimal form, their use becomes clearer in binary. Looking at a network address and a subnet mask in binary, a device can determine which part of the address is the network address and which part is the host address. To do this, it performs a bitwise "AND" operation.

Full Network Address
192.168.5.10       11000000.10101000.00000101.00001010
Subnet Mask
255.255.255.0     11111111.11111111.11111111.00000000
Network Portion
192.168.5.0         11000000.10101000.00000101.00000000
Client Portion
0.0.0.10              00000000.00000000.00000000.00001010

Subnet masks consist of a series of 1s in binary followed by 0s. The 1s designate that part of the address as being part of the network portion and the 0s designate that part as being part of the host address. Subnet masks do not have to fill a given octet. This allows a classful network to be broken down into subnets. A classful network is a network that has a subnet mask of 255.0.0.0, 255.255.0.0 or 255.255.255.0. Subnet masks can also be expressed in a shorter form, known as Classless Inter-Domain Routing (CIDR) notation, which gives the network number followed by a slash ("/") and the number of 'one' bits in the binary notation of the netmask (i.e. the number of relevant bits in the network number). For example, 192.0.2.96/24 indicates an IP address where the first 24 bits are used as network address (same as 255.255.255.0).