Howdy,
This is how it works: say you have a host with the following config:
IP address: 192.168.1.1
Subnet mask: 255.255.224.0
Default Gateway: 192.168.1.254
When the host wants to send a packet to a destination X, it will do the following:
- it will first determine the network part of that destination X based on the host's configured subnet mask
- it will also determine the network part of the host's own IP address based on the host's configured subnet mask.
- if the two network portions match, the host knows that the destination X is local.
- if the two don't match, the host knows that the destination is remote.
Once it works that out, it does the following:
- if the destination is local, it will ARP for it, in order to build an ethernet frame addressed to it.
- if the destination is remote, it will send the IP packet to its default gateway.
Based on my example addresses above:
- if the destination is 192.168.1.20, the logical AND'ing of this with 255.255.224.0 gives you 192.168.1.0. The destination is therefore local and the host will ARP for it
- if the destination is 192.168.120.20, the logical AND'ing of this with 255.255.224.0 gives you 192.168.96.0. The destination is therefore remote and the host will have to send it to the default gateway. The host will ARP for the default gateway's address if it does not have an entry for it in its ARP table.
To extend this to your case, use the above logic to determine whether the IP address of the VLAN interface, when AND'ed with the host's mask gives you the same network address as the AND'ing of the host's IP with its subnet mask.
Hope that helps -pls rate the post if it does.
Paresh.
-