Fri 19 Dec 2008
Linux Bridging for GNS3 LAN communications
Posted by Josh under CCIE , Cisco Routers , Dynamips , GNS3 , Linux , Voice LAB -I apologize for the delay in posting the next tutorial in the virtual voice lab but I ran into a problem communicating from the HQ router to the host Ubuntu server. I thought I was able to communicate from the HQ router to the host during the Headquarters build tutorial….but I was wrong.
I discovered that I was able to communicate with every device on the LAN except the actual host machine. While troubleshooting, I finally read the GNS3 FAQ. Then I learned how to solve the problem with Josh Atterbury’s posts: ‘Dynamips External Cloud Interface on Linux - Part1 and Part2.
I have altered Josh’s setup a bit but the theory is the same. If you are running Ubuntu, you just need to install ‘uml-utilities’ and ‘bridge-utils’. Once the tap interface has been activated, you will need to change the GNS3 cloud object to use the tap0 interface instead of generic NIO and eth0.
Here are the steps to manually create a bridge group.
======================================
- Create a tap interface
sudo tunctl -t tap0 - Remove ip addressing and set eth0 and tap0 to promiscuous mode
sudo ifconfig tap0 0.0.0.0 promisc up
sudo ifconfig eth0 0.0.0.0 promisc up - Create a new bridge interface
sudo brctl addbr br0 - Add tap0 and eth0 to the bridge group
sudo brctl addif br0 tap0
sudo brctl addif br0 eth0 - Enable the bridge interface and give it an ip address
sudo ifconfig br0 up
sudo ifconfig br0 10.10.10.99/24 - Configure the default route
sudo route add default gw 10.10.10.254
Here are the steps to reverse the changes (these can be copied and pasted in)
======================================
sudo ifconfig br0 down
sudo brctl delif br0 eth0
sudo brctl delif br0 tap0
sudo brctl delbr br0
sudo tunctl -d tap0
sudo ifconfig eth0 up
sudo ifconfig eth0 10.10.10.99/24
sudo route add default gw 10.10.10.254
Add the following to your /etc/network/interfaces config file if you are using static addressing.
======================================
auto br0
iface br0 inet static
address 10.10.10.99
netmask 255.255.255.0
gateway 10.10.10.254
bridge-ports eth0 tap0
pre-up ifconfig eth0 0.0.0.0 promisc up
pre-up ifconfig tap0 0.0.0.0 promisc up
Add the following to your /etc/network/interfaces config file if you are using dhcp.
======================================
auto br0
iface br0 inet dhcp
bridge-ports eth0 tap0
pre-up ifconfig eth0 0.0.0.0 promisc up
pre-up ifconfig tap0 0.0.0.0 promisc up

(10 votes, average: 4.40 out of 5)








