Перейти к содержимому
Калькуляторы

bgp-blackhole на MX80

Делал по этому мануалу. Казалось бы, что может быть проще, но не работает у меня.

 

root@mx80> show version
Hostname: mx80
Model: mx5-t
Junos: 13.3R3.6
JUNOS Base OS boot [13.3R3.6]
JUNOS Base OS Software Suite [13.3R3.6]
JUNOS Kernel Software Suite [13.3R3.6]
JUNOS Crypto Software Suite [13.3R3.6]
JUNOS Packet Forwarding Engine Support (MX80) [13.3R3.6]
JUNOS Online Documentation [13.3R3.6]
JUNOS Services Application Level Gateways [13.3R3.6]
JUNOS Services Jflow Container package [13.3R3.6]
JUNOS Services Stateful Firewall [13.3R3.6]
JUNOS Services NAT [13.3R3.6]
JUNOS Services RPM [13.3R3.6]
JUNOS Services Crypto [13.3R3.6]
JUNOS Services SSL [13.3R3.6]
JUNOS Services IPSec [13.3R3.6]
JUNOS Routing Software Suite [13.3R3.6]

root@mx80>

 

 

 

фильтр на импорт

 

traceoptions {
   file bgp.log size 1m files 30;
}
advertise-inactive;
log-updown;
damping;
import blackhole-import;
local-as XXXXX;
group upstreams {
   type external;
   import blackhole-import;
   ...
   neighbor XXX.XXX.XXX.162 {
       description "peer";
       import [ BGP-peer-IN blackhole-import ];
       export [ BGP-peer-OUT ebgp-export-default-originate ];
       peer-as XXXX4;
   }
   ...

 

show policy-options policy-statement blackhole-import

term 10 {
   then {
       local-preference 400;
       community add community_peer;
       accept;
   }
}
term 5 {
   from community blackhole;
   then {
       local-preference 1;
       next-hop discard;
       accept;
   }
}

 

 

 

term 10 отрабатывает, term 5 - нет. Что тут может быть не так?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Поменяйте местами :)

 

Разверну : названите терма не имеет значение, имеет значение его поряд в конфиге.

 

Для того чтобы засунуть наверх: insert term 5 before term 10

Ну или изначально создавать в правильном порядке )

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

уже поменял и заработало, но возникает другой вопрос.

если вынести в отдельный фильтр организацию blackhole то как заставить работать???

 

Для того чтобы засунуть наверх: insert term 5 before term 10

Ну или изначально создавать в правильном порядке )

Спасибо, не знал

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

уже поменял и заработало, но возникает другой вопрос.

если вынести в отдельный фильтр организацию blackhole то как заставить работать???

 

если правильно понял вопрос, то как-то так :

 

policy-statement blackhole-import {

term backhole {

blalblal;

}

 

then next policy;

}

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

If you specify more than one policy, they are evaluated in the order specified, from left to right, and the first matching filter is applied to the route. If no match is found, BGP places into the routing table only those routes that were learned from BGP routing devices. The policy framework software evaluates the routing policies in a chain sequentially. If an action specified in one of the policies manipulates a route characteristic, the policy framework software carries the new route characteristic forward during the evaluation of the remaining policies. For example, if the action specified in the first policy of a chain sets a route’s metric to 500, this route matches the criterion of metric 500 defined in the next policy.

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

root@mx80# show policy-options policy-statement blackhole-import term to-blackhole then next pol
                                                                                                         ^
syntax error, expecting ';', [Enter], or '|'.

Хм... вроде и JUNOS не старый очень, или проблема в руках........

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

policy-options policy-statement bgp-blackhole-VIK 
term Blackhole {
   from {
       community bgp-blackhole;
       prefix-list-filter pr-viktel orlonger;
   }
   then {
       tag 666;
       next-hop discard;
       accept;
   }
}
term Discard {
   from community bgp-blackhole;
   then reject;
}
then next policy;

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Большое спасибо, вроде разобрался

root@mx80# show policy-options policy-statement BGP-peer-IN
term 15 {
   then {
       local-preference 400;
       community add community_peer;
       next policy;
       accept;
   }
}

root@mx80# show policy-options policy-statement blackhole-import
term to-blackhole {
   from community blackhole;
   then {
       next-hop discard;
       next policy;
       accept;
   }
}

[edit]

причем нужно добавить next police на фильтру пиров также, поскльку (я так понимаю) загрузка фильтров так же идет последовательно

   neighbor xxx.xxx.xxx.xxx {
       description "peer";
       import [ BGP-peer-IN blackhole-import ];
       export [ BGP-peer-OUT ebgp-export-default-originate ];
       peer-as xxxx;
   }

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Я был бы Вам очень признателен если Вас не затруднит помочь с ebgp-export-default-originate

Завел дефаулт

routing-options {
   graceful-restart;
   static {
       route 0.0.0.0/0 {
           discard;
           no-install;
       }
   }
   router-id XXX.XXX.XXX.XXX;
   autonomous-system XXXXX;
}

фильтр для экспорта дефаулта по bgp

root@mx80# show policy-options policy-statement ebgp-export-default-originate
term default-originate {
   from {
       protocol static;
       route-filter 0.0.0.0/0 exact;
   }
   then {
       next-hop self;
       accept;
   }
}
term DenyOther {
   then reject;
}

