Simple question - switches & default gateways
Posted on 2004-08-21
This should be a simple one guys...but I seem to be getting myself confused.
What is the purpose of setting a Layer 3 gateway address on a Layer 2 switch (using the ip default-gateway command)?
Scenario: A PC connected to a L2 switch (eg 1900, 2950) sends a frame to a PC on another subnet. Lets assume there is full connectivity between the 2 devices (pings OK). I know that the local routing table is checked (on the PC), nothing found locally so the frame is sent to the PC's default gateway (which would be the router). All cool...except here is where I am over-complicating things I think:
Before the packet even gets to the router it must go through the switch - when the frame gets to the switch port, I thought the switch would check its CAM table (this is the MAC addresstable yes?) for the routers MAC address and forward the frame out the correct port (assuming the router was directly connected OR the routers MAC address was learnt via a routing protocol).
1. Is this procedure correct? If so, when does the default gateway of the switch come into play?
2. When setting the switch's default gateway address, would it have to be the same as the PCs?