December 19th, 2008 at 9:44 am
nice tut..
hey josh… where is james???
we r missing him and his updates on ccie studies…
December 19th, 2008 at 2:29 pm
Hi Vijay,
Nice to hear someone is missing me
I am still hard at it. And between juggling studies, work, and the Holiday’s I haven’t had a chance to post. Hope to have an update very soon.
james
December 24th, 2008 at 1:12 pm
Hi Josh,
How do we do this on windows as host os system?
Thanks
Chikki
December 27th, 2008 at 5:09 am
Hello Josh,
Many many thanx man, it worked great
* note for newbies like me: add the tap int from the “tap” tab in the cloud config… took me some time to know that…
Thanx again
December 27th, 2008 at 5:11 am
Hi Chikkis,
I don’t think this problem exists on windows as I was able to ping the router directly from the host pc when i connected it to the Ethernet interface..
Regards,
Fouad
December 27th, 2008 at 3:35 pm
Fouad,
Thanks. You are correct. This problem does not exist in Windows environments.
Simply select an ethernet interface within the cloud configuration.
Josh
December 31st, 2008 at 2:24 pm
Great tut!
I google for long time, looking for something like that, but i have some questions..
1.-I don’t have tunctl installed at backtrack3
i download it, but….
bt tunctl-1.5 # make
cc -g -Wall -o tunctl tunctl.c
docbook2man tunctl.sgml
make: docbook2man: Command not found
make: *** [tunctl.8] Error 127
ideas?
thx
December 31st, 2008 at 2:34 pm
Erwin,
I ran into this problem yesterday … on a CentOS 5.2 system. I could not find a package that contained the tunctl command. Grrrr….
Anyways, here is what I did find out. I didn’t need it.
I was able to just type ‘modprobe tun’ and ‘ifconfig tap0 up’ as root and it worked.
Use ‘lsmod | grep tun’ to see if the tun kernel module is loaded and ‘ifconfig’ to see if the tap0 interface is up.
Try skipping the ‘tunctl -t tap0′ part.
Josh
December 31st, 2008 at 3:56 pm
Im running bt3 kernel 2.6.21.5
Here’s the results:
bt / # modprobe tun
bt / # ifconfig tap0 up
tap0: ERROR while getting interface flags: No such device
bt / # lsmod | grep tun
tun 12160 0
Sorry but it’s that module tun, dont create the bridge interface
Thx 4 ur time
January 5th, 2009 at 8:35 pm
Erwin,
Sorry that did not work out for you.
I am not familiar with backtrack3.
You might try installing it from source.
http://tunctl.sourceforge.net/
Josh
January 8th, 2009 at 10:15 pm
Hi,
With CentOS 5.2 i386 I installed tunctl from fedora 10 and it *appears* to work.
http://download.fedora.redhat.com/pub/fedora/linux/development/i386/os/Packages/tunctl-1.5-1.fc10.i386.rpm
rpm -Uvh tunctl-1.5-1.fc10.i386.rpm
Idea came from here…
http://wiki.centos.org/HowTos/KVM
William.
January 11th, 2009 at 2:54 am
Thx Josh
I installed ubuntu 8.10 and actually running bt3 in a virtual machine. I follow the tuto and its works hehe great work!
But one question, if my ubuntu have 192.168.0.100 ip, in this step:
sudo ifconfig br0 10.10.10.99/24
i have to change from 10.10.10.99 to 192.168.0.100, and add the route again too, assign an ip from 192.168.0.x and give the gw to have access to the internet?
Thx 4 ur time!!!
January 11th, 2009 at 9:59 pm
Erwin,
Yes, just change the ip addresses however you like to match your topology.
Josh
February 5th, 2009 at 11:10 pm
Hi josh
Can i just use tap interface as your the other tutorial?
The reason I ask because i use remote login to access my linux box. Thanks
Btw, your website has been my top ten list for years. greate work.
nu
February 27th, 2009 at 11:47 am
Hi Josh,
Great site - have been visiting for a few weeks now and this is one of the best knowledge bases for GNS3.
I have followed the how to you published above and I have a couple of problems.
Firstly I create the bridge interface and edit my interface file reboot my pc and I can’t access any websites using firefox - I can ping 4.2.2.2 and any other pingable device on the net but www sites are not possible. If I remove the config and reboot its back to normal and I can access all sites again.
The second issues I have is that none of my GNS3 routers can access the internet i.e. the host PC can ping to 4.2.2.2 but the cisco router can’t. It does have local connectivity (linked to host via bridge)
Any ideas?
Thanks and keep up the good work!!
Rick
February 28th, 2009 at 8:02 pm
[...] is a nice video tutorial to get your GNS3 lab connected to your physical [...]
March 15th, 2009 at 9:01 pm
This may not be revelant but i figured i’d post this anyway. If you’re using ubuntu 8.10 you may be in for some issues with the network manager. For some unknown reason it stops functioning. You will need to manually set you’re resolv.conf with your ISP’s DNS servers. That file is located in /etc/network/resolv.conf
March 31st, 2009 at 8:01 am
Hi All
I’ve followed this tut, which is very clear, but am having problems. I’m running Ubuntu 7.10 on VMWare ESXi. On top of that I’ve got GNS3 running.
The problem I’ve got is as follows:
I can ping from the router to the ubuntu IP.
I can ping from the Ubuntu PC to my real PC.
I can ping from the Ubuntu PC to my GNS3 router.
I cannot ping from my real PC to the GNS3 router.
There are no rules in the Ubuntu firewall (IPtables I think it’s called). One curious thing is this. When I shut the interface on the GNS3 router the ping response on my real PC is “dest unreachable”. When I issue a no shut to the interface I get request timed out.
Anyone got any ideas?
April 2nd, 2009 at 7:11 pm
can this be done with the wirelless connection in ubuntu
April 5th, 2009 at 5:51 pm
Ok I did it…and I use eth1 my wireless interface…
I can connect to the GNS3 topology but not to the Internet… :-)?
same as Rick #15
tunctl -t tap0
ifconfig tap0 0.0.0.0 promisc up
ifconfig eth1 0.0.0.0 promisc up
brctl addbr br0
brctl addif br0 tap0
brctl addif br0 eth1
ifconfig br0 up
ifconfig br0 172.16.0.99/24
route add default gw 172.16.0.1
the gw is the gns3 router I am connecting to…
help
April 6th, 2009 at 9:03 am
Ready, i can connect the GNS3 to my LAN connection and ping my CPE!
But¿?¿?How can i connect the GNS3 to the internet?
How i can do this in Ubuntu?
Thanks you for all
April 19th, 2009 at 6:39 am
Janardhanaya,
You are correct. There are some issues with the network manager. I have not had time to figure them all out, but the /etc/network/interfaces config file and network manager are in conflict at times.
I ended up creating a script that I run right before starting labs to create tap interfaces and bridges. Hopefully I can find time in the near future to troubleshoot the problem with the network manager.
Josh
April 19th, 2009 at 7:32 am
Alejandro,
This video covers the concept using dynagen, but the idea is the same.
http://www.blindhog.net/cisco-using-dynamips-your-personal-internet-router/
Josh