- vvle@rs2-1804:~$ sudo cat /etc/bird.conf | egrep "^[^#]"
- log syslog all;
- log "/var/log/bird.log" { debug, trace, info, remote, warning, error, auth, fatal, bug };
- router id 10.81.15.49;
- define myas = 64540;
- ipv4 table master4;
- ipv6 table master6;
- ipv4 table T_Vlado_64530;
- ipv4 table T_ASR_64542;
- ipv4 table T_Grybas_64533;
- protocol device {
- }
- function bgp_in(int peeras)
- {
- if (bgp_path.first != peeras ) then return false;
- return true;
- }
- function bgp_out_comm(int peeras)
- {
- if ! (source = RTS_BGP ) then return false;
- if peeras > 65535 then
- {
- if (rt,0,peeras) ~ bgp_ext_community then return false;
- if (rt,myas,peeras) ~ bgp_ext_community then return true;
- if ((rt,0,myas) ~ bgp_ext_community) then return false;
- } else
- {
- if ((0,peeras) ~ bgp_community) || ((rt,0,peeras) ~ bgp_ext_community) then return false;
- if ((myas,peeras) ~ bgp_community) || ((rt,myas,peeras) ~ bgp_ext_community) then return true;
- if ((0, myas) ~ bgp_community) || ((rt,0,myas) ~ bgp_ext_community) then return false;
- }
- return true;
- }
- function bgp_out(int peeras)
- {
- if ! bgp_out_comm(peeras) then return false;
- }
- protocol direct {
- ipv4; # Connect to default IPv4 table
- ipv6; # ... and to default IPv6 table
- }
- template bgp PEERS {
- local as myas;
- rs client;
- ipv4 {
- import all;
- export all;
- };
- }
- template pipe PIPES {
- table master4;
- peer table T_Grybas_64533;
- peer table T_Vlado_64530;
- peer table T_ASR_64542;
- import none;
- export none;
- }
- filter bgp_in_Grybas_64533
- {
- if bgp_in(64533) then accept;
- reject;
- }
- filter bgp_out_Grybas_64533
- {
- if ! bgp_out(64533) then reject;
- accept;
- }
- protocol pipe P_Grybas_64533 from PIPES {
- description "Grybas testinis";
- peer table T_Grybas_64533;
- import filter bgp_in_Grybas_64533;
- export filter bgp_out_Grybas_64533;
- import limit 10 action block;
- };
- protocol bgp R_Grybas_64533 from PEERS {
- ipv4 { table T_Grybas_64533; };
- description "Grybas testinis";
- neighbor 10.81.15.51 as 64533;
- }
- filter bgp_in_Vlado_64530
- {
- if bgp_in(64530) then accept;
- reject;
- }
- filter bgp_out_Vlado_64530
- {
- if ! bgp_out(64530) then reject;
- accept;
- }
- protocol pipe P_Vlado_64530 from PIPES {
- description "Vlado testinis";
- peer table T_Vlado_64530;
- import filter bgp_in_Vlado_64530;
- export filter bgp_out_Vlado_64530;
- import limit 10 action block;
- };
- protocol bgp R_Vlado_64530 from PEERS {
- ipv4 { table T_Vlado_64530; };
- description "Vlado testinis";
- neighbor 10.81.15.50 as 64530;
- }
- filter bgp_in_ASR_64542
- {
- if bgp_in(64542) then accept;
- reject;
- }
- filter bgp_out_ASR_64542
- {
- if ! bgp_out(64542) then reject;
- accept;
- }
- protocol pipe P_ASR_64542 from PIPES {
- description "ASR testinis";
- peer table T_ASR_64542;
- import filter bgp_in_ASR_64542;
- export filter bgp_out_ASR_64542;
- import limit 10 action block;
- };
- protocol bgp R_ASR_64542 from PEERS {
- ipv4 { table T_ASR_64542; };
- description "ASR testinis";
- neighbor 10.81.15.52 as 64542;
- }
- vvle@rs2-1804:~$