Part 1 of Dynamips External Cloud Interface on Linux
Binding GNS3/dynamips Routers Ethernet port to the Hosts physical interface.
While browsing the http://7200emu.hacki.at forums, I noticed a few posts were asking for help on how to bridge a Routers ethernet port in Dynamips to the Linux hosts ethernet card. The only responses that seemed to show up stated that it was difficult as the tap interface needs to be created wen you start the lab. Well this article is here to address the issue and make things easier.
All the commands mentioned on this page should be executed with root privleges. To do this either use the su command to switch user, Or if you use ubuntu type sudo before each of the commands I have listed. Configuring your system in this manner allows you to run gns3/dynamips as a standard user and still have network access!
Firstly the terminology
Eth0,Wlan0 - If your machine has a wired ethernet card, It should show up as eth0 or eth1. If its an 802.11 card its possible to see something like wlan0.
Tap0,Tap1 - The Tap interface is a virtual interface created in linux, This interface is the one that the routers port is bound to.
Br0 - This is a Bridge for linux networking, This device is the one that ties eth0 and tap0 together so traffic can be passed.
Part 1 - Information Gathering
We are going to start with gathering some information about your network settings. If you use Dhcp you can skip straight to Part 2
bash:#ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether 00:1e:0b:33:6e:4c brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:15:77:9b:ec:07 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.11/24 brd 192.168.1.255 scope global eth0
inet6 fe80::215:77ff:fe9b:ec07/64 scope link
valid_lft forever preferred_lft forever
Notice card number 3: eth0. Has the ip address 192.168.1.11 with a /24 mask. To find the default gateway enter this command
bash:#ip r
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.11
169.254.0.0/16 dev eth0 scope link
127.0.0.0/8 dev lo scope link
default via 192.168.1.1 dev eth0
My default gateway is shown by the line default via 192.168.1.1 dev eth0. So the gateway ip address is 192.168.1.1. Does everyone remember the 169.254.0.0/16 network? The APIPA range?. Well most modern linux distro’s include a route to that network just in case.
Part 2 - Setting up the Network
Welcome back to the Dhcp users. To kick this off we need to create a bridge interface on your machine. The command is brctl and is usually part of a package called “Bridge-utils”
To create the bridge we can do the following
brctl addbr br0
Execute ip a to verify that it was created and you should see a new entry like this
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:15:77:9b:ec:07 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.11/24 brd 192.168.1.255 scope global eth0
inet6 fe80::215:77ff:fe9b:ec07/64 scope link
valid_lft forever preferred_lft forever
4: br0: <BROADCAST,MULTICAST,> mtu 1500 qdisc noqueue
link/ether 00:15:77:9b:ec:07 brd ff:ff:ff:ff:ff:ff
Notice how on the bridge line there is no “UP,LOWER_UP” statement after multicast?, This indicates that the bridge interface is shutdown.
To activate the bridge we need to perform the following
ip l s dev br0 up
Now execute ip a again to verify interface br0 now shows as up.
Now to create the tap interface we need the following command “tunctl”. Normally in a package called “uml-utilities”
To create the tap interface execute the following where username! is your linux login
tunctl -t tap0 -u username!
Again to verify the creation of the interface execute ip a
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:15:77:9b:ec:07 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.11/24 brd 192.168.1.255 scope global eth0
inet6 fe80::215:77ff:fe9b:ec07/64 scope link
valid_lft forever preferred_lft forever
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
link/ether 00:15:77:9b:ec:07 brd ff:ff:ff:ff:ff:ff
5: tap0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast qlen 500
link/ether 00:ff:da:10:31:61 brd ff:ff:ff:ff:ff:ff
Again, the Tap0 interface is shutdown by default. to Activate it execute
ip l s dev tap0 up
So now we have all the interfaces we need created. Time to start adding interfaces to the bridge.
To associate both the Eth0 and tap0 interface with the bridge, enter the following to commands. This *links the interfaces together
brctl addif br0 tap0
brctl addif br0 eth0
To verify that this worked, try
brctl show br0
You output should be similar to this
bridge name bridge id STP enabled interfaces
br0 8000.00123f43a4b3 no tap0
eth0
Now we need to change the eth0 card to promiscuous mode and remove the ip address from it
ifconfig eth0 0.0.0.0 promisc
So you can still access your network, We need to configure the br0 interface with your network settings, If you use a static ip address execute the following commands
ip a a 192.168.1.11/24 dev br0
ip r a default via 192.168.1.1
If you use dhcp, We can start the dhcp client on br0 with the following
dhclient br0
Thats it for the network!. Try to ping your default gateway or another device on your network. Easy hey!
Next part is dynamips! And its easy to.
Inside the .net file of your chosen topology.
autostart = True
[localhost:7210]
workingdir = /data/GNS3/ts_working
[[3640]]
image = /data/GNS3/cisco/ios/C3640-IK.BIN
chassis = 3640
[[ROUTER R0]]
model = 3640
console = 2000
cnfg = /data/GNS3/ts_configs/R0.cfg
slot0 = NM-1FE-TX
f0/0 = nio_tap:tap0
slot1 = NM-1FE-TX>
[[Cloud C0]]
connections = R0:f0/0:nio_tap:tap0
Note the device called Cloud C0, It’s connection line is the key to making this work. It states that router R0 has the interface Fastethernet0/0 which links to nio_tap:tap0. Where tap0 is the tap interface we created earlier
Router R0 has the matching line which completes the configuration.
If you’re a GNS3 user, Then its just as simple, Add the Cloud object to your network and create an ethernet link from the Cloud to your chosen router. Then right click the cloud and select configure.
Select the “NIO TAP” tab and enter your tap name.
Select Add, Save your config and start your routers.
Thats it for now. Feel free to ask any questions you have.
My next post will be how to apply that configuration on boot
here it is













