This command manually configures a default gateway for the switch. Only one default gateway can be configured. If you invoke this command multiple times, each command replaces the previous value.
When the system does not have a more specific route to a packet‘s destination, it sends the packet to the default gateway. The system installs a default IPv4 route with the gateway address as the next hop address. The route preference is 253. A default gateway configured with this command is more preferred than a default gateway learned from a DHCP (Dynamic Host Configuration Protocol) server.
Format | ip default-gateway ipaddr |
Mode |
|
Parameter | Description |
---|---|
ipaddr | The IPv4 address of an attached router. |
The following example sets the default gateway to 10.1.1.1.
(router1) #config (router1) (Config)#ip default-gateway 10.1.1.1