Aug 15, 2023

Обработка bgp маршрутов при подключении клиентов Internet

Соединения с клиентами по протоколу BGP описываются в блоке конфигурации protocols bgp group INET_Customers, если соединение производится по протоколу IPv4 и в блоке конфигурации protocols bgp group IPv6_Customers.
      

    В целях уменьшения влияния анонсов отдельных клиентов на ресурсы маршрутизаторов Сети ограничивается количество префиксов, получаемых от клиентов, значением 1000 для префиксов IPv4 и 100 для IPv6 (это значение может быть изменено для отдельного клиента или пересмотрено для всей Сети при изменении общей ситуации в сети Internet). При превышении 80% от этого значения генерируется сообщение в журнале событий syslog, а при превышении 100% сессия BGP разрывается и может быть установлена вновь через 30 минут.


      С целью использования нескольких равноценных маршрутов в настройки добавляется команда multipath.

      Пример настройки bgp group для подключения клиентов:

protocols {

    bgp {

        group INET_Customers {

            type external;

            family inet {

                unicast {

                    prefix-limit {

                        maximum 1000;

                        teardown 80 idle-timeout 30;

                    }

                }

            }

            multipath;

        }

        group IPv6_Customers {

            type external;

            family inet6 {

                unicast {

                    prefix-limit {

                        maximum 100;

                        teardown 80 idle-timeout 30;

strong>                    }

                }

            }

            multipath;

        }

    }

}

      Для клиентов, подключающихся к услугам доступа в Internet, необходимо исключить анонс так называемых приватных автономных систем из атрибута AS_PATH. 

Список приватных AS приведен по адресу: http://www.iana.org/assignments/as-numbers и составляет диапазон: AS64512 AS65535. 

Несмотря на то, что архитектура сети IP/MPLS ПАО «Ростелеком» не подразумевает использование приватных номеров автономных систем, фильтрация таких AS при передаче маршрута в другие AS позволит избежать их анонсирования вследствие ошибки в настройке или злонамеренных действий внутри Сети.

      Пример фильтрации приватных AS для маршрутизатора Juniper:

protocols {

    bgp {

        group INET_Customers {

            neighbor 4.3.2.1 {

                remove-private;

            }

        }

    }

}

      При приёме маршрутов от клиента необходима, прежде всего, фильтрация префиксов, приходящих от BGP маршрутизаторов сторонних сетей с целью недопущения попадания некорректной маршрутной информации, анонсируемой маршрутизаторами сторонних сетей в результате ошибки или умышленно. Фильтрация префиксов IPv4 осуществляется на базе списка, приведённого в [RFC6890]. Данный список содержит адреса следующих зарезервированных IETF и не подлежащих выделению сетей:

  • 0.0.0.0/8;
  • 0.0.0.0/1 – 0.0.0.0/32;
  • 10.0.0.0/8;
  • 100.64.0.0/10;
  • 172.16.0.0/12;
  • 192.168.0.0/16;
  • 127.0.0.0/8;
  • 192.0.0.0/24;
  • 192.0.2.0/24;
  • 169.254.0.0/16;
  • 192.88.99.0/24;
  • 198.18.0.0/15;
  • 198.51.100.0/24;
  • 203.0.113.0/24;
  • 224.0.0.0/4;
  • 240.0.0.0/4;

      Фильтрация префиксов IPv6 также осуществляется на базе списка, указанного в [RFC6890] и содержащего следующие префиксы:

  • ::/128;
  • ::1/128;
  • 64:ff9b::/96;
  • ::ffff:0:0/96;
  • 100::/64;
  • 2001::/23;
  • 2001:2::/48;
  • 2001:10::/28;
  • 2001:DB8::/32;
  • 2002::/16;
  • FF00::/8;
  • FE80::/10;
  • FEC0::/10;
  • FC00::/7;

      Помимо этого, с целью уменьшения общего числа префиксов в глобальной таблице маршрутизации фильтруются все префиксы с маской, длина которой превышает 24 бита для IPv4 и 48 бит для IPv6.
      Такая же фильтрация применяется и при передаче префиксов за пределы автономной системы Ростелеком.

      Пример политики для фильтрации неиспользуемых в сети Internet префиксов:

