# Configure logging
log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug };
log stderr all;
#log "tmp" all;
# Override router ID
router id 10.60.60.2;
protocol kernel {
# learn; # Learn all alien routes from the kernel
persist; # Don't remove routes on bird shutdown
scan time 20; # Scan kernel routing table every 20 seconds
# import none; # Default is import all
export all; # Default is export none
# kernel table 5; # Kernel table to synchronize with (default: main)
}
# This pseudo-protocol watches all interface up/down events.
protocol device {
scan time 10; # Scan interfaces every 10 seconds
}
# Static routes (again, there can be multiple instances, so that you
# can disable/enable various groups of static routes on the fly).
protocol static {
# disabled; # Disable by default
# table testable; # Connect to a non-default table
# preference 1000; # Default preference of routes
# debug { states, routes, filters, interfaces, events, packets };
# debug all;
# route 0.0.0.0/0 via 198.51.100.13;
# route 198.51.100.0/25 unreachable;
# route 10.0.0.0/8 unreachable;
# route 10.1.1.0:255.255.255.0 via 198.51.100.3;
# route 10.1.2.0:255.255.255.0 via 198.51.100.3;
# route 10.1.3.0:255.255.255.0 via 198.51.100.4;
# route 10.2.0.0/24 via "arc0";
route 103.166.141.0/32 via 10.60.60.1;
}
protocol bgp CCR1036 {
#disabled;
description "BGP Peer to CCR1036";
local as 65530;
neighbor 10.60.60.1 as 139967;
import filter {
##jika no label maka kasih label 65000:5678
# bgp_community = -empty-; bgp_community = add(bgp_community,(65000,5678));
##jika terima aspath 7717 maka kasih tag 50310:7717
if bgp_path ~ [= * 7717 * =] then
bgp_community = add(bgp_community,(50310,7717));
if bgp_path ~ [= * 7597 * =] then
bgp_community = add(bgp_community,(50310,7597));
##jika origin AS7713 maka kasih tag 50310:7713
if bgp_path ~ [= * 7713 =] then
bgp_community = add(bgp_community,(50310,7713));
##contoh reject AS20940
#if bgp_path ~ [= * 20940 * =] then reject;
##contoh reject prefix 45.126.184.0/22 saja
#if net ~ [ 45.126.184.0/22 ] then reject;
##contoh reject prefix 45.126.184.0/22 sampai prefix terkecil
#if net ~ [ 45.126.184.0/22+ ] then reject;
##contoh reject prefix 45.126.184.0/22 sampai prefix terkecil (cara lain)
#if net ~ 45.126.184.0/22 then reject;
##contoh reject prefix 36.90.0.0/16 sampai prefix terkecil
#if net ~ 36.90.0.0/16 then reject;
##yg matching bgp community 50310:17451 ditambahkan tag 39967:17451
if (50310,17451) ~ bgp_community then bgp_community.add((39967,17451));
##selain diatas maka accept
accept;
};
}
root@BSDRouter:~ # birdc
BIRD 1.6.8 ready.
bird> show protocols
name proto table state since info
kernel1 Kernel master up 23:07:34
device1 Device master up 23:07:34
static1 Static master up 23:07:34
CCR1036 BGP master up 04:44:52 Established
bird>
bird> show protocols all CCR1036
name proto table state since info
CCR1036 BGP master up 04:44:52 Established
Description: BGP Peer to CCR1036
Preference: 100
Input filter: (unnamed)
Output filter: REJECT
Routes: 20994 imported, 0 exported, 20994 preferred
Route change stats: received rejected filtered ignored accepted
Import updates: 231033 0 18 206404 24611
Import withdraws: 1430 0 --- 1408 40
Export updates: 24612 24611 1 --- 0
Export withdraws: 40 --- --- --- 0
BGP state: Established
Neighbor address: 10.60.60.1
Neighbor AS: 139967
Neighbor ID: 103.146.185.254
Neighbor caps: refresh AS4
Session: external AS4
Source address: 10.60.60.2
Hold timer: 138/180
Keepalive timer: 3/60
bird> show route where net ~ 45.126.184.0/22 all
45.126.185.0/24 via 10.60.60.1 on vlan605 [CCR1036 05:24:46] * (100) [AS17451i]
Type: BGP unicast univ
BGP.origin: IGP
BGP.as_path: 139967 17451
BGP.next_hop: 10.60.60.1
BGP.local_pref: 100
BGP.community: (0,32934) (17451,7033) (50310,17451) (39967,17451)
45.126.184.0/24 via 10.60.60.1 on vlan605 [CCR1036 05:24:45] * (100) [AS17451i]
Type: BGP unicast univ
BGP.origin: IGP
BGP.as_path: 139967 17451
BGP.next_hop: 10.60.60.1
BGP.local_pref: 100
BGP.community: (0,32934) (50310,17451) (39967,17451)
45.126.184.0/22 via 10.60.60.1 on vlan605 [CCR1036 05:24:46] * (100) [AS17451?]
Type: BGP unicast univ
BGP.origin: Incomplete
BGP.as_path: 139967 17451
BGP.next_hop: 10.60.60.1
BGP.local_pref: 100
BGP.atomic_aggr:
BGP.aggregator: 182.253.99.245 AS17451
BGP.community: (0,32934) (50310,17451) (39967,17451)