Subnet Mask /32 – What Does a Subnet Mask /32 Mean?

ipv4networkingroutersubnettcpip

I see in this question, the routing table has:

192.168.1.1/32     link#4             UCS             2        0     en0
openwrt.lan        46:94:fc:63:fc:7   UHLWIir        11     3610     en0   1200
192.168.1.125/32   link#4             UCS             2        0     en0

What does it mean to have a subnet mask of /32 and in that case what will be its network ID? Can a host exist without a network ID in case we consider the above as a single host?

As far as I know, the network ID and IP address assigned to a host in that network are 2 different things. 192.168.0.0 is a network ID and if its subnet is 255.255.255.0, then the hosts in this network can be 192.168.0.1 – 192.168.0.254. In this case how a host can exist without a network ID?

Linked : Why is my subnet mask 255.255.255.255?

Best Answer

There's a bit of confusion here; that /32 doesn't refer to the size of any (sub)network, but to the range of addresses that particular routing table entry applies to. Usually the two are the same (because you route a network or subnet as a unit, right?), but macOS does things a little different for other hosts on the same local network. Let me add some lines before the ones you quoted:

Destination        Gateway            Flags        Refs      Use   Netif Expire
default            openwrt.lan        UGSc           10        0     en0
...
192.168.1          link#4             UCS             2        0     en0
192.168.1.1/32     link#4             UCS             2        0     en0
openwrt.lan        46:94:fc:63:fc:7   UHLWIir        11     3610     en0   1200
192.168.1.125/32   link#4             UCS             2        0     en0

Note that 192.168.1 (short for 192.168.1.0/24) is routed over en0 (aka link#4); not via any gateway, just over the interface itself. This is the network that the Mac itself is on. 192.168.1.1 and 192.168.1.125 are both specific addresses within that network range. If you compare those /32 entries with the 192.168.1 entry, they're basically redundant duplicates; they say the same thing, just about specific addresses instead of the entire network range.

I don't know why macOS creates these redundant address-specific entries, but it's probably related to another thing you can see in the listing above: macOS lists its ARP table entries in the routing table. The "openwrt.lan" entry above (which I'm pretty sure is actually 192.168.1.1, just listed by name rather than number) says that it's routed via en0 to the MAC address 46:94:fc:63:fc:7.

So what you're seeing in the route listing is a mix of actual network routes (like the "default" and 192.168.1 entries), and per-host entries (the /32 and MAC-targeted entries).

Related Question