Jul 292011
 

Hello again this is the third and the last post of a series of posts about simple configuration examples implementing IPv4/IPv6 Dual Stack BGP on Open Source Routing platforms. Previous posts dealt with similar configuration for OpenBGPD and Quagga, this time we will touch a little the BiRD Dynamic Routing Platform.

BiRD
BiRD “was developed as a school project at Faculty of Math and Physics, Charles University Prague.” as its webpage says. It isnt very well known, but in my search of alternatives for routing it came to my attention many times, but its configuration complexity made me to avoid it. So the time has come with this lab, its my first time configuring this deamon and i must say that i was very excited while playing with this software, it is awesome, it took me some time to figure out its configuration philosophy, but once i had it, all the others aspects was straight forward. I found this routing platform very flexible and advanced with very high amount of configuration options. The next time that i will use linux as a router i will give BiRD a try to production and i believe it will give me back my favor.

Ok, now lets go to the lab informations:

ISP router details:

AS: 1000

IPv4 network: 10.0.0.0/8

IPv6 network: fc00::/32

Peering Interface: f0/2

Peering address IPv4: 10.0.0.5/30

Peering address IPv6: fc00::1:5/126

BiRD router details:

AS: 200

IPv4 network: 192.168.8.0/21

IPv6 network: fc00:2::/32

Peering Interface: eth0

Peering address IPv4: 10.0.0.6/30

Peering address IPv6: fc00::1:6/126

You can install BiRD via aptitude on Debian, BiRD’s author made 2 different versions of the daemon, one for IPv4 and one for IPv6 so if we want to have dual stack with this daemon we need to configure 2 files which are /etc/bird.conf and /etc/bird6.conf respectively.

Installation of BiRD on Debian:

root@debian:~# apt-get install bird6

Linux by default doesnt forwards network traffic, so we must turn forwarding on for both IPv4 and IPv6 on our server this can be done with the following 2 commands on the shell:

root@debian-quagga:~# sysctl net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
root@debian-quagga:~# sysctl net.ipv6.conf.all.forwarding=1
net.ipv6.conf.all.forwarding = 1

If you want to turn forwarding on at boot time you must change the above configuration on /etc/sysctl.com like mine’s below:

root@debian-quagga:~# cat /etc/sysctl.conf
...
...
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
net.ipv6.conf.all.forwarding=1
...
...

No lets head to BiRD’s configuration :


root@debian-bird:~# more /etc/bird.conf
# Logging to Syslog
log syslog all;

# Route ID
router id 10.0.0.6;

# How fast scans for interfaces
protocol device {
        scan time 10;
}

# Export routes to kernel
protocol kernel {
        export all;
        scan time 15;
}

# "Pull UP" Route for BGP
protocol static static_bgp {
        import all;

        route 192.168.8.0/21 reject;
}

# BGP Configuration
protocol bgp {
        import all;
        export where proto = "static_bgp";

        local as 200;
        neighbor 10.0.0.5 as 1000;
}

root@debian-bird:~# more /etc/bird6.conf
log syslog all;

listen bgp v6only;

router id 11.11.11.11;

protocol device {
        scan time 10;
}

protocol kernel {
        export all;
        scan time 15;
}

protocol static static_bgp {
        import all;

        route fc00:2::/32 reject;
}

protocol bgp {
        import all;
        export where proto = "static_bgp";

        local as 200;
        neighbor fc00::1:5 as 1000;
        source address fc00::1:6;
}

Now lets start the processes:

root@debian-bird:~# invoke-rc.d bird start
root@debian-bird:~# invoke-rc.d bird6 start

And verify:
For IPv4 we will use the birdc client:

root@debian-bird:~# birdc
BIRD 1.2.5 ready.
bird>

if we want to check our neighbor BiRD gives as a bunch of information

bird> show protocols all bgp1
name     proto    table    state  since       info
bgp1     BGP      master   up     22:58       Established
  Preference:     100
  Input filter:   ACCEPT
  Output filter:  
  Routes:         3 imported, 1 exported, 3 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              3          0          0          0          3
    Import withdraws:            0          0        ---          0          0
    Export updates:              4          3          0        ---          1
    Export withdraws:            0        ---        ---        ---          0
  BGP state:          Established
    Session:          external
    Neighbor AS:      1000
    Neighbor ID:      10.0.1.1
    Neighbor address: 10.0.0.5
    Nexthop address:  10.0.0.5
    Source address:   10.0.0.6
    Neighbor caps:    refresh
    Hold timer:       108/180
    Keepalive timer:  34/60

