I have a Cisco 3500 switch connected to a Cisco 2600 router. Initially, the switch did not have a default gateway set but the switch could still ping the 2600 router. Then, as a test, we set a wrong default gateway on the switch (ip default-gateway x.x.x.x) to see if the switch could still ping the router - and it could. No matter what default gateway address we put in the switch, we could still ping the router and beyond the router to any device on our network.
I believe that the switch can ping the router (despite the wrong default gateway settings) because they are directly connected and are communicating via Layer 2.
Am I correct?
Also, what is the purpose of the "default-gateway" command if the switch can still see the default gateway (router) regardless of what default gateway IP address you give it?