4.1.2. ip route

Syntax

ip route dest-ipaddr mask router-ipaddr

no ip route dest-ipaddr mask router-ipaddr

Parameter


dest-ipaddr Destination ip address prefix

mask Destination ip address prefix mask

router-ipaddr Forwarding router’s ip address


Default

Static route is not configured by default.

Mode

Global Configuration mode.

Usage

Use the ip route command in global mode to configure a static route rule. Use the no ip route command to delete a static routing rule. You can verify your setting by entering the show ip route Privileged EXEC command

Example

The following example shows how to configure a static route.

Switch(config)# vlan 2
Switch(config)# interface GigabitEthernet 4
Switch(config-if)# switchport trunk allowed vlan add 2
Switch(config)# interface vlan 2
Switch(config-if)# ip address 192.168.3.1 255.255.255.0
Switch(config)# ip route 1.1.1.1 255.0.0.0 192.168.3.11
Switch# show ip route
Codes: - best, C - connected, S - static
S 1.0.0.0/8 [1/1] via 192.168.3.11, VLAN 2
C 192.168.0.0/24 is directly connected, MGMT VLAN
C 192.168.3.0/24 is directly connected, VLAN 2