Sunday, September 18, 2016

bgp peering using bird

BIRD is a Internet Routing Daemon, it can run on many major os platforms such Linux, FreeBSD, and other Unix-like systems.

It supports many different routing protocols such as
    Multiple routing tables
    BGP
    RIP
    OSPF
    BFD
    Babel
    Static routes
    IPv6 Router Advertisements
    Inter-table protocol


1- install bird on ubuntu xenial 16.04
$ sudo apt-get install bird

- start the bird daemon
$ sudo /etc/init.d/bird restart

2-  we will peer with router 10.0.0.1, asn=1, accept all route and advertise 192.168.202.0/24, so update bird configure file /etc/bird/bird.conf as below

router id 198.51.100.1;
protocol kernel {
    export all;
    scan time 60;
    import none;
}
protocol device {
    scan time 60;
}
protocol static bgproutes {
    import all;
    route 192.168.202.0/24 via 10.0.0.5;
}

protocol bgp{
  import all;
  export where proto = "bgproutes"
#  export all;
  next hop self;
  description "peer n1";
  neighbor 10.0.0.1 as 1;
  local as 2;
}


3- interface with bird daemon with birdc
$ sudo birdc
- to update configuration file update edit use command configure
bird> configure
Reading configuration from /etc/bird/bird.conf
Reconfigured


4- on other site router configuration.
router bgp 1
 bgp router-id 10.0.0.1
 network 10.0.0.0/24
 network 10.0.15.0/24
 redistribute connected
 neighbor s1 peer-group
 neighbor s1 remote-as 2
 neighbor s1 soft-reconfiguration inbound
 neighbor 10.0.0.2 peer-group s1
 exit 



5- show the routes of both routers

- bird
bird> show route
10.0.15.0/24       via 10.0.0.1 on ens38 [bgp1 08:38:37] * (100) [AS1i]
10.0.0.0/24        via 10.0.0.1 on ens38 [bgp1 08:38:37] ! (100) [AS1i]
192.168.202.0/23   via 10.0.0.5 on ens38 [bgproutes 08:37:44] * (200)



- other router
n1# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, P - PIM, A - Babel,
       > - selected route, * - FIB route

C>* 10.0.0.0/24 is directly connected, eth0
C>* 127.0.0.0/8 is directly connected, lo
B>* 192.168.202.0/23 [20/0] via 10.0.0.2, eth0, 00:11:00

No comments:

Post a Comment