Quagga for BGP Testing
So as all of you Cisco heads know, you can only generate 200 routes via network statements on a router. In addition to that, the routes have to exist in the route table, or at least the supernet must exist. If you want to generate a TON of routes for testing, these Cisco limitations will just never do. Enter Quagga.
Quagga is a fork of Zebra. Quagga runs an implementation of BGP, OSPF and RIP. A great thing about Quagga’s BGP is that it has no limits on the number of networks it can advertise via the network statement, and it doesn’t care if the route exists in its local table or not! Sooooo, if you want to test how well your piece of gear will hold up agains 300K routes from two providers with a link flap, then Quagga is for you.
I’m running Quagga in a VM so I can easily copy it to create as many remote peers as I like.
Follow the below link to get my quick start install guide and also my autoit script to generate routes 🙂
I’m using Centos 5.2 and the Quagga 0.99.7 RPM.
Install the quagga RPM with:
1 | rpm --install quagga-0.99.7-2007042901.i386.rpm |
Since this is lab gear, I disabled SELinux and killed IPtables. You have to make sure to either open tcp port 179 or disable the firewall…other wise the BGP will no talkie.
Now, it’s time to edit our config files. We need to edit our /etc/quagga/bgpd.conf file. The easiest way is to copy and paste the bgpd.conf.sample file to bgpd.conf, and then modify from there. Here is my sample bgpd.conf file:
1 2 3 4 5 6 7 8 9 10 11 12 | ! -*- bgp -*- ! ! BGPd sample configuratin file ! hostname bgpd password zebra enable password quagga ! router bgp 1 bgp router-id 192.168.1.1 network 1.0.0.0/24 neighbor 192.168.1.2 remote-as 2 |
I also wrote an autoit script to generate routes. It has an w, x, y and z, one for each octet. Right now I have the last octect left out and I’m just creating 24 bit subnets, since I can get plenty that way. Each iteration of w, yields about 65536 routes, and it produces them in a text file in about two seconds…not too bad 😉
Once you set your autoit script to generate the routes, simply add the generated network statements to the end your bgpd.config file. Remember that everytime you make a change to the config file you need to restart the service:
1 | service bgpd restart |
You can download the executable here( QuaggaRoutes (1195 downloads) ), or grab the code below.
Autoit script to generate network statements:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\gsowell\Desktop\autoit\quagga\quagga.kxf $Form1 = GUICreate("Enter Number of Iterations, 65536 per", 312, 73, 193, 115) $Input1 = GUICtrlCreateInput("4", 8, 8, 73, 21) $Button1 = GUICtrlCreateButton("Generate", 8, 40, 75, 25, 0) $Input2 = GUICtrlCreateInput("", 168, 8, 121, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Label1 = GUICtrlCreateLabel("-Num of records->", 80, 8, 88, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ;button pushed if GUICtrlRead($Input1) <> "" then;and IsNumber(GUICtrlRead($Input1)) Then ;we got a got one _generatefile() EndIf EndSwitch sleep(10) ;MsgBox(0,0,GUICtrlRead($Input1)) if GUICtrlRead($Input1) <> "" Then;and IsNumber(GUICtrlRead($Input1)) Then ; GUICtrlSetData($Input2, GUICtrlRead($Input1) * 65536) EndIf ;check if input box has anything in it. If it does, multiply that by 65536 and ;put in second input box. WEnd Func _generatefile () FileDelete(@ScriptDir & "\networks.txt") $fileNetworks = FileOpen(@ScriptDir & "\networks.txt", 1) ; Check if file opened for writing OK If $fileNetworks = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ToolTip("***************************" & @CRLF & "*****File being generated*****" & @crlf & "***************************", 0, 0) ;each iteration of $w is around 65536 routes for $w = 1 to GUICtrlRead($Input1) for $x = 0 to 255 for $y = 0 to 255 ;for $z = 0 to 255 ;ToolTip($w & "." & $x & "." & $y, 0, 0) FileWriteLine($fileNetworks, " network " & $w & "." & $x & "." & $y & ".0/24"& @CRLF) ;Next Next Next Next FileClose($fileNetworks) MsgBox(0,"complete", "File generated and is at " & @ScriptDir & "\networks.txt") Exit EndFunc |
hmmmm….65536 network statements…
i never tried that one..lol…
does the internet just stop?
This is just to simulate an internet connection…hehehe. The full internet route table is around 300K.
nice…
Greg – Now it is around 334k.
Thanks for the information.
I was just wondering if there is a limit on the neighbor statements in Quagga. Can we configure a few thousand BGP pairs?
To my knowledge you can add neighbors until the CPU falls over…though I’m not really sure.