IP Default-Gateway Command on CISCO Router/Switch


IP Default-Gateway


Provides a default-gateway for the switch to send all unknown IP packets. Allows proper communication between switches and routers.


Switch(config)#ip default-gateway <ip address>


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
R1(config-if)#ip add
R1(config-if)#int loop0
R1(config-if)#ip add

Next we configure int VLAN 1 on SW1 so it can communicate with R1 via IP.

SW2(config)#int vlan 1
SW2(config-if)#ip address

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
SW1(config)#do ping

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms

Related Articles

Leave a Reply