Q1. What is the relationship between IP subnets and Layer 2 connectivity?

Hosts in the same IP subnet are usually treated as on-link, so they try to communicate directly through Layer 2 instead of using a Layer 3 gateway.

On-link means that an IP address is treated as reachable on the same link as the current device, so the device tries to resolve that IP address’s Layer 2 address directly. The on-link IP may be the final destination IP or a next-hop gateway IP.

“Same link” means the Layer 2 reachability scope where the current device can try to reach another IP address directly, without sending the packet to a Layer 3 gateway first.

In other words, if an IP address is considered to be on the same link, the device treats that address as directly reachable through one of its local network interfaces. So it tries to discover the destination’s Layer 2 address, such as a MAC address, using ARP in IPv4 or NDP in IPv6.

In a typical IPv4 host configuration, assigning an IP address and prefix length to a network interface causes the operating system to add a connected route whose destination prefix is that subnet. If a destination IP falls within that prefix, the connected route is selected, so the host treats the destination as on-link and tries to resolve the destination’s Layer 2 address directly instead of sending the packet to a gateway.

Q5. What is a connected route?

A connected route is a routing-table entry for an IP prefix that the current device treats as directly reachable through one of its own network interfaces, without using another router as the next-hop gateway.

Q6. What is an IP subnet?

An IP subnet is a block of IP addresses identified by a network address and a prefix length, such as 192.168.1.0/24.

Q7. What is the difference between a subnet and an IP subnet in networking?

In ordinary networking contexts, a subnet usually means an IP subnet.

Q8. What is a prefix length?

A prefix length is the number of leading bits in an IP address that are used as the network prefix. For example, in 192.168.1.0/24, the prefix length is 24.

Q9. What is a network prefix?

A network prefix is the leading bit sequence of an IP address with a specified prefix length. For a prefix length of n, the first n bits form the network prefix, and the remaining bits form the host part. All addresses in the same IP subnet share the same network prefix.

An IP subnet is defined by a network prefix and a prefix length. IP addresses in the same IP subnet share that network prefix.