The /30 subnet
A /30 subnet uses the mask 255.255.255.252 and holds 4 addresses, 2 of them usable.
Reference data last reviewed:
The /30 mask is 30 network bits followed by 2 host bits, for a total of 32 bits.
Why /30 is the classic point-to-point size
Four addresses: one network, two hosts, one broadcast. Those two hosts are exactly what a link between two routers needs, which is why /30 shows up constantly in enterprise WAN and firewall handoff designs.
Where both ends support RFC 3021 you can use a /31 instead and spend two addresses rather than four. On kit that predates that support, or in a design that wants a broadcast address on the link, /30 remains the safe choice.
A /30 gives you four addresses and two usable hosts, with the mask 255.255.255.252. It is the classic size for a point-to-point link between two routers when RFC 3021 /31 support is not available.
The four addresses break down as one network, two hosts, and one broadcast. That two-host budget is exactly what a WAN link or a firewall-to-router handoff needs, which is why /30 shows up constantly in enterprise routing.
Below you can see the exact network, broadcast, and host range for any /30 you enter, calculated instantly in your browser.
Calculate a /30 network
Accepts CIDR (192.0.2.0/24), IP + mask (192.0.2.0 255.255.255.0), or a bare IP (defaults to /24).
11000000.00000000.00000010.0000000011111111.11111111.11111111.11111100Example: 192.0.2.0/30
Taking 192.0.2.0/30 as a worked example, the block breaks down like this:
| Network address | 192.0.2.0 |
|---|---|
| Usable range | 192.0.2.1 - 192.0.2.2 |
| Broadcast address | 192.0.2.3 |
| Total addresses | 4 |
| Usable hosts | 2 |
| Size | 1/64 of a class C block |
A note on the example: 192.0.2.0 is in 192.0.2.0/24, documentation (test-net-1) space under RFC 5737. Reserved for examples and documentation. Safe to print, never routed. Every example on this site uses reserved space on purpose, so nothing here points at somebody's real network.
Splitting a /30 into smaller subnets
Borrowing bits from the host part doubles the number of subnets and halves the size of each one. This is what a /30 looks like at the next 2 prefix lengths.
| Split into | Subnets | Mask | Usable hosts each |
|---|---|---|---|
| /31 | 2 | 255.255.255.254 | 2 |
| /32 | 4 | 255.255.255.255 | 1 |
Each subnet has to start on a multiple of its own size, which is what keeps the blocks from overlapping. Working the other way, from a host count back to a prefix, is what subnet by host count is for.
Do this from the terminal
The same numbers are available as keyless JSON, and there are good local tools that need no network at all. Naming them costs nothing and is more useful than pretending this page is the only option.
curl -s https://subnetkit.dev/api/cidr/30.json | jq # or locally, with no network at all: ipcalc 192.0.2.0/30 sipcalc 192.0.2.0/30
ipcalc ships in most Linux distributions and sipcalc handles IPv4 and IPv6. The SubnetKit API is the one to reach for in a build step or a script that wants the same values this page shows.
Frequently asked questions
What is the subnet mask for a /30?
A /30 uses the subnet mask 255.255.255.252. Its wildcard mask, used in access lists, is 0.0.0.3.
How many hosts are in a /30 subnet?
A /30 has 4 total addresses and 2 usable hosts (the total minus the network and broadcast addresses, except for /31 and /32).
What is a /30 used for?
Point-to-point link (2 usable). It is equivalent to 1/64 of a class C block.
How do I calculate a /30 network?
Set the host bits to zero for the network address and to one for the broadcast address. The calculator on this page does it for any /30 block you enter.
How many /31 subnets fit in a /30?
2, each with 2 usable hosts and the mask 255.255.255.254. Every extra bit you borrow doubles the number of subnets and halves the size of each one.
Opening a port on a /30
A firewall rule needs two halves: the range and the port. The wildcard mask 0.0.0.3 matches this whole block in an access list. For the other half, the port number reference lists what each TCP and UDP port carries and whether it is encrypted by default, so you can tell what you are about to expose to 2 addresses.
Sources
The arithmetic on this page follows the documents below. Every number is computed from the prefix length rather than stored, and the calculation is covered by tests over all 33 prefixes.
- RFC 4632: Classless Inter-domain Routing (CIDR), the address assignment and aggregation plan
- RFC 1878: Variable Length Subnet Table for IPv4
- RFC 3021: Using 31-bit prefixes on IPv4 point-to-point links
- RFC 1918: Address allocation for private internets
- RFC 6598: IANA-reserved IPv4 prefix for shared address space (carrier-grade NAT)
- RFC 5737: IPv4 address blocks reserved for documentation
- IANA IPv4 Special-Purpose Address Registry
Spotted something wrong? Tell us and it gets corrected. How the data is maintained is described on the about page.