[edit]

смотрим роутинг на дефаулт

root@mx80> show route 0.0.0.0/0 exact

inet.0: 578782 destinations, 2390837 routes (578475 active, 1 holddown, 4507 hidden)
Restart Complete
+ = Active Route, - = Last Active, * = Both

0.0.0.0/0          *[static/5] 03:50:00
                     Discard
                   [bGP/170] 4d 09:03:27, localpref 310
                     AS path: 11111 I, validation-state: unverified
                   > to XXX.XXX.XXX.225 via irb.2100
                   [bGP/170] 4d 08:59:38, localpref 300
                     AS path: 22222 33333 I, validation-state: unverified
                   > to XXX.XXX.XXX.45 via irb.13

root@mx80>

Вопрос в том, что при экспорте анонсируется пиру default не на мою AS-ку а на 11111

root@mx80> show route receive-protocol bgp XXX.XXX.XXX.162
 Prefix                  Nexthop              MED     Lclpref    AS path
 0.0.0.0/0               Self                                    11111 I

Как заставить использовать дефаулт каторый static а не c bgp прилетел?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Вы что-то странное сделали.

 

1) как по мне policy-statetement c blackhole должен идти первым, это же логично.

2) Вы перепутали уровень вложености, у меня next policy не в term

3) зачем в последнем policy-staterment next-policy?

 

Вопрос в том, что при экспорте анонсируется пиру default не на мою AS-ку а на 11111

root@mx80> show route receive-protocol bgp XXX.XXX.XXX.162

Prefix Nexthop MED Lclpref AS path

0.0.0.0/0 Self 11111 I

 

Как заставить использовать дефаулт каторый static а не c bgp прилетел?

 

Может все-таки advertising-protocol bgp ?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

1) как по мне policy-statetement c blackhole должен идти первым, это же логично.

идея в том, что бы навешать на все группу upstream в целом.

Ну да ладно, пиров не настолько много, при навешивании фильтра на сам пир тут конечно первым должен идти фильтр блекхола

Уровни вложенности поправил, все работает!

 

Может все-таки advertising-protocol bgp ?

Скопировал не с той строки, именно advertising-protocol bgp

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Покажите вывод advertising-protocol bgp

 

Покажите полиси export к этому пиру и в каком порядке они.

 

И зачем next-hop-self к ebgp пиру?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

If you specify more than one policy, they are evaluated in the order specified, from left to right, and the first matching filter is applied to the route. If no match is found, BGP places into the routing table only those routes that were learned from BGP routing devices. The policy framework software evaluates the routing policies in a chain sequentially. If an action specified in one of the policies manipulates a route characteristic, the policy framework software carries the new route characteristic forward during the evaluation of the remaining policies. For example, if the action specified in the first policy of a chain sets a route’s metric to 500, this route matches the criterion of metric 500 defined in the next policy.

это как ...

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

If you specify more than one policy, they are evaluated in the order specified, from left to right, and the first matching filter is applied to the route. If no match is found, BGP places into the routing table only those routes that were learned from BGP routing devices. The policy framework software evaluates the routing policies in a chain sequentially. If an action specified in one of the policies manipulates a route characteristic, the policy framework software carries the new route characteristic forward during the evaluation of the remaining policies. For example, if the action specified in the first policy of a chain sets a route’s metric to 500, this route matches the criterion of metric 500 defined in the next policy.

это как ...

Там речь о том, что если в первой policy применились какие-то атрибуты, то при применении во второй полиси префикс наследует атрибут отредактированный в первой.

 

 

а вот тут показывают как работает цепочка полиси

http://www.juniper.net/documentation/en_US/junos15.1/topics/concept/policy-routing-policies-chain-evaluation-method.html

http://www.juniper.net/techpubs/en_US/junos14.1/topics/example/bgp-policy-chains.html

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

всем спасибо, разобрался, все просто

в моем случае незнание что очередность фильтров играет роль - источник проблем

пример дефаулта здесь

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Здравствуйте! Да бы не плодить новой темы, прошу помочь с default'ом но уже для IPv6

Аналогично как и для IPv4 прописали default

rib inet6.0 {

generate {

route ::/0 {

metric 10000;

discard;

}

}

}

Смотрим show route table inet6.0

 

inet6.0: 32972 destinations, 126692 routes (32908 active, 0 holddown, 405 hidden)

Restart Complete

+ = Active Route, - = Last Active, * = Both

 

::/0 *[Aggregate/130] 01:08:30, metric 10000

Discard

[bGP/170] 01:56:11, localpref 320

AS path: 35297 I, validation-state: unverified

> to xxxx:xxxx:xxxx:xxxx::xxxx:4ae1 via irb.1100

то есть, далее

a# show policy-options policy-statement ebgp-export-default-originate-v6

term default-originate {

from {

protocol static;

route-filter ::/0 exact;

}

then accept;

}

 

После навешивания пиру в качестве экспорта ebgp-export-default-originate-v6, по прежнему анонситься default, который я получаю от uplink'а

Что тут может быть не так?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

rib inet6.0 {

generate {

route ::/0

term default-originate {

from {

protocol static;

term default-originate {
   from {
       protocol aggregate;

 

aggregate (generate) != static же

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 смайлов.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.