Command
IP Default-Gateway
Use
Provides a default-gateway for the switch to send all unknown IP packets. Allows proper communication between switches and routers.
Syntax
Switch(config)#ip default-gateway <ip address>
Example
In the below example we will configure SW1 to use a default-gateway to ping R1’s loopback0. First, we will configure R1’s Fa0/0 and Loopback0 interfaces.
R1(config-if)#int fa0/0 |
Next we configure int VLAN 1 on SW1 so it can communicate with R1 via IP.
SW2(config)#int vlan 1 |
Finally we configure a default gateway on SW1 so all unknown traffic is sent to R1. We then see that the ping is successful.
SW1(config)#ip default-gateway 10.1.1.1 Type escape sequence to abort. |