It is currently Tue Oct 15, 2019 11:34 am


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Trying to hook up GNS3 with Open vSwitch running on host
PostPosted: Wed Nov 14, 2012 5:23 am 
Offline

Joined: Fri Dec 23, 2011 8:29 pm
Posts: 32
Hi all,

Don't know if this is even possible, but here's what I'm trying to do... I have a Ubuntu 12.04.1 host running Open vSwitch 1.4.0. I have a couple of the real NICs on the machine connected to OVS, as well as a KVM VM, and the host machine is configured to route. Here's the current OVS setup:

Code:
# ovs-vsctl show | grep -e Bridge -e Port -e tag
    Bridge "ovs-switch0"
        Port "eth2"
            tag: 20
        Port "vlan20"
            tag: 20
        Port "ovs-switch0"
        Port "eth1"
            tag: 10
        Port "vnet0"
            tag: 20
        Port "vlan10"
            tag: 10


And my ifconfig output:

Code:
# ifconfig | grep -e HWaddr -e "inet addr"
eth0      Link encap:Ethernet  HWaddr 00:13:72:39:27:34
          inet addr:172.16.180.53  Bcast:172.16.180.255  Mask:255.255.255.0
eth1      Link encap:Ethernet  HWaddr 00:04:23:bd:4d:92
eth2      Link encap:Ethernet  HWaddr 00:04:23:bd:4d:93
tap0      Link encap:Ethernet  HWaddr 52:e6:db:f5:e6:ef
          inet addr:192.168.30.254  Bcast:192.168.30.255  Mask:255.255.255.0
vlan10    Link encap:Ethernet  HWaddr 42:9d:5d:4a:e4:0f
          inet addr:192.168.10.254  Bcast:192.168.10.255  Mask:255.255.255.0
vlan20    Link encap:Ethernet  HWaddr 6a:74:38:7b:e3:25
          inet addr:192.168.20.254  Bcast:192.168.20.255  Mask:255.255.255.0
vnet0     Link encap:Ethernet  HWaddr fe:54:00:a9:c4:32


The VM on vnet0 can ping an actual machine connected up to eth1, and either can ping the other interface IPs, so I'm fairly certain that OVS is functioning correctly. So then I tried to get GNS3 hooked up to the host box thru OVS. The first way I tried was to create an "internal" interface in OVS, and then ifconfig it with an IP, in the same way I made the "vlanXX" interfaces on the host:
Code:
# ovs-vsctl add-port ovs-switch0 gns3tap tag=30 -- set interface gns3tap type=internal
# ifconfig gns3tap 192.168.30.254 netmask 255.255.255.0 up

Then I went into GNS3 and tried to use it via a cloud using a Linux NIO, which did not work (router in GNS3 could not ping the gns3tap int's IP.) So I did a "ovs-vsctl del-port" to get rid of it, and then tried a more traditional way:
Code:
# modprobe tun
# tunctl -u will
# ifconfig tap0 192.168.30.254 netmask 255.255.255.0 up

I went back into GNS3 and made a cloud using NIO:tap, and the router in GNS3 could ping the tap0 IP. But when I added the tap0 interface to the OVS bridge via:
Code:
# ovs-vsctl add-port ovs-switch0 tap0 tag=30

The router could no longer ping the tap0 IP.

Does anyone know if such a setup can successfully work? I'd like the VMs to be outboard of GNS3, instead of using the QEMU host option in GNS3. If GNS3 cannot currently support this, is there any plans to make this work someday? (kind of like the VirtualBox integration, but with KVM/libvirt)

Thanks,
Will




Top
 Profile  
 
 Post subject: Re: Trying to hook up GNS3 with Open vSwitch running on host
PostPosted: Wed Nov 14, 2012 4:43 pm 
Offline

Joined: Mon Nov 10, 2008 10:31 am
Posts: 555
Location: Slovakia
Hi,
thanks for your email. As I haven't been in touch with Openvswitch for more than one year I don't think I can really help. But at least I can try ;)

1. Try to make your topology as simple as possible for troubleshooting purpose. For instance, don't use tags and you don't need to use routing. Then you can use only vlan1 interface.

