Example-BGP-n3vlr

From VNUML-WIKI
Jump to: navigation, search

BGP Networking Laboratory

Authors:
José Luis Rubio (jrubio at dit.upm.es)
David Fernández (david at dit.upm.es)
version n3vlr, November 8th, 2007


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

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 -x start@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/share/xml/vnuml/vnuml.dtd" [
  <!ENTITY VNUMLDIR "/usr/share/vnuml/">
  <!ENTITY BASEDIR  "/usr/share/vnuml/examples/bgp/">
  <!ENTITY REDIR  "</dev/null >/dev/null 2>&1 &">
]>
<vnuml>
   <global>
      <version>1.8</version>
      <simulation_name>bgp_example</simulation_name>
      <!--ssh_version>1</ssh_version-->
      <ssh_key>~/.ssh/identity.pub</ssh_key>
      <automac offset="0"/>
	    <vm_mgmt type="private">
		    <host_mapping/>
	    </vm_mgmt>
      <vm_defaults>
        <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
        <kernel>/usr/share/vnuml/kernels/linux</kernel>
        <shell>/bin/bash</shell>
        <basedir>/usr/share/vnuml/examples/</basedir>
        <console id="1">xterm</console>
      </vm_defaults>
   </global>

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

   <!-- Nodes -->
   <vm name="R1">
      <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 seq="start" root="/etc/quagga">conf/R1</filetree>
      <exec seq="start" type="verbatim">hostname</exec>
      <exec seq="start" type="verbatim">rm -f /tmp/bgpd.debug</exec>
      <exec seq="start" type="verbatim">/usr/sbin/zebra -d</exec>
      <exec seq="start" type="verbatim">/usr/sbin/bgpd -d</exec>
      <exec seq="stop" type="verbatim">hostname</exec>
      <exec seq="stop" type="verbatim">killall zebra</exec>
      <exec seq="stop" type="verbatim">killall bgpd</exec>
   </vm>

   <vm name="R2">
      <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 seq="start" root="/etc/quagga">conf/R2</filetree>
      <exec seq="start" type="verbatim">hostname</exec>
      <exec seq="start" type="verbatim">rm -f /tmp/bgpd.debug</exec>
      <exec seq="start" type="verbatim">/usr/sbin/zebra -d</exec>
      <exec seq="start" type="verbatim">/usr/sbin/bgpd -d</exec>
      <exec seq="stop" type="verbatim">hostname</exec>
      <exec seq="stop" type="verbatim">killall zebra</exec>
      <exec seq="stop" type="verbatim">killall bgpd</exec>
   </vm>

   <vm name="R3">
      <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 seq="start" root="/etc/quagga">conf/R3</filetree>
      <exec seq="start" type="verbatim">hostname</exec>
      <exec seq="start" type="verbatim">rm -f /tmp/bgpd.debug</exec>
      <exec seq="start" type="verbatim">/usr/sbin/zebra -d</exec>
      <exec seq="start" type="verbatim">/usr/sbin/bgpd -d</exec>
      <exec seq="stop" type="verbatim">hostname</exec>
      <exec seq="stop" type="verbatim">killall zebra</exec>
      <exec seq="stop" type="verbatim">killall bgpd</exec>
   </vm>

   <vm name="R4">
      <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 seq="start" root="/etc/quagga">conf/R4</filetree>
      <exec seq="start" type="verbatim">hostname</exec>
      <exec seq="start" type="verbatim">rm -f /tmp/bgpd.debug</exec>
      <exec seq="start" type="verbatim">/usr/sbin/zebra -d</exec>
      <exec seq="start" type="verbatim">/usr/sbin/bgpd -d</exec>
      <exec seq="stop" type="verbatim">hostname</exec>
      <exec seq="stop" type="verbatim">killall zebra</exec>
      <exec seq="stop" type="verbatim">killall bgpd</exec>
   </vm>


   <vm name="R5">
      <if id="1" net="AS2-AS5">
         <ipv4 mask="255.255.255.252">162.0.0.10</ipv4>
      </if>
      <filetree seq="start" root="/etc/quagga">conf/R5</filetree>
      <exec seq="start" type="verbatim">hostname</exec>
      <exec seq="start" type="verbatim">rm -f /tmp/bgpd.debug</exec>
      <exec seq="start" type="verbatim">/usr/sbin/zebra -d</exec>
      <exec seq="start" type="verbatim">/usr/sbin/bgpd -d</exec>
      <exec seq="stop" type="verbatim">hostname</exec>
      <exec seq="stop" type="verbatim">killall zebra</exec>
      <exec seq="stop" type="verbatim">killall bgpd</exec>
   </vm>

   <vm name="R6">
      <if id="1" net="AS3-AS6">
         <ipv4 mask="255.255.255.252">163.0.0.2</ipv4>
      </if>
      <filetree seq="start" root="/etc/quagga">conf/R6</filetree>
      <exec seq="start" type="verbatim">hostname</exec>
      <exec seq="start" type="verbatim">rm -f /tmp/bgpd.debug</exec>
      <exec seq="start" type="verbatim">/usr/sbin/zebra -d</exec>
      <exec seq="start" type="verbatim">/usr/sbin/bgpd -d</exec>
      <exec seq="stop" type="verbatim">hostname</exec>
      <exec seq="stop" type="verbatim">killall zebra</exec>
      <exec seq="stop" type="verbatim">killall bgpd</exec>
   </vm>

</vnuml>



Download