Difference between revisions of "Example-olive"

From VNX
Jump to: navigation, search
(Command Execution)
(Olive routers configuration)
Line 199: Line 199:
  
  
 
+
=== Other commands ===
  
 
You can show the map of the scenario with:
 
You can show the map of the scenario with:

Revision as of 15:22, 13 July 2011

Olive example

Authors:
David Fernández (david at dit.upm.es)
version 1.9, July 8th, 2011


Scenario

A simple example scenario designed to show and experiment with the Olive based Juniper router emulation capabilities of VNX. The scenario is made of 6 virtual machines: three Olive routers (r1, r2, r3) interconected in a triangle topology; and three Linux (Ubuntu) hosts (h1, h2, h3), each connected to a LAN serviced by one of the routers (see figure below). The host has an interface on the scenario connected to one of the LANs.

Olive example scenario map
(generated using "vnx -f example_olive.xml -v --show-map")

To start the scenario just type:

cd /usr/share/vnx/examples/
vnx -f example_olive.xml -v --create

After that you will see the consoles of the 6 virtual machines created. To access the Ubuntu hosts just use the standard login/password (root/xxxx). To access the Olive routers use whatever you have configured in your Olive root-file-system (remember that we cannot distribute root-file-systems for Olive; you have to create it yourself and be aware of the legal restrictions).

Olive example capture

Once the scenario has completely started (after login window is available, Olive routers take some time to finish their configuration) you can access the systems and test connectivity. For example, from h1 console you can traceroute to h3:

root@h1:~# traceroute -n 10.0.3.2
traceroute to 10.0.3.2 (10.0.3.2), 30 hops max, 60 byte packets
 1  10.0.1.1  0.664 ms  0.557 ms  0.609 ms
 2  10.0.0.10  1.729 ms  1.664 ms  2.101 ms
 3  10.0.3.2  2.990 ms  2.792 ms  2.784 ms
root@h1:~# 

Or from r1 you can have a look at the router configuration:

