What is the difference beween 'ip default-gateway' and 'ip route 0.0.0.0 0.0.0.0 s1' commands?
Thanks & Regards,
The ip default-gateway command is used for remote management of the device from a different subnet. Basically just like setting a default gateway on a PC. It knows where to send packets that were requested from a different subnet.
The ip route command is used on layer 3 switching and routing. It is used to send a packet to a destination when the layer 3 device does not have a route for that network in its routing table.
The ip default network command was a method of advertising a default route through rip, igrp, and eigrp to other neighbors. This command will not install a default route on the router itself that has the command on it. A static route like ip route 0.0.0.0 0.0.0.0 is locally significant. The ip default network command is something that is no longer used and you can find many articles online explaining the bad side affects you can have using it.
Here you can see the differences between IP default-gateway , IP default-network and Default route:
IP default-gateway : you can use this command when IP routing is disabled on Cisco routers and switches or on switches that not support IP routing.
IP default-network : you can use this command when IP routing is enabled, and the router will consider routes to that network for installation as the gateway of last resort. if a router has a route to that network that configured with this command that route will flag as a candidate default route. this command is classful and default route announced using this command is not propagated by OSPF and IS-IS but you have more flexibility than default route.
IP route 0.0.0.0 0.0.0.0 or default route: you can use this command to set the gateway of last resort on a router and using this method is not dependent on any routing protocols and IP routing must be enabled on the router, here we have some issues with different routing protocols:
in EIGRP, you should redistribute static route into EIGRP to propagate the default route. IGRP does not understand a default route and you should use IP default-network, in IOS releases before 12.0T IP route to 0.0.0.0 0.0.0.0.0 was automatically advertised by RIP but in IOS releases after 12.0T you should redistribute the route into RIP. in OSPF and IS-IS you can not simlpy redistribute the routes and you should use default-information originate command to generate a default route.
at the end please note that: if you configure multiple networks as candidate default routes using IP default-network the network with lowest administrative distance is chosen as the network for the gateway of last resort, if all of them have a same AD then the network listed first in routing table is chosen, if you use both IP default-network and default route and the network used by IP default-network is known statically the network defined with IP default-network takes precedence and is chosen but if networks known by routing protocol , the IP route 0.0.0.0 0.0.0.0 is chosen based on lower AD.