Example-Dynamips/Dynagen-1.7
VNUML and Dynamips/Dynagen mixed scenario
Contents
Scenario
This example will emulate the network scenario shown in the figure, where the hosts are emulated using VNUML virtual machines and the routers are CISCOs emulated using dynamips.
To create the scenario, you first have to download the vnuml and dynagen scenarios specifications (provided below) to a directory. Remember to modify "idlepc" values in the dynagen specification to adapt it to your optimum values.
Later, you can start the scenario by following this steps:
- Start VNUML scenario (hosts) with:
vnumlparser.pl -t dynavnuml.xml -v -u root
- If not already running, start dynamips daemon:
dynamips -H 7200&
- Start Dynagen scenario (routers) with:
dynagen dynavnuml.net
- Once started, open router consoles with:
=> console /all
- Enable router tap interfaces (they are automatically created by dynagen but not enabled):
ifconfig r1-e00 up ifconfig r1-e01 up ifconfig r1-e02 up ifconfig r2-e00 up ifconfig r2-e01 up
- Connect router interfaces with virtual bridges:
brctl addif Net0 r1-e00 brctl addif Net1 r1-e01 brctl addif Net2 r1-e02 brctl addif Net2 r2-e00 brctl addif Net3 r2-e01
- Configure the routers, loading the configurations shown below. To do that, you have to:
enable conf t ...paste router config commands exit exit write
After the write is executed, the configuration is saved, so next time the route starts it will load that configuration.
The scenario is ready for testing. For example, you can login to H1 and test the connectivity with H4:
H1:~# ping 10.1.3.10 PING 10.1.3.10 (10.1.3.10) 56(84) bytes of data. 64 bytes from 10.1.3.10: icmp_seq=1 ttl=62 time=35.1 ms 64 bytes from 10.1.3.10: icmp_seq=2 ttl=62 time=46.2 ms 64 bytes from 10.1.3.10: icmp_seq=3 ttl=62 time=70.0 ms --- 10.1.3.10 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2034ms rtt min/avg/max/mdev = 35.128/50.461/70.020/14.556 ms
Additional tips
- You can save router configurations to a file by means of the command:
export /all /root/vnuml/tests/vnuml-dynamips/config
- Besides, you can save configurations as base64 encoded blobs in your network file This allows the distribution of router configurations together with network topology in the .net file. To do it, just execute the command:
save /all /root/vnuml/tests/vnuml-dynamips/config
VNUML Description
File dynavnuml.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd"> <vnuml> <global> <version>1.7</version> <simulation_name>dynavnuml</simulation_name> <automac/> <vm_mgmt type="none" /> <vm_defaults> <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem> <kernel>/usr/share/vnuml/kernels/linux</kernel> <console id="0">xterm</console> <!--xterm>gnome-terminal,-t,-x</xterm--> </vm_defaults> </global> <net name="Net0" mode="virtual_bridge" /> <net name="Net1" mode="virtual_bridge" /> <net name="Net2" mode="virtual_bridge" /> <net name="Net3" mode="virtual_bridge" /> <vm name="H1"> <xterm>xterm,-T H1,-e</xterm> <if id="1" net="Net1"> <ipv4 mask="255.255.255.0">10.1.1.10</ipv4> </if> <route type="ipv4" gw="10.1.1.1">default</route> </vm> <vm name="H2"> <xterm>xterm,-T H2,-e</xterm> <if id="1" net="Net1"> <ipv4 mask="255.255.255.0">10.1.1.11</ipv4> </if> <route type="ipv4" gw="10.1.1.1">default</route> </vm> <vm name="H3"> <xterm>xterm,-T H3,-e</xterm> <if id="1" net="Net2"> <ipv4 mask="255.255.255.0">10.1.2.10</ipv4> </if> <route type="ipv4" gw="10.1.2.1">default</route> </vm> <vm name="H4"> <xterm>xterm,-T H4,-e</xterm> <if id="1" net="Net3"> <ipv4 mask="255.255.255.0">10.1.3.10</ipv4> </if> <route type="ipv4" gw="10.1.3.1">default</route> </vm> <host> <hostif net="Net0"> <ipv4 mask="255.255.255.0">10.1.0.10</ipv4> </hostif> <route type="ipv4" gw="10.1.0.1">10.0.0.0/16</route> </host> </vnuml>
Dynagen Description
File dynavnuml.net:
# VNUML-Dynagen example [localhost] [[3640]] image = /usr/share/vnuml/filesystems/c3640 ram = 96 [[ROUTER R1]] e0/0 = NIO_tap:r1-e00 e0/1 = NIO_tap:r1-e01 e0/2 = NIO_tap:r1-e02 model = 3640 slot1 = NM-4E idlepc = 0x605d2350 [[ROUTER R2]] e0/0 = NIO_tap:r2-e00 e0/1 = NIO_tap:r2-e01 model = 3640 slot1 = NM-4E idlepc = 0x605d2350
Router configurations
R1:
hostname R1 no ip domain lookup interface e0/0 ip address 10.1.0.1 255.255.255.0 no shutdown interface e0/1 ip address 10.1.1.1 255.255.255.0 no shutdown interface e0/2 ip address 10.1.2.1 255.255.255.0 no shutdown ip route 10.1.3.0 255.255.255.0 10.1.2.2 line vty 0 password xxxx login
R2:
hostname R2 no ip domain lookup interface e0/0 ip address 10.1.2.2 255.255.255.0 no shutdown interface e0/1 ip address 10.1.3.1 255.255.255.0 no shutdown ip route 10.1.0.0 255.255.255.0 10.1.2.1 ip route 10.1.1.0 255.255.255.0 10.1.2.1 line vty 0 password xxxx login