RouteDuck

IP addressing

IPv4 Subnet Calculator

Enter an address and a prefix length. You get the network, masks, usable range and broadcast address, and the configuration lines that use them.

You can paste 10.1.2.3/20 or an address and mask.
Network bits: 24Host bits: 8

Configuration lines

Cisco IOS interface
ip address 192.168.1.100 255.255.255.0
Cisco NX-OS interface
ip address 192.168.1.100/24
OSPF network statement
network 192.168.1.0 0.0.0.255 area 0
Access list entry
permit ip 192.168.1.0 0.0.0.255 any
Prefix list entry
ip prefix-list NAME permit 192.168.1.0/24
Static route
ip route 192.168.1.0 255.255.255.0 NEXT-HOP

Replace the area, NAME and NEXT-HOP with your own. Check each line against your platform before using it.

Result

Network
192.168.1.0/24
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
First usable
192.168.1.1
Last usable
192.168.1.254
Broadcast
192.168.1.255
Total addresses
256
Usable hosts
254
Address type
Private (RFC 1918)
Legacy class
C

Other forms

Address in binary
11000000.10101000.00000001.01100100
Mask in binary
11111111.11111111.11111111.00000000
Address in hex
0xC0A80164
Address as integer
3232235876
Reverse DNS name
100.1.168.192.in-addr.arpa

How the calculation works

A prefix length says how many of the 32 bits in an address identify the network. The remaining bits identify hosts. The subnet mask has a one for every network bit, and the wildcard mask is the subnet mask inverted.

The network address is the address with every host bit cleared. The broadcast address is the same address with every host bit set. A subnet with h host bits holds 2 to the power h addresses; the network and broadcast addresses cannot be given to hosts, so a /24 holds 256 addresses and 254 usable ones.

/31 and /32

A /31 holds two addresses and both are usable on a point-to-point link, as RFC 3021 defines. It has no broadcast address. A /32 is a single host, as used for loopbacks and host routes.

Subnet mask or wildcard mask

On Cisco IOS, interface addresses and static routes take the subnet mask, while access lists and OSPF and EIGRP network statements take the wildcard mask. NX-OS accepts a prefix length for interface addresses and in access lists.

Related tools