Filtering – Utilisation des ACLs & Prefix-lists
- access-list
- distribute-list
- prefix-list
- ORF feature
Dans cet exemple, le routeur R2 a constitué la topologie suivante :
R2#show ip bgp | be Net Network Next Hop Metric LocPrf Weight Path *> 1.1.0.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 1.1.1.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 1.1.2.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 1.1.3.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 1.1.4.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 2.0.0.0 0.0.0.0 0 32768 i * 3.0.0.0 10.1.12.1 0 100 400 300 i *> 10.1.23.3 0 0 300 i * 4.0.0.0 10.1.12.1 0 100 400 i *> 10.1.23.3 0 300 400 i *> 22.0.0.0 0.0.0.0 0 32768 i * 33.0.0.0 10.1.12.1 0 100 400 300 i *> 10.1.23.3 0 0 300 i
« distribute-list » pour filtrer un prefix
R2(config)#access-list 4 deny 1.1.4.0 0.0.0.255 R2(config)#access-list 4 permit any R2(config)#router bgp 200 R2(config-router)#neighbor 10.1.12.1 distribute-list 4 in R2(config-router)#neighbor 10.1.23.3 distribute-list 4 in
Vérification:
R2#show ip bgp | be Net Network Next Hop Metric LocPrf Weight Path *> 1.1.0.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 1.1.1.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 1.1.2.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 1.1.3.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 2.0.0.0 0.0.0.0 0 32768 i * 3.0.0.0 10.1.12.1 0 100 400 300 i *> 10.1.23.3 0 0 300 i * 4.0.0.0 10.1.12.1 0 100 400 i *> 10.1.23.3 0 300 400 i *> 22.0.0.0 0.0.0.0 0 32768 i * 33.0.0.0 10.1.12.1 0 100 400 300 i *> 10.1.23.3 0 0 300 i
« distribute-list » pour n’autoriser que les prefix souhaité
R2#conf t R2(config)#no access-list 4 R2(config)#access-list 4 permit 1.1.4.0 0.0.0.255 R2(config)#access-list 4 deny any
Vérification :
R2#show ip bgp | be Net Network Next Hop Metric LocPrf Weight Path *> 1.1.4.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 2.0.0.0 0.0.0.0 0 32768 i *> 22.0.0.0 0.0.0.0 0 32768 i
Utilisation d’un acces-list nommée
R2#conf t R2(config)#ip access-list standard TOTO R2(config-std-nacl)#10 permit 1.1.3.0 0.0.0.255 R2(config-std-nacl)#20 deny any R2(config-std-nacl)#exit R2(config)#router bgp 200 R2(config-router)#neighbor 10.1.12.1 distribute-list TOTO in R2(config-router)#neighbor 10.1.23.3 distribute-list TOTO in R2(config-router)#^Z
Vérification:
R2#show ip bgp | be Net Network Next Hop Metric LocPrf Weight Path *> 1.1.3.0/24 10.1.12.1 0 0 100 i * 10.1.23.3 0 300 400 100 i *> 2.0.0.0 0.0.0.0 0 32768 i *> 22.0.0.0 0.0.0.0 0 32768 i
Utilisation des « prefix-list »
R2#conf t R2(config)#ip prefix-list TOTO seq 10 deny 1.1.4.0/24 R2(config)#ip prefix-list TOTO seq 20 permit 0.0.0.0/0 le 32 R2(config)#router bgp 200 R2(config-router)#neighbor 10.1.12.1 prefix-list TOTO in R2(config-router)#neighbor 10.1.23.3 prefix-list TOTO in
Vérifications
R2#show ip bgp | be Net
Network Next Hop Metric LocPrf Weight Path
*> 1.1.0.0/24 10.1.12.1 0 0 100 i
* 10.1.23.3 0 300 400 100 i
*> 1.1.1.0/24 10.1.12.1 0 0 100 i
* 10.1.23.3 0 300 400 100 i
*> 1.1.2.0/24 10.1.12.1 0 0 100 i
* 10.1.23.3 0 300 400 100 i
*> 1.1.3.0/24 10.1.12.1 0 0 100 i
* 10.1.23.3 0 300 400 100 i
*> 2.0.0.0 0.0.0.0 0 32768 i
* 3.0.0.0 10.1.12.1 0 100 400 300 i
*> 10.1.23.3 0 0 300 i
* 4.0.0.0 10.1.12.1 0 100 400 i
*> 10.1.23.3 0 300 400 i
*> 22.0.0.0 0.0.0.0 0 32768 i
* 33.0.0.0 10.1.12.1 0 100 400 300 i
*> 10.1.23.3 0 0 300 i
R2#show ip prefix-list
ip prefix-list TOTO: 2 entries
seq 10 deny 1.1.4.0/24
seq 20 permit 0.0.0.0/0 le 32
Utilisation des « prefix-list »
R2#conf t R2(config)#ip prefix-list TOTO seq 11 deny 1.1.0.0/24 R2(config)#ip prefix-list TOTO seq 12 deny 1.1.1.0/24 R2(config)#ip prefix-list TOTO seq 13 deny 1.1.2.0/24 R2(config)#ip prefix-list TOTO seq 14 deny 1.1.3.0/24 R2(config)#^Z
Vérifications:
R2#show ip prefix-list
ip prefix-list TOTO: 6 entries
seq 10 deny 1.1.4.0/24
seq 11 deny 1.1.0.0/24
seq 12 deny 1.1.1.0/24
seq 13 deny 1.1.2.0/24
seq 14 deny 1.1.3.0/24
seq 20 permit 0.0.0.0/0 le 32
R2#show ip bgp | be Net
Network Next Hop Metric LocPrf Weight Path
*> 2.0.0.0 0.0.0.0 0 32768 i
* 3.0.0.0 10.1.12.1 0 100 400 300 i
*> 10.1.23.3 0 0 300 i
*> 4.0.0.0 10.1.12.1 0 100 400 i
* 10.1.23.3 0 300 400 i
*> 22.0.0.0 0.0.0.0 0 32768 i
* 33.0.0.0 10.1.12.1 0 100 400 300 i
*> 10.1.23.3 0 0 300 i
Note: les prefix sont filtrés mais toujours annoncés aux les voisins R1 & R3 :
R1#show ip bgp neighbors 10.1.12.2 advertised-routes
Network Next Hop Metric LocPrf Weight Path
*> 1.1.0.0/24 0.0.0.0 0 32768 i
*> 1.1.1.0/24 0.0.0.0 0 32768 i
*> 1.1.2.0/24 0.0.0.0 0 32768 i
*> 1.1.3.0/24 0.0.0.0 0 32768 i
*> 1.1.4.0/24 0.0.0.0 0 32768 i
*> 2.0.0.0 10.1.12.2 0 0 200 i
*> 3.0.0.0 10.1.14.4 0 400 300 i
*> 4.0.0.0 10.1.14.4 0 0 400 i
*> 22.0.0.0 10.1.12.2 0 0 200 i
*> 33.0.0.0 10.1.14.4 0 400 300 i
Total number of prefixes 10
R3#show ip bgp neighbors 10.1.23.2 advertised-routes
Network Next Hop Metric LocPrf Weight Path
*> 1.1.0.0/24 10.1.34.4 0 400 100 i
*> 1.1.1.0/24 10.1.34.4 0 400 100 i
*> 1.1.2.0/24 10.1.34.4 0 400 100 i
*> 1.1.3.0/24 10.1.34.4 0 400 100 i
*> 1.1.4.0/24 10.1.34.4 0 400 100 i
*> 2.0.0.0 10.1.23.2 0 0 200 i
*> 3.0.0.0 0.0.0.0 0 32768 i
*> 4.0.0.0 10.1.34.4 0 0 400 i
*> 22.0.0.0 10.1.23.2 0 0 200 i
*> 33.0.0.0 0.0.0.0 0 32768 i
Total number of prefixes 10
ORF feature
Le filtrage mis en place sur R2 peut être pris en compte par ces voisins R1 et R3 en implémentant ORF sur chaque routeur:
R1#conf t R1(config)#router bgp 100 R1(config-router)#address-family ipv4 unicast R1(config-router-af)#neighbor 10.1.12.2 capability orf prefix-list receive R3#conf t R3(config)#router bgp 300 R3(config-router)#address-family ipv4 unicast R3(config-router-af)#neighbor 10.1.23.2 capability orf prefix-list receive R2#conf t R2(config)#router bgp 200 R2(config-router)#address-family ipv4 unicast R2(config-router-af)#neighbor 10.1.12.1 capability orf prefix-list send R2(config-router-af)#neighbor 10.1.23.3 capability orf prefix-list send
Vérifications:
R1#show ip bgp neighbors 10.1.12.2 advertised-routes Network Next Hop Metric LocPrf Weight Path *> 3.0.0.0 10.1.14.4 0 400 300 i *> 4.0.0.0 10.1.14.4 0 0 400 i *> 33.0.0.0 10.1.14.4 0 400 300 i Total number of prefixes 3
R3#show ip bgp neighbors 10.1.23.2 advertised-routes Network Next Hop Metric LocPrf Weight Path *> 3.0.0.0 0.0.0.0 0 32768 i *> 4.0.0.0 10.1.34.4 0 0 400 i *> 33.0.0.0 0.0.0.0 0 32768 i Total number of prefixes 3