...
Ниже приведён пример, в котором на основе IP-адреса хоста 192.0.2.30 и маски подсети 255.255.255.0 вычисляется префикс (адрес) сети с помощью логической операции И(&).
Image Modified
Принцип работы фильтрации на основе префиксов
...
Сравнение производится побитно по префиксным частям - сначала ведётся сопоставление значащих бит сравниваемых префиксов с битами условий сравнения заданных в виде <ADDR/LEN> (где <ADDR> - значение значащих бит префикса, </LEN> - дли маски префикса), определяющих неизменяемую часть префикса, которая должна строго соответствовать при сравнении и допустимую часть сравниваемых значащих бит.
Image Modified
Проверка на соответствие производится вплоть до первого совпадения. Если сравниваемый маршрут совпал с одним из заданных условий, к нему будет применено одно из двух действий фильтрующих конструкций - permit или deny, а дальнейшее сравнение прекращается. В противном случае к нему будет применено неявное правило в конце списка.
...
Если в условии соответствия задать префикс вида 0.0.0.0/0, то неизменяемая часть значащих битов будет полностью отсутствовать, а это значит, что любой префикс может подходить под данное условие. Таким образом возможна фильтрация префиксов на основе значения длины маски, описываемой с помощью модификаторов условий:
...
Image Added
В приведённом выше примере:
...
Раскрыть |
---|
|
Блок кода |
---|
theme | Confluence |
---|
firstline | 1 |
---|
| R1# show ip route
Codes: C - connected, S - static, R - RIP derived,
O - OSPF derived, IA - OSPF inter area route,
E1 - OSPF external type 1 route, E2 - OSPF external type 2 route
B - BGP derived, D - DHCP derived, K - kernel route, V - VRRP route
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
H - NHRP, * - FIB route
B * 10.0.3.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.8.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.6.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.10.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.2.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.7.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.5.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.5.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.9.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.6.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.8.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.4.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.8.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.5.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.7.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.9.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.1.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.7.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.7.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.4.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
C * 192.0.2.0/30 [0/0] dev te1/0/1 [direct 11:42:58]
B * 10.0.8.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.6.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.3.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.10.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.3.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.9.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.1.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.5.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.2.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.4.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.2.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.10.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.4.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.3.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.1.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.5.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.2.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.2.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.6.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.3.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.1.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.7.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.5.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.4.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.10.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.8.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.6.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.9.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.1.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.10.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.8.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.2.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.9.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.7.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.3.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.8.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.6.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.4.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.4.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.7.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.1.128/25 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.5.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.3.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.6.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.2.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.5.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.1.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.4.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.3.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.2.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.1.252/30 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.7.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.10.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.6.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 192.168.9.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.9.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.10.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.8.192/26 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.10.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?)
B * 10.0.9.254/31 [170] via 192.0.2.1 on te1/0/1 [bgp65510 12:22:38] (AS65505?) |
|
Предупреждение |
---|
theme | Confluence |
---|
firstline | 1 |
---|
|
Информация |
---|
Использовать prefix-list в этом случае не получится - данная конструкция не позволяет содержание одинаковых префиксов с разными модификаторами условий. |
...