Hi All ,
Layer 2 Switch makes forwarding decisions based on Layer-2 header. It has nothing to do with Layer-3 ip address.
Then why do we give default gateway to a switch in VLAN network environment.
IP default-gateway" command ?
In order to manage or connect to switch we need to set up vlan interface x .
Layer two will have one svi interface up. Likely it is vlan 1
Switches makes forwarding decision based on destination mac address.The switch has one mac address and SVI interface and ip address assigned to that interface.Thats for the management purposes.If we are in different network.We type in the command in the switch (ip default gateway) because we want to reach that switch from remote network.