Show routes in RIB from BGP

bird> show route protocol bgp1
10.0.0.0/8         via 10.0.0.5 on eth0 [bgp1 22:58] * (100) [AS1000i]
192.168.0.0/21     via 10.0.0.5 on eth0 [bgp1 22:58] * (100) [AS100i]
192.168.16.0/21    via 10.0.0.5 on eth0 [bgp1 22:58] * (100) [AS300i]

Show route exported to kernel, then based on kernel’s weight of the protocol they are inserted into FIB

bird> show route export kernel1
10.0.0.0/8         via 10.0.0.5 on eth0 [bgp1 22:58] * (100) [AS1000i]
192.168.0.0/21     via 10.0.0.5 on eth0 [bgp1 22:58] * (100) [AS100i]
192.168.8.0/21     unreachable [static_bgp 22:58] * (200)
192.168.16.0/21    via 10.0.0.5 on eth0 [bgp1 22:58] * (100) [AS300i]

For IPv6 we will use the birdc6 client:

root@debian-bird:~# birdc6
BIRD 1.2.5 ready.
bird>

Show BGP Neighbord status:

bird> show protocols all bgp1
name     proto    table    state  since       info
bgp1     BGP      master   up     22:58       Established
  Preference:     100
  Input filter:   ACCEPT
  Output filter:  
  Routes:         3 imported, 1 exported, 3 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              3          0          0          0          3
    Import withdraws:            0          0        ---          0          0
    Export updates:              4          3          0        ---          1
    Export withdraws:            0        ---        ---        ---          0
  BGP state:          Established
    Session:          external
    Neighbor AS:      1000
    Neighbor ID:      10.0.1.1
    Neighbor address: fc00::1:5
    Nexthop address:  fc00::1:5
    Source address:   fc00::1:6
    Neighbor caps:    refresh
    Hold timer:       91/180
    Keepalive timer:  59/60

Show routes in RIB from BGP

bird> show route protocol bgp1
fc00::/32          via fc00::1:5 on eth0 [bgp1 22:58] * (100) [AS1000i]
fc00:1::/32        via fc00::1:5 on eth0 [bgp1 22:58] * (100) [AS100i]
fc00:3::/32        via fc00::1:5 on eth0 [bgp1 22:58] * (100) [AS300i]

Show routes exported to kernel, then based on kernel’s weight of the protocol they are inserted into FIB.

bird> show route export kernel1
fc00::/32          via fc00::1:5 on eth0 [bgp1 22:58] * (100) [AS1000i]
fc00:1::/32        via fc00::1:5 on eth0 [bgp1 22:58] * (100) [AS100i]
fc00:2::/32        unreachable [static_bgp 22:58] * (200)
fc00:3::/32        via fc00::1:5 on eth0 [bgp1 22:58] * (100) [AS300i]

This was the minimum configuration for BiRD, i think this daemon has a lot of potentials it seems to be very stable if you think that major IXP like DE-CIX, LINX and more use BiRD for their heavy loaded BGP Route Server who has some thousands of BGP Peerings. Keep up the good work guys at BiRD team.

Please feel free to contact me with anything about BiRD, like success stories etc, and ofcourse point me out my mistakes but please stay calm its my first time with this beast 🙂

Jul 262011
 

This is the second part of the simple configuration examples implementing IPv4/IPv6 Dual Stack BGP on Open Source Routing platforms. On the first post we had deal with the configuration of OpenBGPD on OpenBSD box, now its time for Linux and particulary its oldest routing daemon Quagga configured on Debian.

Quagga

Quagga is the oldest dynamic routing suite available on Linux today, it supports IPv6 and it has Cisco IOS-like interface that makes it the most attractive solution for those coming from a Cisco background like me, myself tried quagga as my first open source router also, but Quagga is like any old man, it can do some things well but its instability makes you very fraustated, some may argue on this but whenever i have tried it on real world scernarios with Multihoming and/or Multipath it failed all the times to get the uptime counter more than 1 month.

Enough with opinions, lets go straight to our lab information:

ISP router details:

AS: 1000

IPv4 network: 10.0.0.0/8

IPv6 network: fc00::/32

Peering Interface: f0/1

Peering address IPv4: 10.0.0.9/30

