Micronics
  • Home
  • Links
  • Contact
Home » Tutorials

Part 1 of Dynamips External Cloud Interface on Linux

30 June 2008 28 Comments

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

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

28 Comments »

  • Host said:

    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.

    # 6 July 2008 at 5:41 am
  • Zach Loeber said:

    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

    # 16 July 2008 at 12:50 am
  • josh (author) said:

    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?

    # 16 July 2008 at 6:15 am
  • joshatterbury.com » Blog Archive » Part 2 of Dynamips External Cloud Interface on Linux said:

    [...] 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 [...]

    # 18 July 2008 at 10:56 pm
  • Ktulhu said:

    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. ???

    # 24 July 2008 at 3:52 pm
  • josh (author) said:

    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.

    # 24 July 2008 at 6:44 pm
  • bugs_expert said:

    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..

    # 29 July 2008 at 4:18 pm
  • josh (author) said:

    @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

    # 29 July 2008 at 5:17 pm
  • ktmr23 said:

    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

    # 5 August 2008 at 8:43 am
  • josh (author) said:

    @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.

    # 5 August 2008 at 5:13 pm
  • ktmr23 said:

    Josh,

    thank you very much. I will prove to running “sudo bash” and I will write you about the result.

    Best regards.

    # 6 August 2008 at 2:27 am
  • ktmr23 said:

    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

    # 6 August 2008 at 2:32 am
  • josh (author) said:

    @ktmr23
    Hi.
    Error 209 is usually associated with an ios issue. Double check that the ios file locations are where the.net file states.

    # 6 August 2008 at 5:25 am
  • ktmr23 said:

    it is possible, thank josh.
    I will review the configuration in ubuntu. Linux is very dificult for me

    Best regards Josh

    # 6 August 2008 at 8:33 am
  • ktmr23 said:

    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

    # 6 August 2008 at 8:44 am
  • ktmr23 said:

    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.

    # 6 August 2008 at 8:38 pm
  • kreggz said:

    u r a legend mate - cheers

    # 11 August 2008 at 10:35 am
  • Albert said:

    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)

    # 29 November 2008 at 2:19 am
  • certifiedIT.pro - How to allow communication from Dynamips virtual Cisco routers to the LAN and the Internet. said:

    [...] 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 [...]

    # 6 February 2009 at 5:29 pm
  • Cosmin said:

    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.

    # 15 April 2009 at 5:54 pm
  • Sephiroth said:

    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

    # 27 May 2009 at 12:28 pm
  • Bradshaw said:

    Well done.

    # 6 July 2009 at 12:26 pm
  • TFTP with GNS3 « juecker.net said:

    [...] 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 [...]

    # 10 July 2009 at 10:50 pm
  • Cesar Ghali said:

    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

    # 16 August 2009 at 7:03 pm
  • Mike said:

    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.

    # 19 November 2009 at 12:54 pm
  • Javier said:

    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

    # 15 December 2009 at 1:44 am
  • mihwar said:

    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
    …

    # 17 December 2009 at 4:27 pm
  • blindhog.net » Linux Bridging for GNS3 LAN communications said:

    [...] with Josh Atterbury’s posts: ‘Dynamips External Cloud Interface on Linux – Part1 and [...]

    # 19 January 2010 at 5:55 am

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

Recent Comments

  • blindhog.net » Linux Bridging for GNS3 LAN communications on Part 2 of Dynamips External Cloud Interface on Linux
  • blindhog.net » Linux Bridging for GNS3 LAN communications on Part 1 of Dynamips External Cloud Interface on Linux
  • mihwar on Part 1 of Dynamips External Cloud Interface on Linux
  • Javier on Part 1 of Dynamips External Cloud Interface on Linux
  • Mike on Part 1 of Dynamips External Cloud Interface on Linux
  • Lukasz on CCIE SP Technology Workbooks

    Blogroll

    • Colorlabs Project
    • Michael Jubel
    • Hanna Siahaan
    • Majari Magazine
    • The Bloggerzine
    • Majari Kanayakan
    Powered by WordPress | Log in | Entries (RSS) | Comments (RSS) | Arthemia theme by Michael Hutagalung