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 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:
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:
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.