2. Once you add tap interface to bridge ovs-switch0 it becomes L2 interface and as we know L2 switchports don't use IP address. I believe that is why you can't ping IP address of tap interface from GNS3 router.
I suggest you to use openvswtich to add vlan30 interface to your configuration and assign IP from subnet 192.168.30.0/24 to vlan30 interface. I think you should be able to make successful ping between GNS3 router and vlan30 interface.

3. If none of above works just follow my advice and configure toplogy as Layer 2 only - without routed (L3) interface. You should be able to ping vnet0 (VM on this interface has IP addrees from 192.168.30.0/24, right?) and GNS3 router (for example 192.168.30.1/0)

...............................................openvswitch
........................................xxxxxxxxxxxxxxxx
VM----------------vnet0-------------x----eth1----tap----x-------------------GNS3 router
192.168.30.10/24...................xxxxxxxxxxxxxxxx................192.168.3.0.1/24

Note: Once you don't create L3 interfaces by openvswitch (vlanX interface) you can use also bridge-utils for bridging.
http://brezular.wordpress.com/2011/06/19/bridging-qemu-image-to-the-real-network-using-tap-interface/

_________________
Brezular

All my tutorials can be found here:
http://brezular.com


Top
 Profile  
 
 Post subject: Re: Trying to hook up GNS3 with Open vSwitch running on host
PostPosted: Wed Nov 14, 2012 5:35 pm 
Offline

Joined: Fri Dec 23, 2011 8:29 pm
Posts: 32
Thanks, Brezular, for the clear thinking! I have it working now.

So I got rid of the tap0 int, and re-created it without the IP assignment via:
Code:
# tunctl -u will
# ifconfig tap0 up


Then added it and a new "vlan30" interface to OVS via:
Code:
# ovs-vsctl add-port ovs-switch0 tap0 tag=30
# ovs-vsctl add-port ovs-switch0 vlan30 tag=30 -- set interface vlan30 type=internal


And then assigned an IP to the "vlan30" int via:
Code:
# ifconfig vlan30 192.168.30.254 netmask 255.255.255.0 up


My OVS switch config is now:
Code:
# ovs-vsctl show | grep -e Bridge -e Port -e tag
    Bridge "ovs-switch0"
        Port "vlan30"
            tag: 30
        Port "eth2"
            tag: 20
        Port "vlan20"
            tag: 20
        Port "ovs-switch0"
        Port "tap0"
            tag: 30
        Port "eth1"
            tag: 10
        Port "vnet0"
            tag: 20
        Port "vlan10"
            tag: 10


And the ifconfig output now looks like:
Code:
# ifconfig | grep -e HWaddr -e "inet addr"
eth0      Link encap:Ethernet  HWaddr 00:13:72:39:27:34 
          inet addr:172.16.180.53  Bcast:138.15.180.255  Mask:255.255.255.0
eth1      Link encap:Ethernet  HWaddr 00:04:23:bd:4d:92 
eth2      Link encap:Ethernet  HWaddr 00:04:23:bd:4d:93 
tap0      Link encap:Ethernet  HWaddr 9e:09:ae:a5:87:0a 
vlan10    Link encap:Ethernet  HWaddr 42:9d:5d:4a:e4:0f 
          inet addr:192.168.10.254  Bcast:192.168.10.255  Mask:255.255.255.0
vlan20    Link encap:Ethernet  HWaddr 6a:74:38:7b:e3:25 
          inet addr:192.168.20.254  Bcast:192.168.20.255  Mask:255.255.255.0
vlan30    Link encap:Ethernet  HWaddr 16:53:f9:95:c7:4a 
          inet addr:192.168.30.254  Bcast:192.168.30.255  Mask:255.255.255.0
vnet0     Link encap:Ethernet  HWaddr fe:54:00:a9:c4:32


And, now the router in GNS3 (with the int with IP = 192.168.30.1 connected to the cloud config'd as NIO_tap:tap0) can now ping my VM at IP 192.168.20.50!

Linux networking and GNS3 rocks! :)

Thanks again for your guidance...

Cheers,
Will


Top
 Profile  
 
 Post subject: Re: Trying to hook up GNS3 with Open vSwitch running on host
PostPosted: Tue Nov 27, 2012 9:11 pm 
Offline

Joined: Thu Oct 18, 2012 6:38 pm
Posts: 21
Can you please try to configure a DHCP scope on your server and see if a qemu (microcore) host or a router picks up an IP in GNS3?




Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO