Изначальная конфигурация BGP:
samovarov@imhtst1# show protocols bgp traceoptions { file bgp.log size 1m files 5; } group internal-peers { type external; description Internal-peers; local-address 10.2.2.253; export imhtst1-to-ALL; local-as 65532; neighbor 10.2.2.3 { description PMH; family inet { unicast; } peer-as 65101; } neighbor 10.252.1.2 { description jun100; local-address 10.252.1.1; family inet { unicast; } peer-as 65533; } }
Здесь мы выполняем экспорт обоим соседям согласно правилам:
samovarov@imhtst1# show policy-options policy-statement imhtst1-to-ALL term net-obn-routes { from { prefix-list-filter net-imhtst1-prfx orlonger; } then accept; } term else { then reject; } [edit] samovarov@imhtst1# show policy-options prefix-list net-imhtst1-prfx 10.253.10.0/24;
Cо стороны jun100_obn36a маршрут до внутренней сети imhtst1 выглядит следующим образом:
samovarov@jun100_obn36a> show route 10.253.10.0 inet.0: 30 destinations, 32 routes (30 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.253.10.0/24 *[BGP/170] 00:02:38, localpref 100 AS path: 65532 I > to 10.252.1.1 via st0.1 [BGP/170] 00:02:38, localpref 100, from 10.2.2.3 AS path: 65101 65532 I > to 10.2.2.253 via st0.0
Т.е. более предпочтителен маршрут через 10.252.1.1 via st0.1, поскольку здесь короче AS path.
Повлияем на данный маршрут, используя as-path-prepend.
Создадим новую policy-statement imhtst1-to-ALL2:
samovarov@imhtst1# show policy-options policy-statement imhtst1-to-ALL2 term net-obn-routes { from { prefix-list-filter net-imhtst1-prfx orlonger; } then { as-path-prepend "65532 65532 65532 65532 65532"; accept; } } term else { then reject; }
Здесь мы добавили сразу 5 штук номеров local-as 65532 для imhtst1.
Далее добавляем экспорт к настройке neighbor 10.252.1.2:
samovarov@imhtst1# show protocols bgp traceoptions { file bgp.log size 1m files 5; } group internal-peers { type external; description Internal-peers; local-address 10.2.2.253; export imhtst1-to-ALL; local-as 65532; neighbor 10.2.2.3 { description PMH; family inet { unicast; } peer-as 65101; } neighbor 10.252.1.2 { description jun100; local-address 10.252.1.1; family inet { unicast; } export imhtst1-to-ALL2; peer-as 65533; } }
С такой настройкой на neighbor 10.2.2.3 будет влиять export imhtst1-to-ALL.
Но на neighbor 10.252.1.2 повлияет наша новая export imhtst1-to-ALL2.
Тогда со стороны jun100_obn36a маршрут до внутренней сети imhtst1 поменяется:
samovarov@jun100_obn36a> show route 10.253.10.0 inet.0: 30 destinations, 32 routes (30 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.253.10.0/24 *[BGP/170] 00:18:43, localpref 100, from 10.2.2.3 AS path: 65101 65532 I > to 10.2.2.253 via st0.0 [BGP/170] 00:02:57, localpref 100 AS path: 65532 65532 65532 65532 65532 65532 I > to 10.252.1.1 via st0.1
samovarov@jun100_obn36a# show protocols bgp traceoptions { file bgp.log size 1m files 5; } group internal-peers { type external; description Internal-peers; local-address 10.2.2.254; export OBN-to-ALL; local-as 65533; neighbor 10.2.2.3 { description PMH; family inet { unicast; } peer-as 65101; } neighbor 10.252.1.1 { description imhtst1; local-address 10.252.1.2; family inet { unicast; } export OBN-to-ALL2; peer-as 65532; } inactive: neighbor 10.252.100.1 { description imhtst1; local-address 10.252.100.2; family inet { unicast; } peer-as 65532; } } samovarov@jun100_obn36a# show policy-options policy-statement OBN-to-ALL term net-obn-routes { from { prefix-list-filter customers orlonger; } then accept; } term others { then reject; } [edit] samovarov@jun100_obn36a# show policy-options policy-statement OBN-to-ALL2 term net-obn-routes { from { prefix-list-filter customers orlonger; } then { as-path-prepend "65533 65533 65533 65533 65533"; accept; } } term others { then reject; } samovarov@jun100_obn36a# show policy-options prefix-list customers 192.168.254.0/24;
Тогда со стороны imhtst1 маршрут до внутренней сети jun100_obn36a также поменяется:
samovarov@imhtst1> show route 192.168.254.0 inet.0: 30 destinations, 32 routes (29 active, 0 holddown, 1 hidden) + = Active Route, - = Last Active, * = Both 192.168.254.0/24 *[BGP/170] 21:46:32, localpref 100, from 10.2.2.3 AS path: 65101 65533 I, validation-state: unverified > to 10.2.2.254 via st0.0 [BGP/170] 00:03:55, localpref 100 AS path: 65533 65533 65533 65533 65533 65533 I, validation-state: unverified > to 10.252.1.2 via st0.1
Источник:
https://www.juniper.net/documentation/en_US/junos/topics/example/routing...
Добавить комментарий