BGP Networking Laboratory
version 1.0

Author:
José Luis Rubio (jrubio at dit.upm.es)
David Fernández (david at dit.upm.es)

September 26th, 2004



Virtual Network User Mode Linux
Scenario

This scenario provides an example of how VNUML can be used for testing routing daemons, and specifically bgpd, which is the BGP implementation included with Quagga Routing Suite.

The example includes six routers (named R1 to R6) running BGP, each one belonging to a different Autonomous System (AS 65001 to AS 65006). Each AS establishes BGP connections with some other AS's, which can represent either transit or peering relations between them. In Figure 1 the relations between all the AS's are shown.

BGP scenario
Figure 1: Relations between AS's

The complete XML description of the scenario, as well as the bgpd (Quagga's BGP daemon) configuration files can be downloaded from here.

Each AS is supposed to have a Class B prefix assigned, which is 161.0.0.0/16 for AS 65001, 162.0.0.0/16 for AS 65002 and so on. The BGP sessions are established over point-to-point links between the routers, which are assigned a /30 sub-prefix of one of the AS's Class B. For example for the connection between AS 65001 and AS 65004 (i.e. between routers R1 and R4) the prefix 161.0.0.8/30 is used in the point-to-point link. In Figure 2 you can see the actual addresses used for each interface.

BGP detailed scenario
Figure 2: Detail on Point-to-Point links addresses

In this simple scenario, only AS 65004, AS 65005 and AS 65006 announce their assigned prefixes to their transit providers, while AS 65001 is supposed to be a large ISP who announces a default route to all its transit clients. The main points about BGP filters configuration in all the routers are summarized in the following table:

 

R1

R2

R3

R4

R5

R6

R1

 

ANY
AS2-PREFIXES

ANY
AS3-PREFIXES

ANY
AS4-PREFIXES

   

R2

MY-PREFIXES
ANY

 

MY-PREFIXES
AS3-PREFIXES

ANY
AS4-PREFIXES

ANY
AS5-PREFIXES

 

R3

MY-PREFIXES
ANY

MY-PREFIXES
AS2-PREFIXES

     

ANY
AS6-PREFIXES

R4

MY-PREFIXES
ANY

MY-PREFIXES
ANY

       

R5

 

MY-PREFIXES
ANY

       

R6

   

MY-PREFIXES
ANY

     

Each row summarizes the filters that the corresponding router sets for OUTGOING and INCOMING prefixes in the peerings with other routers. These filters clearly reflect the kind of relation between the corresponding AS's. For example, in case of a transit relation, the client only announces its own prefixes and accepts everything. This can be seen on (R2,R1) cell on the table: as R2 is a client of R1, R2 annouces its prefixes to R1 ("MY-PREFIXES" in red), and accepts anything from R1 ("ANY" in blue").

Once the scenario is started (vnuml -t bgp.xml -vB) and the simulation is running (vnuml -s bgp.xml -v) the bgpd daemons can be accessed via telnet, with the password "bgp". A typical sequence of commands could be:

Host> vnuml -t bgp.xml -vB
...
Host> vnuml -s bgp.xml -v
...
Host> telnet R1 2605
Trying 192.168.3.2...
Connected to R1.
Escape character is '^]'.

Hello, this is quagga (version 0.96.4).
Copyright 1996-2002 Kunihiro Ishiguro.


User Access Verification

Password: bgp

R1> show ip bgp
BGP table version is 0, local router ID is 192.168.3.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0          0.0.0.0                  0         32768 i
*  164.0.0.0        161.0.0.2                              0 65002 65004 i
*>                  161.0.0.10               0             0 65004 i
*> 165.0.0.0        161.0.0.2                              0 65002 65005 i
*> 166.0.0.0        161.0.0.6                              0 65003 65006 i

Total number of prefixes 4

R1> show ip bgp summary
BGP router identifier 192.168.3.2, local AS number 65001
5 BGP AS-PATH entries
0 BGP community entries

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
161.0.0.2       4 65002      15      18        0    0    0 00:12:11        2
161.0.0.6       4 65003      15      18        0    0    0 00:12:07        1
161.0.0.10      4 65004      15      18        0    0    0 00:12:07        1



VNUML Description

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/local/share/xml/vnuml/vnuml.dtd">

<vnuml>
   <global>
      <version>1.3</version>
      <simulation_name>bgp_example</simulation_name>
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
      <automac offset="0"/>
      <ip_offset>192</ip_offset>
      <host_mapping/>
      <shell>/bin/sh</shell>
   </global>

   <!-- Networks -->
   <net name="AS1-AS2"/>
   <net name="AS1-AS3"/>
   <net name="AS1-AS4"/>
   <net name="AS2-AS3"/>
   <net name="AS2-AS4"/>
   <net name="AS2-AS5"/>
   <net name="AS3-AS6"/>

   <!-- Nodes -->
   <vm name="R1">
      <filesystem type="cow">/usr/local/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <kernel>/usr/local/share/vnuml/kernels/linux</kernel>
      <boot>
        <con0>pts</con0>
      </boot>
      <if id="1" net="AS1-AS2">
         <ipv4 mask="255.255.255.252">161.0.0.1</ipv4>
      </if>
      <if id="2" net="AS1-AS3">
         <ipv4 mask="255.255.255.252">161.0.0.5</ipv4>
      </if>
      <if id="3" net="AS1-AS4">
         <ipv4 mask="255.255.255.252">161.0.0.9</ipv4>
      </if>
      <filetree when="start" root="/usr/local/etc">/usr/local/share/vnuml/examples/bgp/conf/R1</filetree>
      <start type="verbatim">hostname</start>
      <start type="verbatim">rm -f /tmp/bgpd.debug</start>
      <start type="verbatim">/usr/local/sbin/zebra -f /usr/local/etc/zebra.conf.sample -d -P 2604</start>
      <start type="verbatim">/usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf -d -P 2605</start>
      <stop type="verbatim">hostname</stop>
      <stop type="verbatim">killall zebra</stop>
      <stop type="verbatim">killall bgpd</stop>
   </vm>

   <vm name="R2">
      <filesystem type="cow">/usr/local/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <kernel>/usr/local/share/vnuml/kernels/linux</kernel>
      <boot>
        <con0>pts</con0>
      </boot>
      <if id="1" net="AS1-AS2">
         <ipv4 mask="255.255.255.252">161.0.0.2</ipv4>
      </if>
      <if id="2" net="AS2-AS3">
         <ipv4 mask="255.255.255.252">162.0.0.1</ipv4>
      </if>
      <if id="3" net="AS2-AS4">
         <ipv4 mask="255.255.255.252">162.0.0.5</ipv4>
      </if>
      <if id="4" net="AS2-AS5">
         <ipv4 mask="255.255.255.252">162.0.0.9</ipv4>
      </if>
      <filetree when="start" root="/usr/local/etc">/usr/local/share/vnuml/examples/bgp/conf/R2</filetree>
      <start type="verbatim">hostname</start>
      <start type="verbatim">rm -f /tmp/bgpd.debug</start>
      <start type="verbatim">/usr/local/sbin/zebra -f /usr/local/etc/zebra.conf.sample -d -P 2604</start>
      <start type="verbatim">/usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf -d -P 2605</start>
      <stop type="verbatim">hostname</stop>
      <stop type="verbatim">killall zebra</stop>
      <stop type="verbatim">killall bgpd</stop>
   </vm>

   <vm name="R3">
      <filesystem type="cow">/usr/local/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <kernel>/usr/local/share/vnuml/kernels/linux</kernel>
      <boot>
        <con0>pts</con0>
      </boot>
      <if id="1" net="AS1-AS3">
         <ipv4 mask="255.255.255.252">161.0.0.6</ipv4>
      </if>
      <if id="2" net="AS2-AS3">
         <ipv4 mask="255.255.255.252">162.0.0.2</ipv4>
      </if>
      <if id="3" net="AS3-AS6">
         <ipv4 mask="255.255.255.252">163.0.0.1</ipv4>
      </if>
      <filetree when="start" root="/usr/local/etc">/usr/local/share/vnuml/examples/bgp/conf/R3</filetree>
      <start type="verbatim">hostname</start>
      <start type="verbatim">rm -f /tmp/bgpd.debug</start>
      <start type="verbatim">/usr/local/sbin/zebra -f /usr/local/etc/zebra.conf.sample -d -P 2604</start>
      <start type="verbatim">/usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf -d -P 2605</start>
      <stop type="verbatim">hostname</stop>
      <stop type="verbatim">killall zebra</stop>
      <stop type="verbatim">killall bgpd</stop>
   </vm>

   <vm name="R4">
      <filesystem type="cow">/usr/local/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <kernel>/usr/local/share/vnuml/kernels/linux</kernel>
      <boot>
        <con0>pts</con0>
      </boot>
      <if id="1" net="AS1-AS4">
         <ipv4 mask="255.255.255.252">161.0.0.10</ipv4>
      </if>
      <if id="2" net="AS2-AS4">
         <ipv4 mask="255.255.255.252">162.0.0.6</ipv4>
      </if>
      <filetree when="start" root="/usr/local/etc">/usr/local/share/vnuml/examples/bgp/conf/R4</filetree>
      <start type="verbatim">hostname</start>
      <start type="verbatim">rm -f /tmp/bgpd.debug</start>
      <start type="verbatim">/usr/local/sbin/zebra -f /usr/local/etc/zebra.conf.sample -d -P 2604</start>
      <start type="verbatim">/usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf -d -P 2605</start>
      <stop type="verbatim">hostname</stop>
      <stop type="verbatim">killall zebra</stop>
      <stop type="verbatim">killall bgpd</stop>
   </vm>

   <vm name="R5">
      <filesystem type="cow">/usr/local/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <kernel>/usr/local/share/vnuml/kernels/linux</kernel>
      <boot>
        <con0>pts</con0>
      </boot>
      <if id="1" net="AS2-AS5">
         <ipv4 mask="255.255.255.252">162.0.0.10</ipv4>
      </if>
      <filetree when="start" root="/usr/local/etc">/usr/local/share/vnuml/examples/bgp/conf/R5</filetree>
      <start type="verbatim">hostname</start>
      <start type="verbatim">rm -f /tmp/bgpd.debug</start>
      <start type="verbatim">/usr/local/sbin/zebra -f /usr/local/etc/zebra.conf.sample -d -P 2604</start>
      <start type="verbatim">/usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf -d -P 2605</start>
      <stop type="verbatim">hostname</stop>
      <stop type="verbatim">killall zebra</stop>
      <stop type="verbatim">killall bgpd</stop>
   </vm>

   <vm name="R6">
      <filesystem type="cow">/usr/local/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <kernel>/usr/local/share/vnuml/kernels/linux</kernel>
      <boot>
        <con0>pts</con0>
      </boot>
      <if id="1" net="AS3-AS6">
         <ipv4 mask="255.255.255.252">163.0.0.2</ipv4>
      </if>
      <filetree when="start" root="/usr/local/etc">/usr/local/share/vnuml/examples/bgp/conf/R6</filetree>
      <start type="verbatim">hostname</start>
      <start type="verbatim">rm -f /tmp/bgpd.debug</start>
      <start type="verbatim">/usr/local/sbin/zebra -f /usr/local/etc/zebra.conf.sample -d -P 2604</start>
      <start type="verbatim">/usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf -d -P 2605</start>
      <stop type="verbatim">hostname</stop>
      <stop type="verbatim">killall zebra</stop>
      <stop type="verbatim">killall bgpd</stop>
   </vm>

</vnuml>


Last update:

Valid HTML 4.01!