Peering address IPv6: fc00::1:9/126

Quagga router details:

AS: 300

IPv4 network: 192.168.16.0/21

IPv6 network: fc00:3::/32

Peering Interface: eth0

Peering address IPv4: 10.0.0.10/30

Peering address IPv6: fc00::1:A/126

The configuration of quagga for BGP spans in multiple files located /etc/quagga, but wait a minute, you said above that quagga has a cisco ios-like interface, yes, it has but we must first prepare our system to run the “vty” shell…

First of all we must install Quagga using apt-get

root@debian:~# apt-get install quagga
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  snmpd
The following NEW packages will be installed:
  quagga
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,721 kB of archives.
After this operation, 6,283 kB of additional disk space will be used.
Get:1 http://security.debian.org/ squeeze/updates/main quagga amd64 0.99.17-2+squeeze2 [1,721 kB]
Fetched 1,721 kB in 3s (561 kB/s)
Preconfiguring packages ...
Selecting previously deselected package quagga.
(Reading database ... 24324 files and directories currently installed.)
Unpacking quagga (from .../quagga_0.99.17-2+squeeze2_amd64.deb) ...
Processing triggers for man-db ...
Setting up quagga (0.99.17-2+squeeze2) ...
Loading capability module if not yet done.
Starting Quagga daemons (prio:10):.

Yeah!, is started lets verify…

root@debian:~# ps aux | grep quagga
root@debian:~#

Huh? where is its process?
Well, you are running too fast boy… first we have to declare on quagga which of its daemon we are going to use this is done simply by editing the /etc/quagga/daemons file, we need zebra daemon which is the base daemon of quagga and bgp daemon for our lab so my /etc/quagga/daemons file looks like this:

root@debian-quagga:~# cat /etc/quagga/daemons
# This file tells the quagga package which daemons to start.
#
# Entries are in the format: =(yes|no|priority)
#   0, "no"  = disabled
#   1, "yes" = highest priority
#   2 .. 10  = lower priorities
# Read /usr/share/doc/quagga/README.Debian for details.
#
# Sample configurations for these daemons can be found in
# /usr/share/doc/quagga/examples/.
#
...
...
...
zebra=yes
bgpd=yes
...
...

Linux by default doesnt forwards network traffic, so we must turn forwarding on for both IPv4 and IPv6 on our server this can be done with the following 2 commands on the shell:

root@debian-quagga:~# sysctl net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
root@debian-quagga:~# sysctl net.ipv6.conf.all.forwarding=1
net.ipv6.conf.all.forwarding = 1

If you want to turn forwarding on at boot time you must change the above configuration on /etc/sysctl.com like mine’s below:

root@debian-quagga:~# cat /etc/sysctl.conf
...
...
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
net.ipv6.conf.all.forwarding=1
...
...

Now we can start Quagga with the following command:

root@debian-quagga:~# invoke-rc.d quagga start
Loading capability module if not yet done.
Starting Quagga daemons (prio:10): zebra bgpd.

Aha! now its says what came up, zebra and bgpd and now we can type the vtysh command to connect to the ios-like interface


root@debian-quagga:~# vtysh

Hello, this is Quagga (version 0.99.17).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

debian-quagga# sh run
Building configuration...

Current configuration:
!
!
interface eth2
 ipv6 nd suppress-ra
!
interface lo
!
router bgp 300
 bgp router-id 10.0.0.10
 network 192.168.16.0/21
 neighbor 10.0.0.9 remote-as 1000
 neighbor 10.0.0.9 soft-reconfiguration inbound
 neighbor fc00::1:9 remote-as 1000
!
 address-family ipv6
 network fc00:3::/32
 neighbor fc00::1:9 activate
 exit-address-family
!
ip forwarding
ipv6 forwarding
!
line vty
!

Once you have complete your configuration, you can “write” your changes to startup config 😉

debian-quagga# wr
Building Configuration...
Configuration saved to /etc/quagga/zebra.conf
Configuration saved to /etc/quagga/bgpd.conf
[OK]

Now lets verify our configuration:

First lets see our neigbors, their uptime and number of prefixes learned via them.
(Notice the bug on received prefixes of IPv6 neighbor, dont get confused later on command “show ipv6 route bgp” we will see that we have “learned” the IPv6 routes.)