protocols {

    bgp {

        group INET_Customers {

            type external;

            family inet {

                unicast;

            }

            neighbor 1.1.1.2 {

                description "### Test Client ###";

                import sanity-check;

                export sanity-check;

                peer-as 65432;

            }

        }

        group INET_v6_Customers {

            type external;

            family inet6 {

                unicast;

            }

            neighbor 1::2 {

                description "### Test IPv6 Client ###";

                import v6-sanity-check;

                export v6-sanity-check;

                peer-as 65432;

            }

        }

    }

}

policy-options {

    policy-statement sanity-check {

        term reject-bogons {

            from policy bogons;

            then reject;

        }

        term accept-blackhole {

            from community type_blackhole_route;

            then next policy;

        }

        term reject-long-prefixes {

            from {

                route-filter 0.0.0.0/0 prefix-length-range /25-/32 reject;

            }

        }

    }

    policy-statement bogons {

        term rfc6890 {

            from {

                route-filter 10.0.0.0/8 orlonger accept;

                route-filter 172.16.0.0/12 orlonger accept;

                route-filter 192.168.0.0/16 orlonger accept;

                route-filter 0.0.0.0/1 through 0.0.0.0/32 accept;

                route-filter 0.0.0.0/8 orlonger accept;

                route-filter 100.64.0.0/10 orlonger accept;           

                route-filter 127.0.0.0/8 orlonger accept;

                route-filter 192.0.0.0/24 orlonger accept;

                route-filter 192.0.2.0/24 orlonger accept;

                route-filter 169.254.0.0/16 orlonger accept;

                route-filter 192.88.99.0/24 orlonger accept;

                route-filter 224.0.0.0/4 orlonger accept;

                route-filter 240.0.0.0/4 orlonger accept;

                route-filter 198.18.0.0/15 orlonger accept;

                route-filter 198.51.100.0/24 orlonger accept;

                route-filter 203.0.113.0/24 orlonger accept;            

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement v6-sanity-check {

        term reject-bogons {

            from policy v6-bogons;

            then reject;

        }

        term reject-long-prefixes {

            from {

                route-filter ::/0 prefix-length-range /48-/128 reject;

            }

        }

    }

    policy-statement v6-bogons {

        term rfc6890 {

            from {

                route-filter ::/128 exact accept;

                route-filter ::1/128 exact accept;

                route-filter ::/1 through ::/128 accept;

                route-filter ::ffff:0:0/96 orlonger accept;

                route-filter 100::/64 orlonger accept;           

                route-filter 2001::/23 orlonger accept;

                route-filter 2001:2::/48 orlonger accept;           

                route-filter 2001:DB8::/32 orlonger accept;

                route-filter 2001:10::/28 orlonger accept; 

                route-filter 2002::/16 orlonger accept;

                route-filter 64:ff9b::/32 orlonger accept;

                route-filter FC00::/7 orlonger accept;

                route-filter FE80::/10 orlonger accept;

                route-filter FEC0::/10 orlonger accept;

                route-filter FF00::/8 orlonger accept;

             }

        }

        term reject-others {

            then reject;

        }

    }

}

      После проверки разрешённой длины префиксов и принадлежности публичным диапазонам адресов производятся следующие операции с полученными от клиента маршрутами:

  • запрет приёма префиксов Ростелеком;
  • запрет приёма маршрута по умолчанию;
  • запрет приёма служебных и зарезервированных BGP Community;
  • установка параметров по умолчанию;
  • установка BGP Community, соответствующих данному региональному филиалу и МРФ;
  • проверка наличия BGP Community для сброса, назначение нового BGP NextHop;
  • проверка наличия BGP Community, изменяющих Local Preference, установка запрошенного значения.

      Пример обработки маршрутов при приёме от клиента на RGR:

protocols {

    bgp {

        group INET_Customers {

            type external;

            family inet {

                unicast;

            }

            neighbor 1.1.1.2 {

                description "### Test Client ###";

                local-address  1.1.1.1;

                import [ sanity-check INET_CUSTOMER_in mark-routes-sib mark-region-routes-NVSK ];

                peer-as 65432;

            }

        }

        group INET_v6_Customers {

            type external;

            family inet6 {

                unicast;

            }

            neighbor 1::2 {

                description "### Test IPv6 Client ###";

                import [ v6-sanity-check INET_v6_CUSTOMER_in mark-routes-sib mark-region-routes-NVSK ];

                peer-as 65432;

            }

        }

    }

}

policy-options {

    policy-statement sanity-check {

        term reject-bogons {

            from policy bogons;

            then reject;

        }

        term accept-blackhole {

            from community type_blackhole_route;

            then next policy;

        }

        term reject-long-prefixes {

            from {

                route-filter 0.0.0.0/0 prefix-length-range /25-/32 reject;

            }

        }

    }

    policy-statement bogons {

        term rfc6890 {

            from {

                route-filter 10.0.0.0/8 orlonger accept;

                route-filter 172.16.0.0/12 orlonger accept;

                route-filter 192.168.0.0/16 orlonger accept;

                route-filter 0.0.0.0/1 through 0.0.0.0/32 accept;

                route-filter 0.0.0.0/8 orlonger accept;

                route-filter 100.64.0.0/10 orlonger accept;           

                route-filter 127.0.0.0/8 orlonger accept;

                route-filter 192.0.0.0/24 orlonger accept;

                route-filter 192.0.2.0/24 orlonger accept;

                route-filter 169.254.0.0/16 orlonger accept;

                route-filter 192.88.99.0/24 orlonger accept;

                route-filter 224.0.0.0/4 orlonger accept;

                route-filter 240.0.0.0/4 orlonger accept;

                route-filter 198.18.0.0/15 orlonger accept;

                route-filter 198.51.100.0/24 orlonger accept;

                route-filter 203.0.113.0/24 orlonger accept;           

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement v6-sanity-check {

        term reject-bogons {

            from policy v6-bogons;

            then reject;

        }

        term reject-long-prefixes {

            from {

                route-filter ::/0 prefix-length-range /48-/128 reject;

            }

        }

    }

    policy-statement v6-bogons {

        term rfc6890 {

            from {

                route-filter ::/128 exact accept;

                route-filter ::1/128 exact accept;

                route-filter ::/1 through ::/128 accept;

                route-filter ::ffff:0:0/96 orlonger accept;

                route-filter 100::/64 orlonger accept;           

                route-filter 2001::/23 orlonger accept;

                route-filter 2001:2::/48 orlonger accept;           

                route-filter 2001:DB8::/32 orlonger accept;

                route-filter 2001:10::/28 orlonger accept; 

                route-filter 2002::/16 orlonger accept;

                route-filter 64:ff9b::/32 orlonger accept;

                route-filter FC00::/7 orlonger accept;

                route-filter FE80::/10 orlonger accept;

                route-filter FEC0::/10 orlonger accept;

                route-filter FF00::/8 orlonger accept;

             }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_CUSTOMER_in {

        term reject-RT-aggregate {

            from policy RT-aggregate;

            then reject;

        }

        term reject-RT-longer-prefixes {

            from policy RT-longer-prefixes;

            then reject;

        }

        term reject-default-route {

            from {

                route-filter 0.0.0.0/0 exact;

            }

            then reject;

        }

        term remove-12389-communities {

            then {

                community delete 12389:1-3X;

                community delete 12389:1UZZ;

            }

        term remove-Well-Known-communities

            then {

                community delete WellKnown0;

                community delete WellKnown65535;

            }

        }

        term set-parameters {

            then {

                metric 0;

                local-preference 850;

                community add type_Customer;

            }

        }

        term blackhole-route {

            from community type_blackhole_route;

            then {

                next-hop discard;

                community add NO_EXPORT;

                next policy;

            }

        }

        term backup-route {

            from community type_customer_backup_route;

            then {

                local-preference 800;

            }

        }

        term full-backup-route {

            from community type_full_backup_route;

            then {

                local-preference 100;

            }

        }

    }

    policy-statement RT-aggregate {

        term match-RT-aggregate-networks {

            from {

                route-filter 87.226.128.0/17 exact accept;

                route-filter 79.133.64.0/19 exact accept;

                route-filter 92.50.192.0/18 exact accept;

                route-filter 94.25.0.0/17 exact accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement RT-longer-prefixes {

        term match-RT-longer-prefixes {

            from {

                route-filter 87.226.128.0/17 longer accept;

                route-filter 79.133.64.0/19 longer accept;

                route-filter 92.50.192.0/18 longer accept;

                route-filter 94.25.0.0/17 longer accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_v6_CUSTOMER_in {

        term reject-RT-v6-aggregate {

            from policy RT-v6-aggregate;

            then reject;

        }

        term reject-RT-v6-longer-prefixes {

            from policy RT-v6-longer-prefixes;

            then reject;

        }

        term reject-default-route {

            from {

                route-filter ::/0 exact;

            }

            then reject;

        }

        term remove-12389-communities {

            then {

                community delete 12389:1-3X;

                community delete 12389:1UZZ;

            }

        }

        term remove-Well-Known-communities

            then {

                community delete WellKnown0;

                community delete WellKnown65535;

            }

        }

        term set-parameters {

            then {

                metric 0;

                local-preference 850;

                community add type_Customer;

            }

        }

        term blackhole-route {

            from community type_blackhole_route;

            then { 

                next-hop discard;

                community add NO_EXPORT;

                next policy;

            }      

        }   

        term backup-route {

            from community type_customer_backup_route;

            then {

                local-preference 800;

            }

        }

        term full-backup-route {

            from community type_full_backup_route;

            then {

                local-preference 100;

            }

        }

    }

    policy-statement RT-v6-aggregate {

        term match-RT-v6-aggregate-networks {

            from {

                route-filter 2A01:620::/32 exact accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement RT-v6-longer-prefixes {

        term match-RT-v6-longer-prefixes {

            from {

                route-filter 2A01:620::/32 longer accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement mark-routes-sib {

        term 1 {

            then {

                community add routes-SIB;

                next policy;

            }

        }

    }

    policy-statement mark-region-routes-NVSK {

        term 1 {

            then {

                community add routes-region-NVSK;

                next policy;

            }

        }

    }

    community 12389:1-3X members "^12389:.{1,3}$";

    community 12389:1UZZ members "^12389:1…$";

    community type_Customer members 12389:1;

    community type_Upstream members 12389:6;

    community type_blackhole_route members 12389:55555;

    community type_customer_backup_route members 12389:2800;

    community type_full_backup_route members 12389:2100;

    community NO_EXPORT members no-export;

    community WellKnown0 members ^0:*;

    community WellKnown65535 members 65535:*;

    community routes-SIB members "12389:1101$";

    community routes-region-NVSK members 12389:1254;

}

      Для корректной реализации пиринговой политики в сети при приёме маршрутов от клиентов на сервисных маршрутизаторах BPE устанавливается значение Local Pereference, равное 950. Для сервисных маршрутизаторов Juniper вместо политики INET_CUSTOMER_in можно использовать политику INET_BPE_CUSTOMER_in, пример которой приведён далее.

      Пример политики INET_BPE_CUSTOMER_in:

policy-options {

    policy-statement INET_BPE_CUSTOMER_in {

        term reject-RT-aggregate {

            from policy RT-aggregate;

            then reject;

        }

        term reject-RT-longer-prefixes {

            from policy RT-longer-prefixes;

            then reject;

        }

        term reject-default-route {

            from {

                route-filter 0.0.0.0/0 exact;

            }

            then reject;

        }

        term remove-12389-communities {

            then {

                community delete 12389:1-3X;

                community delete 12389:1UZZ;

            }

        term remove-Well-Known-communities

            then {

                community delete WellKnown0;

                community delete WellKnown65535;

            }

        }

        term set-parameters {

            then {

                metric 0;

                local-preference 950;

                community add type_Customer;

            }

        }

        term blackhole-route {

            from community type_blackhole_route;

            then {

                next-hop discard;

                community add NO_EXPORT;

                next policy;

            }

        }

        term backup-route {

            from community type_customer_backup_route;

            then {

                local-preference 800;

            }

        }

        term full-backup-route {

            from community type_full_backup_route;

            then {

                local-preference 100;

            }

        }

    }

    policy-statement RT-aggregate {

        term match-RT-aggregate-networks {

            from {

                route-filter 87.226.128.0/17 exact accept;

                route-filter 79.133.64.0/19 exact accept;

                route-filter 92.50.192.0/18 exact accept;

                route-filter 94.25.0.0/17 exact accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement RT-longer-prefixes {

        term match-RT-longer-prefixes {

            from {

                route-filter 87.226.128.0/17 longer accept;

                route-filter 79.133.64.0/19 longer accept;

                route-filter 92.50.192.0/18 longer accept;

                route-filter 94.25.0.0/17 longer accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_v6_BPE_CUSTOMER_in {

        term reject-RT-v6-aggregate {

            from policy RT-v6-aggregate;

            then reject;

        }

        term reject-RT-v6-longer-prefixes {

            from policy RT-v6-longer-prefixes;

            then reject;

        }

        term reject-default-route {

            from {

                route-filter ::/0 exact;

            }

            then reject;

        }

        term remove-12389-communities {

            then {

                community delete 12389:1-3X;

                community delete 12389:1UZZ;

            }

        }

        term remove-Well-Known-communities

            then {

                community delete WellKnown0;

                community delete WellKnown65535;

            }

        }

        term set-parameters {

            then {

                metric 0;

                local-preference 950;

                community add type_Customer;

            }

        }

        term blackhole-route {

            from community type_blackhole_route;

            then { 

                next-hop discard;

                community add NO_EXPORT;

                next policy;

            }      

        }   

        term backup-route {

            from community type_customer_backup_route;

            then {

                local-preference 800;

            }

        }

        term full-backup-route {

            from community type_full_backup_route;

            then {

                local-preference 100;

            }

        }

    }

    policy-statement RT-v6-aggregate {

        term match-RT-v6-aggregate-networks {

            from {

                route-filter 2A01:620::/32 exact accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement RT-v6-longer-prefixes {

        term match-RT-v6-longer-prefixes {

            from {

                route-filter 2A01:620::/32 longer accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    community 12389:1-3X members "^12389:.{1,3}$";

    community 12389:1UZZ members "^12389:1…$";

    community type_Customer members 12389:1;

    community type_Upstream members 12389:6;

    community type_blackhole_route members 12389:55555;

    community type_customer_backup_route members 12389:2800;

    community type_full_backup_route members 12389:2100;

    community NO_EXPORT members no-export;

    community WellKnown0 members ^0:*;

    community WellKnown65535 members 65535:*;

}

      В сети ПАО «Ростелеком» для защиты от некорректных маршрутов применяется фильтрация на основе информации Routing Arbiter Database (раздел «Принципы защиты оборудования регионального уровня»). Для формирования имени фильтра используется форма CUSTOMER:<ASN>, где <ASN> – номер автономной системы клиента или название AS-SET, AS-NUM или AUT-NUM, зарегистрированные в RIR. Такой фильтр добавляется в настройки после фильтра INET_CUSTOMER_in (или INET_BPE_CUSTOMER_in).


      Пример дополнительного фильтра при приёме маршрутов от клиента:

protocols {

    bgp {

        group INET_Customers {

            neighbor 1.1.1.2 {

                description "### Test Client ###";

                import CUSTOMER:65432;

                peer-as 65432;

            }

        }

    }

}

policy-options {

    policy-statement CUSTOMER:65432 {

        term rtbh {

            from {

                community type_blackhole_route;

                route-filter 2.1.0.0/16 orlonger;

                route-filter 1.2.3.0/24 orlonger;

            }

            then {

                community add NO_EXPORT;

                next-hop discard;

                accept;        

            }

        }

        term prefixes {

            from {

                route-filter 2.1.0.0/16 upto /24;

                route-filter 1.2.3.0/24 exact;

            }

            then next policy;

        }

        then reject;

    }

    community NO_EXPORT members no-export;

    community type_blackhole_route members 12389:55555;

}

      При передаче префиксов клиенту передаются в зависимости от типа клиента:

  • агрегированные префиксы Ростелеком и маршрут по умолчанию;
  • только агрегированные префиксы Ростелеком;
  • только маршрут по умолчанию;
  • все префиксы от апстримов и агрегированные префиксы Ростелеком;

      BGP Community Ростелеком удаляются, за исключением 12389:X.


      Пример политики анонсирования маршрутов клиенту для маршрутизаторов Juniper:

protocols {

    bgp {

        group INET_Customers {

            type external;

            neighbor 1.1.1.2 {

                description "### Test Client ###";

                local-address  1.1.1.1;

                export [ sanity-check INET_CUSTOMER_RT_and_default_out remove-communities ];

                peer-as 65432;

            }

        }

        group INET_v6_Customers {

            type external;

            family inet6 {

                unicast;

            }

            neighbor 1::2 {

                description "### Test Client ###";

                local-address 1::1;

                export [ v6-sanity-check INET_v6_CUSTOMER_RT_and_default_out remove-communities ];

                peer-as 65432;

            }

        }

    }

}

policy-options {

    policy-statement sanity-check {

        term reject-bogons {

            from policy bogons;

            then reject;

        }

        term accept-blackhole {

            from community type_blackhole_route;

            then next policy;

        }

        term reject-long-prefixes {

            from {

                route-filter 0.0.0.0/0 prefix-length-range /25-/32 reject;

            }

        }

    }

    policy-statement bogons {

        term rfc6890 {

            from {

                route-filter 10.0.0.0/8 orlonger accept;

                route-filter 172.16.0.0/12 orlonger accept;

                route-filter 192.168.0.0/16 orlonger accept;

                route-filter 0.0.0.0/1 through 0.0.0.0/32 accept;

                route-filter 0.0.0.0/8 orlonger accept;

                route-filter 100.64.0.0/10 orlonger accept;           

                route-filter 127.0.0.0/8 orlonger accept;

                route-filter 192.0.0.0/24 orlonger accept;

                route-filter 192.0.2.0/24 orlonger accept;

                route-filter 169.254.0.0/16 orlonger accept;

                route-filter 192.88.99.0/24 orlonger accept;

                route-filter 224.0.0.0/4 orlonger accept;

                route-filter 240.0.0.0/4 orlonger accept;

                route-filter 198.18.0.0/15 orlonger accept;

                route-filter 198.51.100.0/24 orlonger accept;

                route-filter 203.0.113.0/24 orlonger accept;           

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement v6-sanity-check {

        term reject-bogons {

            from policy v6-bogons;

            then reject;

        }

        term reject-long-prefixes {

            from {

                route-filter ::/0 prefix-length-range /48-/128 reject;

            }

        }

    }

    policy-statement v6-bogons {

        term rfc6890 {

            from {

                route-filter ::/128 exact accept;

                route-filter ::1/128 exact accept;

                route-filter ::/1 through ::/128 accept;

                route-filter ::ffff:0:0/96 orlonger accept;

                route-filter 100::/64 orlonger accept;           

                route-filter 2001::/23 orlonger accept;

                route-filter 2001:2::/48 orlonger accept;           

                route-filter 2001:DB8::/32 orlonger accept;

                route-filter 2001:10::/28 orlonger accept; 

                route-filter 2002::/16 orlonger accept;

                route-filter 64:ff9b::/32 orlonger accept;

                route-filter FC00::/7 orlonger accept;

                route-filter FE80::/10 orlonger accept;

                route-filter FEC0::/10 orlonger accept;

                route-filter FF00::/8 orlonger accept;

             }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_v6_CUSTOMER_RT_and_default_out {

        term accept-RT-v6-aggregate {

            from policy RT-v6-aggregate;

            then next policy;

        }

        term static-tag_1002 {

            from {

                protocol [ static aggregate ];

                tag [ 1002 1003 1031 1032 ];

            }

            then {

                metric 0;

                accept;

            }

        }

        term remote-static-tag_1002 {

            from {

                protocol bgp;

                community from_static_tag_1002;

            }

            then {

                metric 0;

                accept;

            }

        }

        term accept-default-route {

            from {

                route-filter ::/0 exact;

            }

            then {

                metric 0;

                accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_v6_CUSTOMER_RT_only_out {

        term accept-RT-v6-aggregate {

            from policy RT-v6-aggregate;

            then next policy;

        }

        term static-tag_1002 {

            from {

                protocol [ static aggregate ];

                tag [ 1002 1003 1031 1032 ];

            }

            then {

                metric 0;

                accept;

            }

        }

        term remote-static-tag_1002 {

            from {

                protocol bgp;

                community from_static_tag_1002;

            }

            then {

                metric 0;

                accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_v6_CUSTOMER_default_out {

        term accept-default-route {

            from {

                route-filter ::/0 exact;

            }

            then {

                metric 0;

                accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_v6_CUSTOMER_full_out {

        term reject-RT-longer-prefixes {

            from policy RT-v6-longer-prefixes;

            then reject;

        }

        term static-tag_1002 {

            from {

                protocol [ static aggregate ];

                tag [ 1002 1003 1031 1032 ];

            }

            then {

                metric 0;

                accept;

            }

        }

        term accept-routes {

            from { 

                protocol bgp;

                community [ to_INET_Customer from_FED_Peer type_REG_Peer type_MRF_Peer ];

            }

            then next policy;

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement RT-v6-aggregate {

        term match-RT-v6-aggregate-networks {

            from {

                route-filter 2A01:620::/32 exact accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement RT-v6-longer-prefixes {

        term match-RT-v6-longer-prefixes {

            from {

                route-filter 2A01:620::/32 longer accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_CUSTOMER_RT_and_default_out {

        term accept-RT-aggregate {

            from policy RT-aggregate;

            then next policy;

        }

        term static-tag_1002 {

            from {

                protocol [ static aggregate ];

                tag [ 1002 1003 1031 1032 ];

            }

            then {

                metric 0;

                accept;

            }

        }

        term remote-static-tag_1002 {

            from {

                protocol bgp;

                community from_static_tag_1002;

            }

            then {

                metric 0;

                accept;

            }

        }

        term accept-default-route {

            from {

                route-filter 0.0.0.0/0 exact;

            }

            then {

                metric 0;

                accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_CUSTOMER_RT_only_out {

        term accept-RT-aggregate {

            from policy RT-aggregate;

            then next policy;

        }

        term static-tag_1002 {

            from {

                protocol [ static aggregate ];

                tag [ 1002 1003 1031 1032 ];

            }

            then {

                metric 0;

                accept;

            }

        }

        term remote-static-tag_1002 {

            from {

                protocol bgp;

                community from_static_tag_1002;

            }

            then {

                metric 0;

                accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_CUSTOMER_default_out {

        term accept-default-route {

            from {

                route-filter 0.0.0.0/0 exact;

            }

            then {

                metric 0;

                accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement INET_CUSTOMER_full_out {

        term reject-RT-longer-prefixes {

            from policy RT-longer-prefixes;

            then reject;

        }

        term static-tag_1002 {

            from {

                protocol [ static aggregate ];

                tag [ 1002 1003 1031 1032 ];

            }

            then {

                metric 0;

                accept;

            }

        }

        term accept-routes {

            from {

                protocol bgp;

                community [ to_INET_Customer from_FED_Peer type_REG_Peer type_MRF_Peer ];

            }

            then next policy;

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement remove-communities {

        term Clients {

            from community 12389:1X;

            then {

                community delete 12389:2-5X;

                next policy;

            }

        }

        term Community_12389 {

            from community 12389;

            then {

                community delete 12389;

            }

        }

    }

    policy-statement RT-aggregate {

        term match-RT-aggregate-networks {

            from {

                route-filter 87.226.128.0/17 exact accept;

                route-filter 79.133.64.0/19 exact accept;

                route-filter 92.50.192.0/18 exact accept;

                route-filter 94.25.0.0/17 exact accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    policy-statement RT-longer-prefixes {

        term match-RT-longer-prefixes {

            from {

                route-filter 87.226.128.0/17 longer accept;

                route-filter 79.133.64.0/19 longer accept;

                route-filter 92.50.192.0/18 longer accept;

                route-filter 94.25.0.0/17 longer accept;

            }

        }

        term reject-others {

            then reject;

        }

    }

    community 12389 members 12389:*;

    community to_Upstream members "^12389:1$";

    community 12389:1X members "^12389:.$";

    community 12389:2-5X members "^12389:.{2,5}$";

    community to_INET_Customer members "^12389:[16]$";

    community from_FED_Peer members "^12389:[57]$";

    community type_REG_Peer members 12389:9;

    community type_MRF_Peer members 12389:8;

    community from_static_tag_1002 members "12389:1 12389:4";

}

      В ряде случаев необходимо передавать маршрут по умолчанию клиентам, которым передаётся полная таблица маршрутизации. В этом случае вместе с политиками INET_CUSTOMER_full_out и INET_v6_CUSTOMER_full_out применяются политики announce-default и announce-v6-default соответственно.


Обработка маршрутов при подключении клиентов Internet

      Пример политики анонсирования маршрута по умолчанию:

policy-options {
    policy-statement {
        announce-default {
            term accept-default-route {
                from {
                    route-filter 0.0.0.0/0 exact;
                }
                then {
                    metric 0;
                    accept;
               }
            }
    }
        announce-v6-default {
            term accept-default-route {
                from {
                    route-filter ::/0 exact;
                }
                then {
                    metric 0;
                    accept;
               }
            }
    }
}
}

      При подключении некоторых клиентов может потребоваться передача им community, описывающих источник маршрута (номер upstream или peer: 12389:15ZZ, 12389:16ZZ и 12389:17ZZ. 

В этом случае вместо policy-statement remove-communities применяется policy-statement remove-communities-except-sources.

      Пример политики анонсирования маршрутов клиенту для маршрутизаторов Juniper:

policy-options {   

    policy-statement remove-communities-except-sources {

        term Delete_Community_12389 {

            then community delete 12389_Except_1X_and_Sources;

        }

    }

    community 12389_Except_1X_and_Sources {

        invert-match;

        members "^12389:((.)|(1[567]..))$";

    }

}

No comments:

Post a Comment

Процессинг с майнинга или работаем с криптой без вложений

     За последние пару лет развелось много всяких биткоин-проектов, обещающих просто космические проценты по вкладам, которые ничем и ни кем...

Search This Blog