ip route

Syntax

ip route <DEST-IPV4-ADDR>/<NETMASK> [<NEXT-HOP-IP-ADDR>|<INTERFACE>|reject|blackhole]

no ip route <DEST-IPV4-ADDR>/<NETMASK> [<NEXT-HOP-IP-ADDR>|<INTERFACE>|reject|blackhole]

Description

Adds an IPv4 static route.

The no form of this command deletes the IPv4 static route.

Command context

config

Parameters

<DEST-IPV4-ADDR>/<NETMASK>

Specifies the IPv4 route destination.

<NEXT-HOP-IP-ADDR>

Specifies the next hop IPv4 address for reaching the destination. Format: A.B.C.D

<INTERFACE>

Specifies the next hop as an outgoing interface.

blackhole

Specifies that packets matching the destination route are silently discarded and no ICMP error notification is sent to the sender.

reject

Specifies that packets matching the destination route are discarded and an ICMP error notification is sent to the sender.

Authority

Administrators

Examples

switch(config)# ip route 10.0.0.0/24 blackhole
switch(config)# ip route 10.0.1.0/24 reject
switch(config)# ip route 10.0.2.0/24 20.0.0.2
switch(config)# ip route 10.0.3.0/24 1/1/1
switch# configure terminal
switch(config)# no ip route 10.0.0.0/24 blackhole
switch(config)# no ip route 10.0.1.0/24 reject
switch(config)# no ip route 10.0.2.0/24 20.0.0.2
switch(config)# no ip route 10.0.3.0/24 1/1/1