debian-quagga# sh ip bgp summary
BGP router identifier 10.0.0.10, local AS number 300
RIB entries 7, using 672 bytes of memory
Peers 2, using 9120 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.0.9        4  1000      24      21        0    0    0 00:17:09        3
fc00::1:9       4  1000      24      21        0    0    0 00:17:05        0

Total number of neighbors 2

Show IPv4 routes that they are in the RIB

debian-quagga# sh ip bgp
BGP table version is 0, local router ID is 10.0.0.10
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.0.0.0         10.0.0.9                 0             0 1000 i
*> 192.168.0.0/21   10.0.0.9                               0 1000 100 i
*> 192.168.8.0/21   10.0.0.9                               0 1000 200 i
*> 192.168.16.0/21  0.0.0.0                  0         32768 i

Total number of prefixes 4

Show IPv6 routes that they are in the RIB

debian-quagga# sh ipv6  bgp
BGP table version is 0, local router ID is 10.0.0.10
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> fc00::/32        fc00::1:9                0             0 1000 i
*> fc00:1::/32      fc00::1:9                              0 1000 100 i
*> fc00:2::/32      fc00::1:9                              0 1000 200 i
*> fc00:3::/32      ::                       0         32768 i

Total number of prefixes 4

Now lets take a look at the IPv4 BGP routes in the FIB

debian-quagga# sh ip route bgp
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
       I - ISIS, B - BGP, > - selected route, * - FIB route

B>* 10.0.0.0/8 [20/0] via 10.0.0.9, eth0, 00:15:05
B>* 192.168.0.0/21 [20/0] via 10.0.0.9, eth0, 00:15:05
B>* 192.168.8.0/21 [20/0] via 10.0.0.9, eth0, 00:15:05

The same for IPv6

debian-quagga# sh ipv6 route bgp
Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3,
       I - ISIS, B - BGP, * - FIB route.

B>* fc00::/32 [20/0] via fe80::c000:bff:fe6c:10, eth0, 00:16:10
B>* fc00:1::/32 [20/0] via fe80::c000:bff:fe6c:10, eth0, 00:16:10
B>* fc00:2::/32 [20/0] via fe80::c000:bff:fe6c:10, eth0, 00:16:10

And we are done on setting Dual Stack with Linux and Quagga, even on this simple lab, quagga has issues like the “show ip bgp summary” command, but to be fair, it can do very well on simple scenarios, i am using it on some very simple, production deployments and it works like a charm, but try to get away from quagga on enterprise networks.

Thanks for your time reading my 2nd article on Dual Stacking Open Source Routing Platforms please feel free to drop me comments or dm on twitter about any mistake i have done.

Jul 232011
 

This is my first post and also the first post of a series that it deals with simple configuration examples on implementing IPv4/IPv6 Dual Stack BGP on Open Source Routing platforms, these configurations are only the basics to help you get Dual Stack up on your network. The post have the intention of giving informations on how to configure OpenBGPD. I will not explain tha basics of OpenBSD’s networking like installation or interface configuration etc, i will just give you the complete solution to get it running, maybe later i will make a post about these basics but i think the official FAQ is enough.

OpenBGPD

In my opinion OpenBSD with OpenBGPD and/or OpenOSPFD is the most rock-solid stable open source solution out there but this ofcourse is my point of view, both stable and easy to use, and it comes with the world’s best man pages, so use this only as starting point if you man bgpd.conf all configuration options are there very clear, if you dont see a feature on this man page then OpenBGPD doesnt support the feature at all, this is the cost to stay stable i think. I am running a number of production servers with OpenBSD and OpenBGPD but i dont use Dual Stack yet so i havent tested such configuration in the real world.

Lets go straight to lab informations.

ISP router details:

AS: 1000

IPv4 network: 10.0.0.0/8

IPv6 network: fc00::/32

Peering Interface: f0/1

Peering address IPv4: 10.0.0.1/30

Peering address IPv6: fc00::1:1/126

OpenBGPD router details:

AS: 100

IPv4 network: 192.168.0.0/21

IPv6 network: fc00:1::/32

Peering Interface: em0

Peering address IPv4: 10.0.0.2/30

Peering address IPv6: fc00::1:2/126

The configuration of OpenBGPD to announce our networks and learn our ISP’s networks is as follow:

# cat /etc/bgpd.conf
# Global configuration
AS 100
router-id 10.0.0.2

# Our Address Space
network 192.168.0.0/21
network fc00:1::/32

