Dynamips/Dynagen supports the interconnection of dynamips router interfaces with a real, in my case ethernet, network cards. In this case I'm focusing on linux OSs. Within the article "Connecting GNS3 with a VirtualBox host" I'm describing how to do that for GNS3 and Windows 7 environment.
- Installed PC/Server with working linux OS (debian Wheezy in my case)
- Dynamips/dynagen ready environment with correctly working IOS image (which allow us create a network topology), for example c2691-advipservicesk9-mz.124-15.T13.bin.unp
- network card connected to a real network with working connectivity
First, list the real adapters names and connection states within your linux
ip -link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000 link/ether 00:1d:09:f2:7c:47 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000 link/ether 00:1d:09:f2:7c:49 brd ff:ff:ff:ff:ff:ff
as we see, the eth0 interface is up.
Then we interconnect virtual router interface with working card adapter. Dynamips tutorial is saying (I'm not sure if the original site http://www.dynagen.org/tutorial.htm is just temporary off or not, so here is the copy of original tutorial):
Dynamips can bridge virtual router interfaces real host interfaces, allowing your virtual network to communicate with the real world. On Linux systems, this is done with the NIO_linux_eth NIO descriptor. For example:
f0/0 = NIO_linux_eth:eth0
this bridges this router’s F0/0 interface to the eth0 interface on the host. Packets that exit f0/0 are dumped out on to the real network through eth0, and return packets are forwarded back to the virtual router instance accordingly.
So, let create a simple dynamips topo with just one router to demonstrate:
autostart = False [localhost:30000] workingdir = /home/segi/IS/mcast/Work udp = 30000 [] ram = 128 image = /Topologies/IOSes/c2691-advipservicesk9-mz.124-12.bin.unp ghostios = True sparsemem = True slot1 = NM-4T confreg = 0x2102 idlepc = 0x60a29810 [[ROUTER R1]] model = 2691 console = 3000 # Connect f0/0 interface with my eth1 adapter f0/0 = NIO_linux_eth:eth0
Now start the topo as the root (see the note at the bottom of the page)
Cisco Router Simulation Platform (version 0.2.11-amd64/Linux stable) Copyright (c) 2005-2011 Christophe Fillot. Build date: Mar 5 2014 07:22:36 Local UUID: ace2bfea-68f3-4a9c-a841-758409ca92e6 Hypervisor TCP control server started (port 30000). Reading configuration file... Shutdown in progress... Shutdown completed. Network successfully loaded Dynagen management console for Dynamips and Pemuwrapper 0.11.0 Copyright (c) 2005-2007 Greg Anuzelli, contributions Pavel Skovajsa =>
and start the R1 router within dynagen with start R1 command
=> start R1 CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb. NVRAM is empty, setting config register to 0x2142 C2691 instance 'R1' (id 0): VM Status : 0 RAM size : 128 Mb NVRAM size : 112 Kb IOS image : /Topologies/IOSes/c2691-advipservicesk9-mz.124-12.bin.unp Loading ELF file '/Topologies/IOSes/c2691-advipservicesk9-mz.124-12.bin.unp'... ELF entry point: 0x80008000 C2691 'R1': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled. 100-VM 'R1' started => list Name Type State Server Console R1 2691 running localhost:30000 3000
Now we are able to connect to the R1 (telnet localhost 3000 in my case) and configure router fastEthernet interface with static or dynamic IP address
Router>ena Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#int fa 0/0 Router(config-if)#no sh Router(config-if)#ip address dhcp *Mar 1 00:02:08.723: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 18.104.22.168, mask 255.255.255.0, hostname Router Router(config-if)#do sh ip int brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 22.214.171.124 YES DHCP up up FastEthernet0/1 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down
and finally we check connectivity pinging some real IP address within a real network, in my case
ping 126.96.36.199 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 188.8.131.52, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 4/8/16 ms
1) If the dynagen /dynamips return following message
eth_init_socket: socket: Operation not permitted *** Warning: Connecting R1 f0/0 to NIO_linux_eth:eth1 resulted in: 206-unable to create Linux raw ethernet NIO
Check your linux permissions under which you are running Dynagen, because using gen_eth and linux_eth NIO you must run the dynamips process with the "root" account.