IP v4 Calculator

IP address
Net mask
CIDR to network mask

CIDR is the number of continuous bits of 1s in IP binary notation.

Examples:

  • Mask /24:

    11111111 11111111 11111111 00000000
       255      255      255        0
  • Mask /12:

    11111111 11110000 00000000 00000000
       255      240        0        0
Network address

Network address is obtained by doing bitwise operation AND on IP and Network Mask. AND operation sets bit when both bits in IP and MASK are set.

Examples:

  • 192.168.1.100/24 => 192.168.1.0/24:

       192      168        1      100
    11000000 10101000 00000001 01100100
    11111111 11111111 11111111 00000000
       255      255      255        0
    ======== ====== AND ====== ========
    11000000 10101000 00000001 00000000
       192      168        1        0
  • 10.28.224.67/12 => 10.16.0.0/12:

        10       28      224       67
    00001010 00011100 11100000 01000011
    11111111 11110000 00000000 00000000
       255      240        0        0
    ======== ====== AND ====== ========
    00001010 00010000 00000000 00000000
        10      16         0        0
Broadcast

Broadcast address is obtained by doing bitwise operation OR between IP address and on mask length part of IP address, then sets bit 1s on the rest part.

Using only bitwise operators it can be obtained by using operator OR between IP address and negated (NOT) mask. IP OR (NOT MASK).

In 31-bit prefixed mask, that is used by Point-to-Point Links is no directed broadcast. Any packet which is transmitted by one client is always received by the other. Limited broadcast (255.255.255.255) is obsolete, but may still be used in a network.

Examples:

  • 192.168.1.100/24 => 192.168.1.255:

       192      168       1       100
    11000000 10101000 00000001 01100100
    11111111 11111111 11111111 00000000
       255      255      255       0
    ======== == AND = ========
    11000000 10101000 00000001 11111111
       192      168       1      255
  • 10.28.224.67/12 => 10.31.255.255:

        10       28      224       67
    00001010 00011100 11100000 01000011
    11111111 11110000 00000000 00000000
       255      240        0        0
    ======== ====== AND ====== ========
    00001010 00011111 11111111 11111111
        10       31      255      255
Hosts range (min/max)

First usable IP address is the next one of network address.

Last usable IP address is the one before broadcast.

Examples:

  • Network address 192.168.1.0/24

    Broadcast 192.168.1.255/24

    Network usable IP range:

    192.168.1.1 - 192.168.1.255

  • Network address 10.16.0.0/12

    Broadcast 10.31.255.255

    Network usable IP range:

    10.16.0.1 - 10.31.255.254

Maximum number of hosts

Number of hosts equation:

Hosts = 2(32-CIDR)-2

Examples:

  • Network address 192.168.1.0/24

    2(32-24)-2 = 254 hosts

  • Network address 10.16.0.0/12

    2(32-12)-2 = 1,048,574 hosts

Wildcard

Wildcard is obtained by using bitwise NOT operator on Network Mask. NOT operator sets bit 1 when it was 0 before and vice versa - sets 0 when it was 1.

Examples:

  • Mask /24:

    11111111 11111111 11111111 00000000
       255      255      255        0
    ======== ====== NOT ====== ========
    00000000 00000000 00000000 11111111
         0        0        0      255
  • Mask /12:

    11111111 11110000 00000000 00000000
       255      240        0        0
    ======== ====== NOT ====== ========
    00000000 00001111 11111111 00000000
         0       15      255      255
Windows DNS priority net mask (LocalNetPriorityNetMask)

In Microsoft Windows Server the netmask ordering feature is used to prioritize local resources, when returning an A DNS record to the client. An A record maps a domain name to the IPv4 address.

LocalNetPriorityNetMask is the same as Wildcard but in HEX notation

Examples:

  • Mask /24 (255.255.255.0)

    Wildcard: 0.0.0.255

    LocalNetPriorityNetMask: 0x000000FF

    Dnscmd /config /LocalNetPriorityNetMask 0x000000FF

  • Mask /12:

    Wildcard: 0.15.255.255

    LocalNetPriorityNetMask: 0x000FFFFF

    Dnscmd /config /LocalNetPriorityNetMask 0x000000FF

Here are some interesting trivia facts about IPv4 calculation
Subnetting

IPv4 calculation often involves subnetting, which is the process of dividing a larger IP network into smaller subnetworks. This allows for efficient allocation of IP addresses and better management of network resources.

CIDR Notation

Classless Inter-Domain Routing (CIDR) notation is commonly used in IPv4 calculation to specify IP addresses and subnet masks. CIDR notation represents an IP address followed by a slash ("/") and a number indicating the number of bits used for the network portion of the address. For example, "192.168.1.0/24" represents a network with a subnet mask of 255.255.255.0.

IPv4 Address Classes

IPv4 addresses were historically divided into five classes (A, B, C, D, and E) based on the number of bits used for the network and host portions of the address. However, with the adoption of CIDR, classful addressing is less common, and addresses are often allocated based on variable-length subnet masks (VLSM).

Private IP Address Ranges

IPv4 calculation may involve working with private IP address ranges reserved for internal use within organizations or private networks. These ranges include 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16.

Broadcast and Network Addresses

In IPv4 calculation, special addresses such as the broadcast address and network address are important considerations. The broadcast address is used to send data packets to all devices on a network, while the network address identifies the network itself.

Address Exhaustion

IPv4 calculation also involves considering the issue of address exhaustion due to the limited number of available IPv4 addresses (approximately 4.3 billion). This scarcity has led to the adoption of IPv6, which uses 128-bit addresses and offers a vastly larger address space.

Address Allocation

IPv4 calculation may involve determining how to allocate IP addresses efficiently within an organization or network. This includes considering factors such as the number of hosts, the desired number of subnets, and future scalability requirements.

Network Address Translation (NAT)

IPv4 calculation often includes planning for Network Address Translation (NAT), a technique used to conserve public IPv4 addresses by allowing multiple devices within a private network to share a single public IP address when accessing the internet.

These trivia facts illustrate the various aspects and considerations involved in IPv4 calculation, including subnetting, address classes, private IP ranges, and techniques for conserving IP addresses. Fascinating, isn’t it?