# IPv4 Peers
neighbor 10.0.0.1 {
        remote-as       1000
        descr           UpstreamIPv4
        local-address   10.0.0.2
        announce        IPv4 unicast
}

# IPv6 Peers
neighbor fc00::1:1 {
        remote-as       1000
        descr           UpstreamIPv6
        local-address   fc00::1:2
        announce        IPv6 unicast
}

OpenBSD by default doesnt forwards traffic so we have to turn on forwarding for IPv4 and IPv6 this can be done from the console with the following commands:

# sysctl net.inet.ip.forwarding=1
net.inet.ip.forwarding: 1 -> 1
# sysctl net.inet6.ip6.forwarding=1
net.inet6.ip6.forwarding: 1 -> 1

if you want to start forwarding at boot you must change the above values on /etc/sysctl.conf as shown below.

#       $OpenBSD: sysctl.conf,v 1.49 2011/02/16 10:37:45 mikeb Exp $
#
# This file contains a list of sysctl options the user wants set at
# boot time.  See sysctl(3) and sysctl(8) for more information on
# the many available variables.
#
net.inet.ip.forwarding=1        # 1=Permit forwarding (routing) of IPv4 packets
#net.inet.ip.mforwarding=1      # 1=Permit forwarding (routing) of IPv4 multicast packets
#net.inet.ip.multipath=1        # 1=Enable IP multipath routing
#net.inet.icmp.rediraccept=1    # 1=Accept ICMP redirects
#net.inet6.icmp6.rediraccept=0  # 0=Don't accept IPv6 ICMP redirects
net.inet6.ip6.forwarding=1      # 1=Permit forwarding (routing) of IPv6 packets
#net.inet6.ip6.mforwarding=1    # 1=Permit forwarding (routing) of IPv6 multicast packets
#net.inet6.ip6.multipath=1      # 1=Enable IPv6 multipath routing
#net.inet6.ip6.accept_rtadv=1   # 1=Permit IPv6 autoconf (forwarding must be 0)
...
...
...

Next we need to start BGP daemon, this can be done from console with the following command:

# bgpd

if you want to start bgpd at boot you must change the below line on the file /etc/rc.local

# more /etc/rc.conf | grep bgpd
bgpd_flags=""           # for normal use: ""

Verify Commands:

# bgpctl show
Neighbor                   AS    MsgRcvd    MsgSent  OutQ Up/Down  State/PrfRcvd
UpstreamIPv6             1000          8          3     0 00:00:28      4
UpstreamIPv4             1000          8          3     0 00:00:28      4

shows us our neighbors their uptime and received prefixes numbers.

# bgpctl show rib
flags: * = Valid, > = Selected, I = via IBGP, A = Announced
origin: i = IGP, e = EGP, ? = Incomplete

flags destination          gateway          lpref   med aspath origin
*>    10.0.0.0/8           10.0.0.1           100     0 1000 i
AI*>  192.168.0.0/21       0.0.0.0            100     0 i
      192.168.0.0/21       10.0.0.1           100     0 1000 100 i
*>    192.168.8.0/21       10.0.0.1           100     0 1000 200 i
*>    192.168.16.0/21      10.0.0.1           100     0 1000 300 i
*>    fc00::/32            fc00::1:1          100     0 1000 i
AI*>  fc00:1::/32          ::                 100     0 i
      fc00:1::/32          fc00::1:1          100     0 1000 100 i
*>    fc00:2::/32          fc00::1:1          100     0 1000 200 i
*>    fc00:3::/32          fc00::1:1          100     0 1000 300 i

shows us all routes received from our neigbors and they are added to our RIB it also shows our announced prefixes.

# bgpctl show fib bgp
flags: * = valid, B = BGP, C = Connected, S = Static
       N = BGP Nexthop reachable via this route
       r = reject route, b = blackhole route

flags prio destination          gateway
*B      48 10.0.0.0/8           10.0.0.1
*B      48 192.168.8.0/21       10.0.0.1
*B      48 192.168.16.0/21      10.0.0.1
*B      48 fc00::/32            fc00::1:1
*B      48 fc00:2::/32          fc00::1:1
*B      48 fc00:3::/32          fc00::1:1

show us routes selected from bgp daemon and they are placed to the kernel’s routing table or Forwarding Table.

Thats all for OpenBGPD configuration, i am not an OpenBGPD or OpenBSD master so i will be very glad to receive feedback from you about any mistakes i have done in this post or recommendations.