OcNOS-SP : Layer 3 Guide : Layer 3 Unicast Configuration Guide : Static Route Discard Configuration : IPv4 Route Discard
IPv4 Route Discard
Figure 22-133 shows the configuration required to enable static route discard for IPv4.
Topology
Figure 22-133: Static route discard topology
Configuration
R1
 
R1#configure terminal
Enter configure mode
R1(config)#interface xe1
Enter interface mode for xe1
R1(config-if)#ip address 2.2.2.2/24
Assign an IP address to the interface
R1(config-if)#commit
Commit the candidate configuration to the running configuration
R1(config-if)#exit
Exit interface mode.
R1(config)#interface xe2
Enter interface mode for xe1
R1(config-if)#ip address 1.1.1.2/24
Assign an IP address to the interface
R1(config-if)#commit
Commit the candidate configuration to the running configuration
R1(config-if)#exit
Exit interface mode
R1(config)#router bgp 2
Enter BGP router mode
R1(config-router)#neighbor 2.2.2.3 remote-as 3
Create static BGP neighbor 2.2.2.3 with remote autonomous system value 3
R1(config-router)#redistribute connected
Advertise the connected network into BGP
R1(config-if)#commit
Commit the candidate configuration to the running configuration
R1(config-router)#end
Exit BGP router mode
R2
 
R2#configure terminal
Enter configure mode
R2(config)#ip prefix-list p1
Configure IP prefix list
R2(config-ip-prefix-list)#seq 5 permit any
Create an access rule to permit any IP packets
R2(config)#route-map r1
Enter route-map mode
R2(config-route-map)#match ip address prefix-list p1
Configure match ip prefix list p1
R2(config-route-map)#set interface null0
Set the interface to null0
R2(config-if)#commit
Commit the candidate configuration to the running configuration
R2(config-route-map)#exit
Exit route-map mode.
R2(config)#interface xe1
Enter interface mode for xe1
R2(config-if)#ip address 2.2.2.3/24
Assign an IP address to the interface
R2(config-if)#commit
Commit the candidate configuration to the running configuration
R2(config-if)#exit
Exit interface mode.
R2(config)#interface xe2
Enter interface mode for xe2
R2(config-if)#ip address 3.3.3.2/24
Assign an IP address to the interface
R2(config-if)#commit
Commit the candidate configuration to the running configuration
R2(config-if)#exit
Exit interface mode
R2(config)#router bgp 3
Enter into BGP router mode
R2(config-router)#neighbor 2.2.2.2 remote-as 2
Create static BGP neighbor 2.2.2.2 with remote autonomous system value 2
R2(config-router)#neighbor 3.3.3.3 remote-as 4
Create static BGP neighbor 3.3.3.3 with remote autonomous system value 4
R2(config-router)#redistribute connected
Advertise the connected network into BGP
R2(config-router)#neighbor 2.2.2.2 route-map r1 in
Attach the route-map with route discard configured for the neighbor 2.2.2.2 in IN direction
R2(config-if)#commit
Commit the candidate configuration to the running configuration
R2(config-router)#end
Exit BGP router mode
R3
 
R3#configure terminal
Enter configure mode.
R3(config)#interface xe2
Enter interface mode for xe2
R3(config-if)#ip address 3.3.3.3/24
Assign an IP address to the interface
R3(config-if)#commit
Commit the candidate configuration to the running configuration
R3(config-if)#exit
Exit interface mode
R3(config)#interface xe1
Enter interface mode for xe1
R3(config-if)#ip address 4.4.4.2/24
Assign an IP address to the interface
R3(config-if)#commit
Commit the candidate configuration to the running configuration
R3(config-if)#exit
Exit interface mode.
R3(config)#router bgp 4
Enter into BGP router mode
R3(config-router)#neighbor 3.3.3.2 remote-as 3
Create static BGP neighbor 3.3.3.2 with remote autonomous system value 3
R3(config-router)#redistribute connected
Advertise the connected network into BGP
R3(config-if)#commit
Commit the candidate configuration to the running configuration
R3(config-router)#end
Exit BGP router.
Validation
R2#show running-config bgp
!
router bgp 3
redistribute connected
neighbor 2.2.2.2 remote-as 2
neighbor 2.2.2.2 route-map r1 in
neighbor 3.3.3.3 remote-as 4
!
 
R2#show ip bgp
BGP table version is 3, local router ID is 2.2.2.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
l - labeled, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 2.2.2.2 0 100 0 2 ?
*> 2.2.2.0/24 0.0.0.0 0 100 32768 ?
* 2.2.2.2 0 100 0 2 ?
*> 3.3.3.0/24 0.0.0.0 0 100 32768 ?
* 3.3.3.3 0 100 0 4 ?
*> 4.4.4.0/24 3.3.3.3 0 100 0 4 ?
Total number of prefixes 4
 
 
R2#show running-config prefix-list
!
ip prefix-list p1
permit any
!
 
R2#show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area,
v - vrf leaked
* - candidate default
 
IP Route Table for VRF "default"
B 1.1.1.0/24 [20/0] is a summary, Null, 00:00:01
C 2.2.2.0/24 is directly connected, xe1, 00:09:57
C 3.3.3.0/24 is directly connected, xe2, 00:09:50
B 4.4.4.0/24 [20/0] via 3.3.3.3, xe2, 00:00:03
C 127.0.0.0/8 is directly connected, lo, 01:18:30
 
Gateway of last resort is not set
 
R2#show hsl nh-table
IPv4 FIB 0
0.0.0.0, Null, 00:00:00:00:00:00, Valid ,
1.1.1.0/24, Installed FORWARD
2.2.2.2, xe1, 00:18:23:26:16:45, Valid , lport:0x8000026, Egress object id:1
00004, refcnt 0, rulecnt 0
3.3.3.3, xe2, 00:18:23:cb:fb:b7, Valid , lport:0x800002a, Egress object id:1
00003, refcnt 1, rulecnt 0,
4.4.4.0/24, Installed FORWARD
 
IPv4 FIB 1 10.12.29.1, eth0, 00:00:00:00:00:00, Invalid,
, Not Installed TO_CPU
 
IPv6 FIB 0
 
IPv6 FIB 1
Last modified date: 10/16/2023