Can anyone please explain me the difference between “ip route” and “ip default-network” commands? Can you also provide example or scenario where " ip default-network" command is used?
ip route command is used to install a static route into the routing table. This static route can be to a specific destination such as the following:
ip route 192.168.5.0 255.255.255.0
or it can also be used to install the default route like so:
ip route 0.0.0.0 0.0.0.0
ip default-network command is another way of indicating a default route. By issuing the command
ip default-network 220.127.116.11 for example, what you are telling the router is “if you have a route to this destination, then the next hop IP address to get to this destination should become a candidate default route”.
Now notice I used the term “candidate default route”. A router may obtain a default route from various sources: statically defined, redistributed from a routing protocol, or via the
ip default-network command. If a router receives multiple such default routes, they are all candidates. But one is chosen, and is indicated by the “Gateway of Last Resort is…” statement in the IP routing table.
You can find more information about this command here:
I hope this has been helpful!