Packet Routing Between Subnets on Same VLAN

routingsubnetswitchingvlan

I am trying to understand how packets are routed within the same VLAN. I understand that typically there should be a 1:1 mapping between VLANs and Subnets. However if i deploy the following configuration (shown in below figure), would the host 192.168.0.1 be able to access host 10.0.0.1 without a router in the middle?

The figure shows 4 hosts on two different networks 192.168.0.0/24 and 10.0.0.0/24, connected by a layer 2 switch. All ports on the switch are configured to vlan 10

enter image description here

Best Answer

Generally you need a router to route between the subnets. One common configuration is to have one router interface with two IP addresses on it in two different subnets (Cisco calls the second one a “secondary IP”).

Here are some cases where that is useful:

  1. You originally allocated a /24 to the subnet but now have more than 254 hosts during peak times. Rather than renumbering into a /23, you add a /25 secondary.
  2. You are in the middle of renumbering, and have both subnets available during the transition to minimize impact.
  3. You provide Internet routable subnet for workstations and RFC1918 address space for IP-phones, printers, SAN infrastructure, etc... (this can make your DHCP configuration complicated, but simplifies access port provisioning).

It might be possible to configure the end hosts to talk directly on both vlans, but that can be error prone. Simpler configs are more reliable (one IP per host, one subnet per vlan).

End hosts with multiple IP addresses suffer endless problems because every time they initiate a socket they have to pick a source IP address for that socket: but end hosts don’t have the routing information to make an intelligent decision about which source IP address is optimal.

Note that every dual protocol IPv4/IPv6 network in effect has two different subnets on one vlan. Those subnets cannot talk to each other at all because they are different IP protocols. Modern operating systems incorporate substantial intelligence to decide whether to contact a destination over IPv4 or IPv6 (keyword: “happy eyeballs”).