Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to setup an open v-switch inside my Ubuntu 12.04 Server VM. I have created three interfaces for this VM and I want to create a port mirror inside of the VM using these there interfaces and open v-switch.

There are three Host-Only Adapters: eth0, eth1, eth2. The idea is that three other VM's will be connected to these adapters. One of these VM's will stream UDP video to eth0 and I want the vswitch'd VM to mirror those packets from eth0 onto eth1 and eth2. Each of the VM's connected to eth1 and eth2 will get the same video stream.

I performed the following steps to install open v-switch:

$ apt-get install python-simplejson python-qt4 python-twisted-conch automake autoconf gcc uml-utilities libtool build-essential
$ apt-get install build-essential autoconf automake pkg-config
$ wget http://openvswitch.org/releases/openvswitch-1.7.1.tar.gz
$ tar xf http://openvswitch.org/releases/openvswitch-1.7.1.tar.gz
$ cd http://openvswitch.org/releases/openvswitch-1.7.1.tar.gz
$ apt-get install libssl-dev iproute tcpdump linux-headers-`uname -r`
$ ./boot.sh
$ ./configure - -with-linux=/lib/modules/`uname -r`/build
$ make
$ sudo make install

After installation I configured as follows:

$ insmod datapath/linux/openvswitch.ko
$ sudo touch /usr/local/etc/ovs-vswitchd.conf
$ mkdir -p /usr/local/etc/openvswitch
$ ovsdb-tool create /usr/local/etc/openvswitch/conf.db

Then I started the server:

$ ovsdb-server /usr/local/etc/openvswitch/conf.db \
  --remote=punix:/usr/local/var/run/openvswitch/db.sock \
  --remote=db:Open_vSwitch,manager_options \
  --private-key=db:SSL,private_key \
  --certificate=db:SSL,certificate \
  --bootstrap-ca-cert=db:SSL,ca_cert --pidfile --detach --log-file
$ ovs-vsctl –no-wait init (run only once)
$ ovs-vswitchd --pidfile --detach

The above steps I got from this tutorial and it all worked fine. I then proceeded to add a port mirror based on the open v-switch documentation under Port Mirroring. I successfully completed the following commands:

$ ovs-vsctl add-br br0
$ ovs-vsctl add-port br0 eth0
$ ovs-vsctl add-port br0 eth1
$ ovs-vsctl add-port br0 eth2
$ ifconfig eth0 promisc up
$ ifconfig eth1 promisc up
$ ifconfig eth2 promisc up

At this point when I run ovs-vsctl show I get the following:

75bda8c2-b870-438b-9115-e36288ea1cd8
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "eth0"
            Interface "eth0"
        Port "eth2"
            Interface "eth2"
        Port "eth1"
            Interface "eth1"

And when I run ifconfig I get the following:

eth0      Link encap:Ethernet  HWaddr 08:00:27:9f:51:ca  
          inet6 addr: fe80::a00:27ff:fe9f:51ca/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1494 (1.4 KB)  TX bytes:468 (468.0 B)

eth1      Link encap:Ethernet  HWaddr 08:00:27:53:02:d4  
          inet6 addr: fe80::a00:27ff:fe53:2d4/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1494 (1.4 KB)  TX bytes:468 (468.0 B)

eth2      Link encap:Ethernet  HWaddr 08:00:27:cb:a5:93  
          inet6 addr: fe80::a00:27ff:fecb:a593/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1494 (1.4 KB)  TX bytes:468 (468.0 B)

eth3      Link encap:Ethernet  HWaddr 08:00:27:df:bb:d8  
          inet addr:192.168.1.139  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fedf:bbd8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2211 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1196 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:182987 (182.9 KB)  TX bytes:125441 (125.4 KB)

NOTE: I use eth3 as a bridge adapter for SSH'ing into the VM.

So now, I think I've done everything correctly but when I try to create the bridge using the following command:

$ ovs-vsctl -- set Bridge br0 mirrors=@m -- --id=@eth0 get Port eth0 -- --id=@eth1 get Port eth1 -- --id=@m create Mirror name=app1Mirror select-dst-port=eth0 select-src-port=@eth0 output-port=@eth1,@eth2

I get the following error:

ovs-vsctl: "eth0" is not a valid UUID

I don't understand why it's not able to find the interfaces?

share|improve this question

migrated from stackoverflow.com Oct 21 '12 at 4:19

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

So after some searching turns out I made two mistakes:

  • missing @ infront of eth0: select-dst-port=eth0 should be select-dst-port=@eth0
  • You can only add a rule one at a time for each output port. So at the end you can only say output-port=@eth1 and not output-port=@eth1,@eth2
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.