Why we can't have the IPs on different subnets for the interfaces in same VLAN?
Since the ARP request is anyway broadcasted in VLAN , the destination machine will reply with its mac address and the source will have the MAC address for the destination interface.
The traffic should get forwarded this way, but its not, Any reason why its not the case?
Appreciate your response.
Lets understand the concept in this way:
Host A: 192.168.1.1/24, DG: 192.168.1.254
Host B: 192.168.2.1/24, DG: 192.168.2.254
Both are connected in Vlan 1 on the same switch.
If Host A would like to communicate with Host B, it would have to ARP to know the MAC for the destination.
- Broadcast is done within the same subnet. Destination IP: 192.168.2.1 does not belong to same subnet for the Host A, so it would send the frame with Destination MAC for its DG: 192.168.1.254, if it already has MAC for the DG, else it would send ARP for its DG IP address.
- DG for host A, would be configured as a Layer3 interface (SVI) on the switch, so once it receives the frame from Host A, it would inspect to see the Destination IP.
- Destination IP belongs to another Subnet, so it would have to route it, based on whether it is a locally configured subnet or not.
Lets consider it has Interface Vlan 1 for 192.168.1.0/24 subnet and Interface Vlan 2 for 192.168.2.0/24 subnet.
- Checking the destination IP in route table it would see that Destination IP is of directly connected host (as subnet is locally configured) and would hand over the packet to Interface Vlan 2.
- Now Interface Vlan 2 would check to see if it has ARP for the destination IP address which belongs to its local subnet. However it would not see it under Vlan 2 as ARP is maintained per SVI/Layer3 interface, and host B is connected on Vlan 1.
- So it would do an ARP which is broadcast out all ports in Vlan 2. As the host B is in Vlan 1, the ARP would not be forwarded out over that port, thus Host B not hearing the ARP.
This way there would be no communication between Host A and B.
Hope this helps.