sudo apt install bird2 -y
Periksa versi yang terinstall
bird --version
Aktifkan bird agar auto start pada saat startup
sudo systemctl enable --now bird
Agar traffic yang lewat bisa di forward aktifkan berikut
nano /etc/sysctl.conf
Uncomment bagian berikut
#net.ipv4.ip_forward=1
Sehingga menjadi seperti berikut
net.ipv4.ip_forward=1
Muat ulang konfigurasi
sysctl -p
Agar bird dapat mengenali IP yang terpasang di interface sebagai protocol direct lakukan langkah berikut
Beri comment pada baris disabled;
protocol direct {
disabled; # Disable by default
ipv4; # Connect to default IPv4 table
ipv6; # ... and to default IPv6 table
}
Sehingga menjadi seperti berikut
protocol direct {
# disabled; # Disable by default
ipv4; # Connect to default IPv4 table
ipv6; # ... and to default IPv6 table
}
Agar route yang di set di kernel/diluar bird (misalnya static route dengan ip route add
) dapat dikenali/dibaca oleh bird lakukan langkah berikut
Hapus comment pada baris learn;
protocol kernel {
ipv4 { # Connect protocol to IPv4 table by channel
# table master4; # Default IPv4 table is master4
# import all; # Import to table, default is import all
export all; # Export to protocol. default is export none
};
# learn; # Learn alien routes from the kernel
# kernel table 10; # Kernel table to synchronize with (default: main)
}
Sehingga menjadi seperti berikut
protocol kernel {
ipv4 { # Connect protocol to IPv4 table by channel
# table master4; # Default IPv4 table is master4
# import all; # Import to table, default is import all
export all; # Export to protocol. default is export none
};
learn; # Learn alien routes from the kernel
# kernel table 10; # Kernel table to synchronize with (default: main)
}
Agar bird mendeteksi interface yang up atau down dengan cepat ubah scan time
ke waktu yang lebih cepat, defaultnya di bird2 tidak mendefinisikan scan time
dan defaultnya adalah 60 detik
protocol device {
}
Tambahkan baris berikut scan time 5;
(bird mengecek setiap 5 detik)
Sehingga menjadi seperti berikut
protocol device {
scan time 5;
}
Contoh Konfigurasi BGP Peer
Contoh BGP peer
protocol bgp RO2 {
local 12.12.12.1;
local as 100;
neighbor 12.12.12.2;
neighbor as 200;
ipv4 {
export all;
import all;
};
}
Contoh BGP peer dengan custom filter
protocol bgp RO2 {
local 12.12.12.1;
local as 100;
neighbor 12.12.12.2;
neighbor as 200;
ipv4 {
export filter FILTERNAME_out;
import filter FILTERNAME_in;
};
}
Contoh BGP peer Multihop
protocol bgp RO2 {
local 12.12.12.1;
local as 100;
neighbor 12.12.12.2;
neighbor as 200;
multihop;
ipv4 {
export filter FILTERNAME_out;
import filter FILTERNAME_in;
};
}
Contoh BGP peer Route Reflector client
protocol bgp RO2 {
local 12.12.12.1;
local as 100;
neighbor 12.12.12.2;
neighbor as 200;
rr client;
rr cluster id 1.1.1.1;
ipv4 {
export filter FILTERNAME_out;
import filter FILTERNAME_in;
};
}
Route Filtering
Contoh Mengubah BGP attribute local preference
filter RO2_in {
if ( net = 2.2.2.2/32 ) then {
bgp_local_pref = 200;
accept;
}
else accept;
}
Contoh BGP AS path prepend (2x)
filter RO2_out {
if ( net = 1.1.1.1/32 ) then {
bgp_path.prepend(100);
bgp_path.prepend(100);
accept;
}
else reject;
}
100 adalah ASNumber
Contoh BGP menambahkan attribute community
filter RO2_out {
if ( net = 1.1.1.1/32 ) then {
bgp_community.add((100,109));
accept;
}
else reject;
}
Contoh BGP menambahkan attribute large community
filter RO2_out {
if ( net = 1.1.1.1/32 ) then {
bgp_large_community.add((100,200,109));
accept;
}
else reject;
}
Contoh BGP dengan validasi ROA
## ROA VALIDATION
function is_rpki_invalid() {
if (net.type = NET_IP4) then {
return roa_check(rpki4, net, bgp_path.last_nonaggregated) = ROA_INVALID;
}
if (net.type = NET_IP6) then {
return roa_check(rpki6, net, bgp_path.last_nonaggregated) = ROA_INVALID;
}
}
filter neighbor_in {
if ( is_rpki_invalid() ) then {
reject;
}
else accept;
Konfigurasi RPKI ROA
# ROA table untuk IPv4 dan IPv6
roa4 table rpki4;
roa6 table rpki6;
# RPKI protocol RTR dari RPKI Cache Server seperti routinator
protocol rpki rpki_roa {
roa4 { table rpki4; };
roa6 { table rpki6; };
remote 10.0.0.1 port 3323;
retry 30;
}
–
–
–
–
–
Usefull Command
Melihat prefix yang diterima dari BGP neighbor
show route protocol neighbor_name
Melihat prefix yang diterima dari BGP neighbor dengan detail
show route protocol neighbor_name all
Melihat ip dengan tujuan prefix tertentu yang diterima dari neighbor tertentu
show route for 192.168.1.1 protocol neighbor_name all
Melihat prefix yang dikirim ke neighbor tertentu dengan detail
show route export neighbor_name all