Nov 062015

This is a small setup instruction for BGP peering test, followed by a small group of test scenarios.

I did a lot of job interviews this year. Some for QA, some for Network Administrator, etc. Lately, for a job interview, I was asked to do some routing configuration. As a home-work. So, I hope by sharing this, I can help you get the basics of this simple routing setup.

In the past, when I was working as an ISP network administrator in Telecable SA, I had to set a BGP session to my main ISP. For this I used Zebra.

Zebra was discontinued in 2005, but a brave group of open source enthusiast grabbed the idea and continued working. Since then the product grew into a better routing software supporting even more protocols. They called it Quagga.  The list of supported protocols now goes as:

  • BGP
  • OSPF
  • OSPFv6
  • ISIS
  • RIP
  • RIPNG (RIPv6)

and of course

  • Zebra

So this is a small tutorial, how to set a BGP session between 2 virtual devices running Quagga. For this tutorial, I avoided my preferred distribution, because It is a bit more complicated there. I also used virtual appliances, because I don’t have the spare hardware. Named the 2 routers BCN and TKY (Barcelona and Tokyo).

So, there goes…

  • First, we need a VirtualBox installation (get it from here).
  • Then we need an easy to maintain and install Linux (Like Ubuntu LTS 14.04.3 from here)
  • Create a new virtual box with default values, just increase memory to 1024.
  • Add 2 more network adapters attached to “Internal Network”. Don’t alter the first network adapter for now. Leave as is.
  • Set Adapter 2 name to “BCN2TKY” and Adapter 3 to “CustomersTKY
  • Mount the downloaded image as a DVD ROM.
  • Install Ubuntu into the box.
  • Start Gnome Terminal and execute the following:

  • Edit /etc/network/interfaces with your favorite editor. I prefer Midnight commander (sudo apt-get install mc). Ubuntu has bad behavior with virtual network adapters and tends to disable and remove IP addresses if you are not sending traffic, so we need to force it not to touch them by issuing static IP addresses. For each interface we are going to use, we need a static entry like this:

(you have to be root. e.g. sudo mcedit /etc/network/interfaces)

  • Restart the network manager by issuing:

  • Alter the /etc/quagga/daemons file to enable Zebra and BGP daemon. Just replace “no” with “yes”. Disable all else:

  • In /etc/quagga/ – Touch (create) the files bgpd.conf and zebra.conf.

  • Change ownership of all files in /etc/quagga/* to be quagga:quagga (both user and group).

  • Restart Quagga, and it will run the zebra and bgpd

  • Stop the virtual appliance.

  • Wait a bit and close the window. Confirm you want to power it down.
  • Go to VirtualBox and clone the image we just created.
  • Use hard clone, check “generate new mac address”.
  • Use name “BCN” for the cloned virtual machine.
  • Wait for the clone to complete.
  • Go to the Network adapters and alter the 3-rd one to point to “CustomersBCN”. We need this for tests later.
  • Boot the machine.
  • Alter the entries in /etc/network/interfaces :

  • We are almost set with the setup. Alternatively, you can clone at least 2 (or more) machines with names “BCN-Customers” and “TKY-Customers” and set their second network adapters to “Internal” with names “CustomersBCN” and “CustomersTKY” respectively. We are going to use them later for testing of the BGP peering.
  • Set their adapters in the corresponding group and set the IP address in /etc/network/interfaces. E.g:



You don’t need Quagga installed there, so you can remove the package after cloning or just disable its run-script by issuing

In the end, you need something like this:

BGP diagram skeleton

BGP diagram skeleton

This is the skeleton of our test-bed. We are going to set it up in a minute.

Quagga’s daemons of interest listen to the following ports: 2601 for Zebra and 2605 for BGP. You can access their CLI like this:

(alternatively telnet localhost 2601)

(alternatively telnet localhost 2605)

Here is a basic config with 2 AS:



You can enter this configuration via CLI (command line interface) or just write it in the files zebra.conf and bgpd.conf and restart Quagga to apply them like this:

The detailed diagram looks like this:

BGP Diagram, detailed

BGP Diagram, detailed


Test 1: Simple ping test between TKY-Client and BCN-Client:

Test 2: Simple traceroute between BCN-Client and TKY-Client:

Test 3: Copy a small file via ssh:

Test 4: Copy large file via ssh:

Test 5: Sniff control plane traffic between BCN and TKY:

Have a look at this in WireShark:

BGP keepalives in Wireshark

BGP keepalives in Wireshark

Test 6: Learned from BGP routes are inserted into kernel:

Additional tests:

  • Traffic loss during BGP route update.
  • Latency and loss using Y.1731 and/or RFC2544.
  • Line capacity.

[Unfortunately, for those you need a traffic generator and more sophisticated test equipment]

  • Both routers in one AS. Just a small change in configuration. Then, repeat all tests above.

Pleasant hacking and I hope this article helped you.