When would you choose to use the ip default-network
command instead of the ip default-gateway
command?
3 Answers
ip default-gateway
is to be used in L2 devices.
ip default-network
would be used in L3 devices, but works slightly different from the usual static default route configured with ip route 0.0.0.0 0.0.0.0 <next_hop>
. Let's say you configure ip default-network 172.31.0.0
. Then, if the device already knows a route for 172.31.0.0, this route will be flagged as a default route candidate.
You need to take into account that ip default-network
command is classful.
Further details and clarifications are available here
See here
Basically ip default-gateway
is for layer-2 devices and ip default-network
is for layer-3 devices.
ip default-network
is basically a default route
When IP routing is enabled, the commands ip default-network and "ip route 0.0.0.0" etc. work the same. These commands would be used on a router or Layer 3 switch.
"ip default-gateway" would be used when ip routing is not enabled - for instance, on a Layer 2 switch that has an SVI for management but cannot route on that SVI.