ip route interface

Syntax

ip route <IPv4 ADDR/MEMBER> interface <IPv4 ADDR>
 [<DISTANCE> | <VRF INSTANCE-NAME>]

no ip route 		

Description

Creates a route leak between the SRC-VRF and DST-VRF. Using the static method, the route must first be added to the destination VRF. The route is added to the local interface of the source VRF with a next-hop interface. The existing IP route command can then take either the next-hop IP or the next-hop interface.

  • INTERFACE refers to the outgoing interface in an m/s/p format
  • Users must provide both the next-hop IP and the interface information to leak network routes.

  • The next-hop IP information is not required to leak connected routes.

The [no] form of command deletes the static VRF leaked route.

Command context

config

Parameters

<IPv4 ADDR/MEMBER>

Required: IPv4 IP-Address route destination.

<IPv4 ADDR>

Required: IPv4 route destination

<DISTANCE>

Optional: administrative distance of static route

<VRF INSTANCE-NAME>

Optional: VRF instance

Options

blackhole
Discard packets to the destined route silently.
reject

Discard packets to the destined route and return ICMP error to the sender.

Authority

Administrators or local user group members with execution rights for this command.

Example

Configures a route leak between the SRC-VRF and DST-VRF:

 switch(config)# show runn
 Current configuration:
 !
 vrf blue
	vrf green
 vrf red
	!

 vlan 1
		 interface 1/1/1
		 no shutdown
			vrf attach red
		 ip address 10.0.0.1/24
			interface 1/1/2
			no shutdown
			vrf attach green
		 ip address 20.0.0.1/24
		 interface 1/1/3
			no shutdown
		 vrf attach blue
		 ip address 40.0.0.1/24

	switch(config)# ip route A.B.C.D/M IPv4 route destination
	switch(config)# ip route A.B.C.D/M IPv4 route destination
	switch(config)# ip route 30.0.0.0/24 A.B.C.D Nexthop IPv4 address
	switch(config)# ip route 30.0.0.0/24 1/1/2 A.B.C.D Nexthop IPv4 address
	switch(config)# ip route 30.0.0.0/24 20.0.0.2 vrf green 
	switch(config)# ip route 30.0.0.0/24 1/1/2 20.0.0.2 vrf red
	switch(config)# ip route 50.0.0.0/24 1/1/2 20.0.0.2 vrf blue
	switch(config)# ip route 50.0.0.0/24 20.0.0.2 vrf green 
	switch(config)# ip route 60.0.0.0/24 1/1/2 vrf red

	switch(config)# show runn
 Current configuration:
 !
 vrf blue
	vrf green
 vrf red
	!

 vlan 1
		 interface 1/1/1
		 no shutdown
			vrf attach red
		 ip address 10.0.0.1/24
			interface 1/1/2
			no shutdown
			vrf attach green
		 ip address 20.0.0.1/24
		 interface 1/1/3
			no shutdown
		 vrf attach blue
		 ip address 40.0.0.1/24
		 ip route 30.0.0.0/24 1/1/2 20.0.0.2 vrf red
 		ip route 50.0.0.0/24 1/1/2 20.0.0.3 vrf blue
 		ip route 60.0.0.0/24 1/1/2 vrf red 
		

	switch(config)# no ip route 30.0.0.0/24 1/1/2 20.0.0.2 vrf red
	switch(config)# no ip route 50.0.0.0/24 1/1/2 20.0.0.3 vrf blue
	switch(config)# no ip route 60.0.0.0/24 1/1/2 vrf red 

	switch(config)# show runn
 Current configuration:
 ! 
	vrf blue 
	vrf green 
 vrf red		
	! 
		
	vlan 1
				interface 1/1/1
				no shutdown
  		vrf attach red
				ip address 10.0.0.1/24 
		 	interface 1/1/2 
		 	no shutdown
			 vrf attach green 
		 	ip address 20.0.0.1/24
			 interface 1/1/3 
		 	no shutdown 
		 	vrf attach blue
	 		ip address 40.0.0.1/24