IP Default-Gateway Command on CISCO Router/Switch

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

IP Default-Gateway Command on CISCO Router/Switch 1

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

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 10.1.1.254 255.255.255.0

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

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms
SW1(config)#
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x