I searched for \’Mtu Hoster\’ in google and found this your post (\’Part 1 of Dynamips External Cloud Interface on Linux\’) in search results. Not very relevant result, but still interesting to read.
Hello,
You have a very concise and well thought out howto which should be commended. Do you mind if I expand a bit on this (with due props) on my site?
Thanks!
Zach
Hi Zach.
Its ok to use the content, I had a quick look at your site and I assume you guide will focus on ubuntu?
[...] so you want to make the network changes made in Part 1 permanent? Well its easier than Part 1. Most Linux distributions use an initalization system called [...]
Hi josh i was wondering , is it posible to configure eth0 on my comp so that it can be conected directcly to the isp trunk since encapsulation is needed or do a data relay from etho to gns3 cloud from ns3 cloud to ns3 router .
the point in this is to test that the conecction from the main node to my office is working , and its not the routers fault. ???
Hi Ktulhu.
I’m not sure that I completely understand what your trying to achieve.
With the ISP links coming into your office. i’m assuming you want to put the machine with gns3 just after the modem/ntu ?
Diagram would help if have one.
hi , i have a problem with gns3 clouds. i use xp-64 bit. and i cannot add, nio eth, also it doesn’t detect my device list ehternet.
will you help me?
cheers..
@Bugs_expert Sorry I dont use windows. So not sure on what the issue is. Have you looked at the 7200emu.hacki.at forums? I’m sure someone there would know the solution
Hi Josh
I have to three problems:
1.when I pull up gns3 from sudo, I can to link NO tap to my topology but I can not start the routers because I iniciated gns3 from sudo…do you know anythings about this?
2. why I can not start the routers if I iniciate gns3 form sudo??
3. how I can save the change that I do in linux to create the interface bridge? When a restart the computer, the bridge interface is cleared.
Thanks and congratulations for this tutorial
@ktmr23
I’ll answer question 3 first. Check out part 2 of the tutorial to make the changes persistent.
In regards to questions 1 and 2, I’m not 100% sure why but I have an idea. Can you trying running
“sudo bash”
Then from newly spawned shell run GNS3 and see it that makes a difference.
Josh,
thank you very much. I will prove to running “sudo bash” and I will write you about the result.
Best regards.
Hello again
I proved with sudo bash and sugo gns3 and I have the same problem, the routers do not start.
I proved to start the router from console windows and I had the next promt:
=>Start R0
***Error:209-unable to start
@ktmr23
Hi.
Error 209 is usually associated with an ios issue. Double check that the ios file locations are where the.net file states.
it is possible, thank josh.
I will review the configuration in ubuntu. Linux is very dificult for me
Best regards Josh
josh your answer was the solution.
I review the config of gns3, I changed the configuration for the file was in the root directory and all aplication is running now.
Thanks for all, best regards from riopar-spain
Hello again, Josh, please I need to connected my gns3 topology to a cloud to connect my local PC (where I am running Gns3).
I have connected other external PC by your begin explication and all ok; for that I created a NIO TAP by bridge interface in linux, but now, to connect my local PC to the cloud I suppose that now I need to create a linux Nio Ethernet. Do you now anythings?
Best regards.
u r a legend mate - cheers
Nice guide. I am now able to ping the computer and router where gns3 is installed.
The problem I am having is that I can not ping outside of the network such as for example yahoo.com
It is able to find the IP address of Yahoo but the pings do not seem to come back. Not sure if iptables is blocking them or perhaps they are not finding their way back in.
R1#ping yahoo.com
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 206.190.60.37, timeout is 2 seconds:
…..
Success rate is 0 percent (0/5)
[...] work like a charm. I can’t take full credit here. I learned how to use the tap interface from joshatterbury.com and simplified his method in this article. Good [...]
Great howto…spend a few hours understending it, but then it works. It’s almost a week since i was looking for a way to bridge those interfaces in ubuntu…tx a lot.
Josh,
This is very self explanatory. Thanks a lot for this tutorial. I just moved from Win to Linux and this came very handy to keep working with my voice labs.
Now, I do have access to the internal from my GNS3 labs xD. Thanks in advance fella.
PS:I have been looking for a nice tutorial how to setup CCM on VMware using Ubuntu instead Windows(which is the way I used to do it). I found some posts related to it but is not what I’m looking for. Do you have any idea Chief?
Thanks,
Sephiroth
Well done.
[...] the host computer. I just didn’t know how to do it. So I Google’d it and found this joshatterbury.com page with some great explanation. Check out his site for more details. He has some verification [...]
Dear Josh,
Thanks a lot for this tutorial, I was looking for something like it for almost two weeks.
However, I have a question, is it possible to connect GNS3 to the Internet? The scenario I have contains a router connected to a cloud and this cloud has a tap0 interface that is connected to my real PC. The problem here is if I set the default gateway of the tap0 interface to point to my router I will lose the connection between my PC and the Internet. Is there a solution for this? As an example, can I give the tap0 interface an IP and default gateway which is different then the eth0 IP and default gateway?
Thanks in advance for your help.
Cesar
Hi Josh,
I followed your tutorial twice but I end up getting the same result. I’m running Ubuntu 9.10 64-bit as Host OS and a vmware vm. When I’m done with all the configuration in this tutorial:
- from my host OS I’m able to ping every device (including the router in my GNS3 lab)
- from my vmware vm I’m able to ping my host OS (br0 ip address) and every other device except the router in my GNS3 lab.
- from my GNS3 lab’s router I’m able to ping only the br0 ip address.
I need help.
Thanks in advance for toy help,
Mike.
Hi.
I followed this steps:
1. Configure the bridge
#!/bin/bash
Tap=”tap0″
Interfaz=”eth3″
Ip_puente=”192.168.1.30″
Puerta_puente=”192.168.1.1″
Puente=”br0″
Mascara=24
#####################################################################
# Create a new bridge interface
brctl addbr $Puente
ip l s dev $Puente up
# Create a tap interface
tunctl -t $Tap
ip l s dev $Tap up
# Add $Tap and $Interfaz to the bridge group
brctl addif $Puente $Tap
brctl addif $Puente $Interfaz
ifconfig $Interfaz 0.0.0.0 promisc
ip a a $Ip_puente/$Mascara dev $Puente
ip r a default via $Puerta_puente
2. Configure router and cloud in GNS3:
autostart = False
[localhost:7200]
workingdir = /tmp
udp = 10000
[[7200]]
image = /home/datos/master/RT/pract/ios/c7200-advipservicesk9-mz.124-4.T1.bin
ghostios = True
[[ROUTER R0]]
console = 2000
slot1 = PA-2FE-TX
[[ROUTER R1]]
console = 2002
slot1 = PA-2FE-TX
f1/0 = nio_linux_eth:tap0
x = -106.0
y = -123.0
[GNS3-DATA]
[[Cloud C1]]
x = -156.5
y = 38.0
connections = R1:f1/0:nio_linux_eth:tap0
3. Try ping from router:
Router#ping 192.168.1.30
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.30, timeout is 2 seconds:
…..
Success rate is 0 percent (0/5)
4. Try ping from my pc:
d610:/tmp# ping 192.168.1.200
PING 192.168.1.200 (192.168.1.200) 56(84) bytes of data.
From 192.168.1.30 icmp_seq=2 Destination Host Unreachable
From 192.168.1.30 icmp_seq=3 Destination Host Unreachable
From 192.168.1.30 icmp_seq=4 Destination Host Unreachable
From 192.168.1.30 icmp_seq=5 Destination Host Unreachable
When I capture packages with wireshark I notice that my virtual router (MAC address ca:02:17:76:00:1c) sent packagest to my virtual bridge (MAC address
00:16:6f:a9:ad:3c), but gets no reply:
SOURCE DESTINATION Protocol Info
ca:02:17:76:00:1c Intel_a9:ad:3c 0×0800 IP
Some help?
Thanks
Dinamips doesn’t understand device type “Cloud”. But why?
…
sudo dynagen labs/eigrp/sample.net
Reading configuration file…
Shutdown in progress…
Shutdown completed.
*** Warning: unknown device type: Cloud
*** Warning: ignoring unknown config item: connections = Corp:f0/0:NIO_tap:lin_cis_tap
…
[...] with Josh Atterbury’s posts: ‘Dynamips External Cloud Interface on Linux – Part1 and [...]
Running this on VMware ( like ESXi Server ) read this.
Fantastic tutorial, I had an issue were packets were not getting back to my GNS cisco router properly,
the router was receiving broadcasts and sending packets OK ( I could see pings arriving at other devices and being replyed to but no joy on the router ). For example if you can ping your local Linux box from your cisco but not the outside world.
Solution was to set the adapter to promiscuous on VMware as well. To do this find the network setting on vmware go to properties for your virtual switch and make sure the adapter for your Linux box is set to promiscuous mode accept.
Now my cisco router on my Centos Box on my Vmware ESXi Server is running. thanks again for this.
Simon
OK so I could ping cisco routers OK but when it came to telneting to them from the outside word and getting them to learn routes from one another something else was not working.
solution to disable the Centos Firewall
( as root )
[root@localhost init.d]# service ip_tables stop
Simon , just shaing the info,
I now how have virtual checkpoint firewalls, running with virtual Cisco Routers and virtual servers, now for my virtual proxy server. sad hey.
Hello.
Thanks for great tutorial - without that i’d never worked out how to connect LAN to GNS3 router on Linux using cloud interface.
However based on your tut, i’ve found alternative (in my opinion shorter and better) way to accomplish that. Instead of bridging virtual tap interface with your ethernet device, setting an ip address to 0.0.0.0 on ethernet device and running dhclient on new created bridge, you can only create the virtual interface (the same way you create it in tutorial), then assign it an ip address and set forwarding between the interfaces on your linux machine.
The last thing is done by:
echo ‘1′ > /proc/sys/net/ipv4/conf/all/forwarding.
Then you can attach your virtual interface to the cloud and enjoy connecting dynamips to your LAN without any bridging between interfaces.
Thanks for this great tut once more!
great tutorial the first that really works throughout,
congratulations and thanks
on top of that there is no need to run GNS3 in root mode great
thanks a lot
Hi,
I have configured folow your steps:
# brctl addbr br0
# ip l s dev br0 up
# tunctl -t tap0 -u juanlu
TUNSETIFF: Device or resource busy
# ip l s dev tap0 up
# brctl addif br0 tap0
# brctl addif br0 wlan1
#
# brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.00e04c04a085 no tap0
wlan1
# ifconfig wlan1 0.0.0.0 promisc
# dhclient br0
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
wmaster1: unknown hardware address type 801
wmaster0: unknown hardware address type 801
wmaster1: unknown hardware address type 801
wmaster0: unknown hardware address type 801
Listening on LPF/br0/00:e0:4c:04:a0:85
Sending on LPF/br0/00:e0:4c:04:a0:85
Sending on Socket/fallback
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 18
DHCPOFFER from 192.168.1.1
DHCPREQUEST on br0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.136 — renewal in 1462 seconds.
# route add default gw 192.168.1.1
#
Now, these are my interfaces:
# ip a
1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:23:54:2d:53:3e brd ff:ff:ff:ff:ff:ff
3: wmaster0: mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ieee802.11 00:e0:4c:04:a0:85 brd ff:ff:ff:ff:ff:ff
4: wlan1: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:e0:4c:04:a0:85 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.136/24 brd 192.168.1.255 scope global wlan1
inet6 fe80::2e0:4cff:fe04:a085/64 scope link
valid_lft forever preferred_lft forever
5: wmaster1: mtu 1500 qdisc noop state DOWN qlen 1000
link/ieee802.11 00:22:5f:35:23:02 brd ff:ff:ff:ff:ff:ff
6: wlan0: mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:22:5f:35:23:02 brd ff:ff:ff:ff:ff:ff
13: tap0: mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
link/ether 8a:fb:25:0e:93:1b brd ff:ff:ff:ff:ff:ff
inet6 fe80::88fb:25ff:fe0e:931b/64 scope link
valid_lft forever preferred_lft forever
14: br0: mtu 1500 qdisc noqueue state UNKNOWN
link/ether 00:e0:4c:04:a0:85 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.136/24 brd 192.168.1.255 scope global br0
inet6 fe80::b860:e5ff:fe12:2368/64 scope link
valid_lft forever preferred_lft forever
#
I make a ping from my PC to gw and result is successfully:
# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.60 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.36 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=3.75 ms
^C
— 192.168.1.1 ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2006ms
rtt min/avg/max/mdev = 1.365/2.238/3.750/1.073 ms
Im ake a pig from my PC to my virtual router GNS3 and the result is sucessfully too.
# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=255 time=2.54 ms
64 bytes from 192.168.1.2: icmp_seq=2 ttl=255 time=1.66 ms
64 bytes from 192.168.1.2: icmp_seq=3 ttl=255 time=3.50 ms
^C
— 192.168.1.2 ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2008ms
rtt min/avg/max/mdev = 1.663/2.571/3.506/0.753 ms
My ARP table is ok:
# arp
Address HWtype HWaddress Flags Mask Iface
192.168.1.2 ether cc:0f:1d:0e:f0:01 C br0
192.168.1.1 ether 64:68:0c:83:83:0b C br0
My problema is this. From my virtual router GNS3 i can ping to my PC but i can not ping to my default gw 192.168.1.1.
i resolve arp in GNS3 router the ip of gw. It is very strange.
Any can i help me???. Me and I can only think jumping out the window.
Sorry my english
Kind regards
JL
1st Thanks for the great post.
I follow the instruction its work well but when I connect cloud tap0 interface to the Router I got dynamips error, it says “206-unable to create TAP NIO”.
I change the user of tap interface to root, also change the permission “sudo chmod 777 /dev/net/tun* ” to this but no result.
Could you tell me what I’m doing wrong? Please Help.
Leave your response!
Recent Comments
Blogroll