1. vvle@rs2-1804:~$ sudo cat /etc/bird.conf | egrep "^[^#]"
  2. log syslog all;
  3. log "/var/log/bird.log" { debug, trace, info, remote, warning, error, auth, fatal, bug };
  4. router id 10.81.15.49;
  5. define myas = 64540;
  6. ipv4 table master4;
  7. ipv6 table master6;
  8. ipv4 table T_Vlado_64530;
  9. ipv4 table T_ASR_64542;
  10. ipv4 table T_Grybas_64533;
  11. protocol device {
  12. }
  13. function bgp_in(int peeras)
  14. {
  15. if (bgp_path.first != peeras ) then return false;
  16. return true;
  17. }
  18. function bgp_out_comm(int peeras)
  19. {
  20. if ! (source = RTS_BGP ) then return false;
  21. if peeras > 65535 then
  22. {
  23. if (rt,0,peeras) ~ bgp_ext_community then return false;
  24. if (rt,myas,peeras) ~ bgp_ext_community then return true;
  25. if ((rt,0,myas) ~ bgp_ext_community) then return false;
  26. } else
  27. {
  28. if ((0,peeras) ~ bgp_community) || ((rt,0,peeras) ~ bgp_ext_community) then return false;
  29. if ((myas,peeras) ~ bgp_community) || ((rt,myas,peeras) ~ bgp_ext_community) then return true;
  30. if ((0, myas) ~ bgp_community) || ((rt,0,myas) ~ bgp_ext_community) then return false;
  31. }
  32. return true;
  33. }
  34. function bgp_out(int peeras)
  35. {
  36. if ! bgp_out_comm(peeras) then return false;
  37. }
  38. protocol direct {
  39. ipv4; # Connect to default IPv4 table
  40. ipv6; # ... and to default IPv6 table
  41. }
  42. template bgp PEERS {
  43. local as myas;
  44. rs client;
  45. ipv4 {
  46. import all;
  47. export all;
  48. };
  49. }
  50. template pipe PIPES {
  51. table master4;
  52. peer table T_Grybas_64533;
  53. peer table T_Vlado_64530;
  54. peer table T_ASR_64542;
  55. import none;
  56. export none;
  57. }
  58. filter bgp_in_Grybas_64533
  59. {
  60. if bgp_in(64533) then accept;
  61. reject;
  62. }
  63. filter bgp_out_Grybas_64533
  64. {
  65. if ! bgp_out(64533) then reject;
  66. accept;
  67. }
  68. protocol pipe P_Grybas_64533 from PIPES {
  69. description "Grybas testinis";
  70. peer table T_Grybas_64533;
  71. import filter bgp_in_Grybas_64533;
  72. export filter bgp_out_Grybas_64533;
  73. import limit 10 action block;
  74. };
  75. protocol bgp R_Grybas_64533 from PEERS {
  76. ipv4 { table T_Grybas_64533; };
  77. description "Grybas testinis";
  78. neighbor 10.81.15.51 as 64533;
  79. }
  80. filter bgp_in_Vlado_64530
  81. {
  82. if bgp_in(64530) then accept;
  83. reject;
  84. }
  85. filter bgp_out_Vlado_64530
  86. {
  87. if ! bgp_out(64530) then reject;
  88. accept;
  89. }
  90. protocol pipe P_Vlado_64530 from PIPES {
  91. description "Vlado testinis";
  92. peer table T_Vlado_64530;
  93. import filter bgp_in_Vlado_64530;
  94. export filter bgp_out_Vlado_64530;
  95. import limit 10 action block;
  96. };
  97. protocol bgp R_Vlado_64530 from PEERS {
  98. ipv4 { table T_Vlado_64530; };
  99. description "Vlado testinis";
  100. neighbor 10.81.15.50 as 64530;
  101. }
  102. filter bgp_in_ASR_64542
  103. {
  104. if bgp_in(64542) then accept;
  105. reject;
  106. }
  107. filter bgp_out_ASR_64542
  108. {
  109. if ! bgp_out(64542) then reject;
  110. accept;
  111. }
  112. protocol pipe P_ASR_64542 from PIPES {
  113. description "ASR testinis";
  114. peer table T_ASR_64542;
  115. import filter bgp_in_ASR_64542;
  116. export filter bgp_out_ASR_64542;
  117. import limit 10 action block;
  118. };
  119. protocol bgp R_ASR_64542 from PEERS {
  120. ipv4 { table T_ASR_64542; };
  121. description "ASR testinis";
  122. neighbor 10.81.15.52 as 64542;
  123. }
  124. vvle@rs2-1804:~$