Octet

How do you configure a default route, and what is the difference between ip route 0.0.0.0, ip default-gateway and ip default-network?

Show the answer

Say this first

ip route 0.0.0.0 0.0.0.0 <next-hop> installs a static default and is what you use on a router. ip default-gateway only works when IP routing is off, for example on a layer 2 switch for its management address. ip default-network is a legacy command that flags a classful network as a candidate default; you rarely see it now.

Go deeper

On a router

Cisco IOS
ip route 0.0.0.0 0.0.0.0 203.0.113.1
Output
Gateway of last resort is 203.0.113.1 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 203.0.113.1

0.0.0.0/0 matches every address with a prefix length of 0, so longest match makes it the last resort.

On a layer 2 switch

Cisco IOS
no ip routing
ip default-gateway 10.10.99.1

With ip routing enabled, IOS ignores ip default-gateway. That is a classic reason a layer 3 switch cannot be reached from another subnet after someone turned routing on.

Sending a default into a protocol

ProtocolUsual way
OSPFdefault-information originate (add always to send it without a default in the RIB)
EIGRPredistribute the static default, or a summary of 0.0.0.0/0 on an interface
RIPdefault-information originate
BGPneighbor x.x.x.x default-originate, or network 0.0.0.0 with a default in the RIB

IPv6 uses ipv6 route ::/0 <next-hop>.

Traps

  • Using ip default-gateway on a router with routing enabled and expecting it to work.
How did you do?Book 3.3 Internet (IP)