Understanding Private IP Ranges: Why 192.168.122.1 is Valid and How It Differs from Classful Addressing


4 views

Many developers still reference the outdated classful network division when working with private IP addresses:

Class A: 10.0.0.0 - 10.255.255.255 (8-bit network)
Class B: 172.16.0.0 - 172.31.255.255 (16-bit network)
Class C: 192.168.0.0 - 192.168.255.255 (24-bit network)

With Classless Inter-Domain Routing (CIDR), the strict class boundaries no longer apply. The private IP ranges are defined in RFC 1918 as:

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16

The virbr0 interface you're seeing is completely valid because:

  • 192.168.0.0/16 allows any subnet mask from /16 to /30 within this range
  • Common practice uses /24 subnets for simplicity (like 192.168.122.0/24)
  • This provides 256 possible /24 networks within 192.168.0.0/16

Here's how libvirt typically configures virtual bridges:

<network>
  <name>default</name>
  <bridge name="virbr0"/>
  <forward mode="nat"/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254"/>
    </dhcp>
  </ip>
</network>

To check your network configuration:

# Show IP addresses
ip addr show virbr0

# Verify routing
ip route show

# Test connectivity
ping -c 4 192.168.122.1

You can create various subnet sizes within private ranges:

# /24 subnet (254 hosts)
192.168.0.0/24: 192.168.0.1 - 192.168.0.254

# /23 subnet (510 hosts)
192.168.0.0/23: 192.168.0.1 - 192.168.1.254

# Custom /25 subnet (126 hosts)
192.168.122.0/25: 192.168.122.1 - 192.168.122.126

The IP address 192.168.122.1 is perfectly valid within private networking space. Your initial understanding of private IP ranges needs updating as the classful networking concept (Class A/B/C) has been largely replaced by CIDR (Classless Inter-Domain Routing) in modern networking.

# Current IANA-defined private IP ranges:
10.0.0.0/8 (10.0.0.0 - 10.255.255.255)
172.16.0.0/12 (172.16.0.0 - 172.31.255.255)
192.168.0.0/16 (192.168.0.0 - 192.168.255.255)

The virbr0 interface you're seeing is a virtual bridge created by libvirt (commonly used with KVM/QEMU virtualization). The 192.168.122.0/24 subnet is libvirt's default network configuration.

# Checking libvirt default network configuration
virsh net-list --all
virsh net-dumpxml default

# Example output showing the 192.168.122.0/24 range:
<network>
  <name>default</name>
  <uuid>...</uuid>
  <bridge name="virbr0"/>
  <forward mode="nat"/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254"/>
    </dhcp>
  </ip>
</network>

The 192.168.x.y format doesn't imply class B networking. The entire 192.168.0.0/16 range is available for private use, which can be divided into 256 possible /24 subnets (like 192.168.122.0/24).

# Calculating network ranges
ipcalc 192.168.122.1/24

# Output:
Address:   192.168.122.1
Netmask:   255.255.255.0 = 24
Wildcard:  0.0.0.255
Network:   192.168.122.0/24
HostMin:   192.168.122.1
HostMax:   192.168.122.254
Broadcast: 192.168.122.255
Hosts/Net: 254

You can easily create additional private networks with different subnets:

# Example XML for a new 192.168.100.0/24 network
cat > custom_network.xml << EOF
<network>
  <name>custom-net</name>
  <bridge name="virbr1"/>
  <forward mode="nat"/>
  <ip address="192.168.100.1" netmask="255.255.255.0"/>
</network>
EOF

# Define and start the new network
virsh net-define custom_network.xml
virsh net-start custom-net
virsh net-autostart custom-net

To check your current network interfaces and their configurations:

ip -4 addr show
ip route show
nmcli device show