root@r1% cli
root@r1> show configuration 
## Last commit: 2011-07-13 13:17:00 UTC by root
version 9.5R1.8;
system {
    host-name r1;
    root-authentication {
        encrypted-password "$1$9zJOSJpW$.IDbxn9XPgZKNKfJTRtMk."; ## SECRET-DATA
    }
    services {
        ssh;
    }
}
interfaces {
    fxp0 {

        unit 0 {
            family inet {
                address 10.0.1.1/24;
            }
            family inet6 {
                address 2001:db8:1::1/64;
            }
        }
    }
    fxp1 {
---(more)---

Command Execution

You can execute commands on the routers from the host using VNX <exec> tags. For example, r1 has the following <exec> tag included in the XML scenario specification:

<exec seq="showint" type="verbatim" mode="sdisk" ostype="show">show interfaces fxp0</exec>

If you execute the following command:

vnx -f example_olive.xml --execute showint

VNX will access r1 router and execute the command defined ("show interfaces fxp0") and show the result:

root# vnx -f example_olive.xml --execute showint
----------------------------------------------------------------------------------
Virtual Networks over LinuX (VNX) -- http://www.dit.upm.es/vnx - vnx@dit.upm.es          
Version: 1.92beta1 (build on 13/07/2011_15:46)
----------------------------------------------------------------------------------
Using configuration file: /etc/vnx.conf
  TMP dir=/tmp
  VNX dir=/root/.vnx
----------------------------------------------------------------------------------
** root@r1> show interfaces fxp0 
** Physical interface: fxp0, Enabled, Physical link is Up
**   Interface index: 1, SNMP ifIndex: 1
**   Type: Ethernet, Link-level type: Ethernet, MTU: 1514, Speed: 10m
**   Device flags   : Present Running
**   Interface flags: SNMP-Traps
**   Link type      : Half-Duplex
**   Current address: 02:fd:00:00:01:01, Hardware address: 02:fd:00:00:01:01
**   Last flapped   : 2011-07-13 13:15:48 UTC (00:35:49 ago)
**     Input packets : 1934 
**     Output packets: 1840
** 
**   Logical interface fxp0.0 (Index 67) (SNMP ifIndex 13) 
**     Flags: SNMP-Traps Encapsulation: ENET2
**     Input packets : 962 
**     Output packets: 920
**     Protocol inet, MTU: 1500
**       Flags: Is-Primary
**       Addresses, Flags: Is-Default Is-Preferred Is-Primary
**         Destination: 10.0.1/24, Local: 10.0.1.1, Broadcast: 10.0.1.255
**     Protocol inet6, MTU: 1500
**       Flags: Is-Primary
**       Addresses, Flags: Is-Default Is-Preferred Is-Primary
**         Destination: 2001:db8:1::/64, Local: 2001:db8:1::1
**       Addresses, Flags: Is-Preferred
**         Destination: fe80::/64, Local: fe80::2fd:ff:fe00:101
** 
** root@r1> 
** OK
Total time elapsed: 0 seconds

You can experiment with other commands defined in the example:

# Show interface fxp0 configuration
<exec seq="showint"       type="verbatim" ostype="show">show interfaces fxp0</exec> 
# Load a new configuration overiding the present one
<exec seq="config1"       type="verbatim" ostype="load">override conf/juniper.conf</exec>
# Change configuration of interface fxp0
<exec seq="configif"      type="verbatim" ostype="set">set interfaces fxp0 unit 0 family inet address 10.0.0.10/24</exec>
# Enable ssh or telnet services
<exec seq="enable-ssh"    type="verbatim" ostype="set">set system services ssh</exec>
<exec seq="enable-telnet" type="verbatim" ostype="set">set system services telnet</exec>

You just have to execute:

vnx -f example_olive.xml --execute sequence

being sequence the seq parameter value of the command chosen.

If you define new commadns, be aware that the ostype parameter controls the way that commands are executed in the router:

  • show: command is executed in normal mode (after a "cli" command)
  • set: command is executed in config mode (after a "cli" and a "config" command; besides, after the command a "commit" is executed)
  • load: command is executed in config mode (after a "cli" and a "config" command; besides, after the command a "commit" is executed)

Olive routers configuration

At startup, the Olive routers load a configuration that is made of two parts:

  • the configuration specified in the <conf> tag of each router:
  • <conf>conf/example_olive/r1.conf</conf>
    
  • the configuration commands derived from the interfaces and routes (<if> and <route> tags) values in the VNX XML specification. For example, in the case of router r1, the interfaces specified:
  •    <if id="1" net="Lan1" name="fxp0">
         <ipv4>10.0.1.1/24</ipv4>
         <ipv6>2001:db8:1::1/64</ipv6>
       </if>
       <if id="2" net="ptp12" name="fxp1">
         <ipv4>10.0.0.1/30</ipv4>
         <ipv6>2001:db8:12::1/64</ipv6>
       </if>
       <if id="3" net="ptp13" name="fxp2">
         <ipv4>10.0.0.9/30</ipv4>
         <ipv6>2001:db8:13::1/64</ipv6>
       </if>
    

    are translated into the following commands added to the router configuration:

    interfaces {
        fxp0 {
            unit 0 {
                family inet {
                    address 10.0.1.1/24;
                }
                family inet6 {
                    address 2001:db8:1::1/64;
                }
            }
        }
        fxp1 {
            unit 0 {    
                family inet {
                    address 10.0.0.1/30;
                }       
                family inet6 {
                    address 2001:db8:12::1/64;
                }       
            }           
        }               
        fxp2 {          
            unit 0 {    
                family inet {
                    address 10.0.0.9/30;
                }       
                family inet6 {
                    address 2001:db8:13::1/64;
                }       
            }           
        }               
    }             
    

    You can see the results of the configuration commands executed over Olive routers in the VNX ACE daemon log file:

    root@r1% less /var/log/vnxolived.log
    



    Other commands

    You can show the map of the scenario with:

    vnx -f example_olive.xml -v --show-map
    

    VNX Description

    <vnx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="/usr/share/xml/vnx/vnx-1.97.xsd">
      <global>
        <version>1.92</version>
        <scenario_name>example_olive</scenario_name>
        <automac offset="0"/>
        <vm_mgmt type="none" />
        <vm_defaults>
                <console id="0" display="no"/>
                <console id="1" display="yes"/>
        </vm_defaults>
        <!--olive_ext>simple_olive-olext.xml</olive_ext-->
      </global>
        
      <net name="Lan1" mode="virtual_bridge" />
      <net name="Lan2" mode="virtual_bridge" />
      <net name="Lan3" mode="virtual_bridge" />
      <net name="ptp12" mode="virtual_bridge" />
      <net name="ptp13" mode="virtual_bridge" />
      <net name="ptp23" mode="virtual_bridge" />
          
      <!-- NODES -->
      <vm name="r1" type="libvirt" subtype="kvm" os="olive">
        <filesystem type="cow">/usr/share/vnx/filesystems/root_fs_olive</filesystem>
        <mem>256M</mem>
        <conf>conf/example_olive/r1.conf</conf>
        <if id="1" net="Lan1" name="fxp0">
          <ipv4>10.0.1.1/24</ipv4>
          <ipv6>2001:db8:1::1/64</ipv6>
        </if>
        <if id="2" net="ptp12" name="fxp1">
          <ipv4>10.0.0.1/30</ipv4>
          <ipv6>2001:db8:12::1/64</ipv6>
        </if>
        <if id="3" net="ptp13" name="fxp2">
          <ipv4>10.0.0.9/30</ipv4>
          <ipv6>2001:db8:13::1/64</ipv6>
        </if>
      </vm>
    
      <vm name="r2" type="libvirt" subtype="kvm" os="olive">
        <filesystem type="cow">/usr/share/vnx/filesystems/root_fs_olive</filesystem>
        <mem>256M</mem>
        <conf>conf/example_olive/r2.conf</conf>
        <if id="1" net="Lan2" name="fxp0">
          <ipv4>10.0.2.1/24</ipv4>
          <ipv6>2001:db8:2::1/64</ipv6>
        </if>
        <if id="2" net="ptp12" name="fxp1">
          <ipv4>10.0.0.2/30</ipv4>
          <ipv6>2001:db8:12::2/64</ipv6>
        </if>
        <if id="3" net="ptp23" name="fxp2">
          <ipv4>10.0.0.5/30</ipv4>
          <ipv6>2001:db8:23::1/64</ipv6>
        </if>
      </vm>
    
      <vm name="r3" type="libvirt" subtype="kvm" os="olive">
        <filesystem type="cow">/usr/share/vnx/filesystems/root_fs_olive</filesystem>
        <mem>256M</mem>
        <conf>conf/example_olive/r3.conf</conf>
        <if id="1" net="Lan3" name="fxp0">
          <ipv4>10.0.3.1/24</ipv4>
          <ipv6>2001:db8:3::1/64</ipv6>
        </if>
        <if id="2" net="ptp13" name="fxp1">
          <ipv4>10.0.0.10/30</ipv4>
          <ipv6>2001:db8:12::2/64</ipv6>
        </if>
        <if id="3" net="ptp23" name="fxp2">
          <ipv4>10.0.0.6/30</ipv4>
          <ipv6>2001:db8:13::2/64</ipv6>
        </if>
      </vm>
    
      <vm name="h1" type="libvirt" subtype="kvm" os="linux">
        <filesystem type="cow">/usr/share/vnx/filesystems/root_fs_ubuntu</filesystem>
        <mem>256M</mem>
        <if id="1" net="Lan1">
          <ipv4>10.0.1.2/24</ipv4>
          <ipv6>2001:db8:1::2/64</ipv6>
        </if>
      </vm>
    
      <vm name="h2" type="libvirt" subtype="kvm" os="linux">
        <filesystem type="cow">/usr/share/vnx/filesystems/root_fs_ubuntu</filesystem>
        <mem>256M</mem>
        <if id="1" net="Lan2">
          <ipv4>10.0.2.2/24</ipv4>
          <ipv6>2001:db8:2::2/64</ipv6>
        </if>
      </vm>
    
      <vm name="h3" type="libvirt" subtype="kvm" os="linux">
        <filesystem type="cow">/usr/share/vnx/filesystems/root_fs_ubuntu</filesystem>
        <mem>256M</mem>
        <if id="1" net="Lan3">
          <ipv4>10.0.3.2/24</ipv4>
          <ipv6>2001:db8:3::2/64</ipv6>
        </if>
      </vm>
    
      <host>
        <hostif net="Lan1">
           <ipv4>10.0.1.3/24</ipv4>
           <ipv6>2001:db8:1::3/64</ipv6>
        </hostif>
      </host>
      
    </vnx>
    

    Download

    The example is included in VNX distribution.

    Known issues

    • Network interface problems. Sometimes olive router network interfaces do not work properly. Everything seems to be correctly configured (ifconfig or show configuration results are correct), but pings to other virtual machines do not work or show very long delays:
    • root@h1:~# ping 10.0.3.2
      PING 10.0.3.2 (10.0.3.2) 56(84) bytes of data.
      64 bytes from 10.0.3.2: icmp_req=1 ttl=62 time=48536 ms
      64 bytes from 10.0.3.2: icmp_req=2 ttl=62 time=47537 ms
      64 bytes from 10.0.3.2: icmp_req=3 ttl=62 time=46537 ms
      64 bytes from 10.0.3.2: icmp_req=4 ttl=62 time=45537 ms
      64 bytes from 10.0.3.2: icmp_req=5 ttl=62 time=44537 ms
      64 bytes from 10.0.3.2: icmp_req=6 ttl=62 time=43537 ms
      64 bytes from 10.0.3.2: icmp_req=7 ttl=62 time=42537 ms
      64 bytes from 10.0.3.2: icmp_req=8 ttl=62 time=41537 ms
      64 bytes from 10.0.3.2: icmp_req=9 ttl=62 time=40537 ms
      64 bytes from 10.0.3.2: icmp_req=10 ttl=62 time=39537 ms
      

      Besides, the following messages are shown in the console or when executing dmesg:

      swap_pager: indefinite wait buffer: bufobj: 0, blkno: 10, size: 4096
      fxp2: device timeout, recovered (A) 
      

      This problem seems to be be caused by timeouts when writting to disk during virtual machine startup. No solution has been found yet to this problem but executing the scenario in a more powerfull machine. Olive routers startup seems to be very CPU intensive.