Dynamic routing protocols: BGP, OSPF, RIP
that, it is always better to specify the router-id value, particularly when you have a configuration
where the IP addresses scheme of the router is subject to change, like when a VRRP protocol is used
or when the routers are in a network with dynamically assigned IP addresses.
BGP filters and route-map
It is possible to add filters to received routes by using the sequence of commands:
set bgp neighbor 88.58.10.245 prefix-list FilterInBGP in
set bgp ip prefix-list FilterInBGP description Block some net
set bgp ip prefix-list FilterInBGP seq 10 deny 10.10.0.0/16
set bgp ip prefix-list FilterInBGP seq 20 deny 7.0.0.0/8 ge 32
set bgp ip prefix-list FilterInBGP seq 30 permit 0.0.0.0/0 le 32
Even if all networks are received from neighbor:
root@IMOLA> show ip bgp neighbor 88.58.10.245 received-routes
BGP table version is 0, local router ID is 88.58.10.246
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-
failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0 88.58.10.245 0 3269 i
*> 7.0.255.1/32 88.58.10.245 0 0 3269 3269 65210 i
*> 7.0.255.2/32 88.58.10.245 0 0 3269 3269 65210 i
*> 10.1.10.0/24 88.58.10.245 0 0 3269 3269 65210 i
*> 10.8.0.0/24 88.58.10.245 0 0 3269 3269 65210 i
*> 10.10.0.0/16 88.58.10.245 0 0 3269 i
*> 10.45.15.192/27 88.58.10.245 0 3269 65201 ?
*> 192.168.184.6/32 88.58.10.245 0 3269 65201 i
Total number of prefixes 8
in the routing table only those defined by the configured filter are set:
root@IMOLA> show ip route bgp
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - ISIS, B -
BGP, > - selected route, * - FIB route
B>* 0.0.0.0/0 [20/0] via 88.58.10.245, tun0, 00:02:16
B>* 10.1.10.0/24 [20/0] via 88.58.10.245, tun0, 00:02:15
B>* 10.8.0.0/24 [20/0] via 88.58.10.245, tun0, 00:02:15
A route-map can be used to filter inbound and outbound routes. For example:
set bgp neighbor 88.58.10.245 route-map ToPeerBGP out
set bgp neighbor 88.58.10.245 route-map FromPeerBGP in
set bgp route-map ToPeerBGP permit 10 match ip address prefix-list ToPeerBGP
set bgp route-map ToPeerBGP permit 10 set as-path prepend <ASN>