Not able create ports in OVS - openvswitch

I have an Ubuntu Host with two VM's and I am trying to create a bridge between the two VM's. I have a bridge say br0 and I am trying to create a port say tap0 and tap1 for the two VM's. So far I was able to create the bridge but when I do try to create the port, I get the below error.
root#dpdk:~# ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev
root#dpdk:~# ovs-vsctl add-port br0 tap1
ovs-vsctl: Error detected while setting up 'tap1'. See ovs-vswitchd log for details.
root#dpdk:~# sudo ovs-vsctl show
4c3a769e-f900-4c8d-81a7-ba685d4e364a
Bridge "br0"
Port "tap1"
Interface "tap1"
error: "could not open network device tap1 (No such device)"
Port "br0"
Interface "br0"
type: internal
ovs_version: "2.5.2"
I am doing this to run a DPDK pktgen application.

You need to create a tap device first.
You can either create it yourself:
$ tunctl -t tap0
$ ip link set tap0 up
$ ovs-vsctl add-port br0 tap0
or let QEMU/KVM create it for you:
$ cat << 'EOF' > /etc/ovs-ifup
#!/bin/sh
switch='br0'
ip link set $1 up
ovs-vsctl add-port ${switch} $1
EOF
$ cat << 'EOF' > /etc/ovs-ifdown
#!/bin/sh
switch='br0'
ip addr flush dev $1
ip link set $1 down
ovs-vsctl del-port ${switch} $1
EOF
$ kvm -m 512 -net nic,macaddr=00:11:22:EE:EE:EE -net \
tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -drive \
file=/path/to/disk-image,boot=on
(The first two commands create two utility scripts as callbacks for kvm. See Open vSwitch's documentation.)

Related

DITG: Connect error in createTransportChan(): No route to host

I am trying to generate traffic (telnet, voip,...) with the d-itg tool:
-I start the receiver :ITGRecv whose ip address is : 10.1.1.2 in xterm of mininet SDN
-I start the telnet traffic sender in xterm with the command: ITGSend -a 10.1.1.2 -rp 32769 -C 100 -c 500 -t 20000 -x recv_log_file I get the following error with this command: Connect error in createTransportChan(): No route to host

Issues in configuring OpenVSwitch on Ubuntu 16.04

I'm using OpenStack to help me virtualize my infrastructure.
You can see how my topology looks like --> My Topology in Openstack
I face issues in configuring the 2 switches.
Here is what I have done (I'm in sudo mode) :
1) Installing openvswitch paquets :
apt-get install openvswitch-switch
2) Creating a bridge named br0 :
ovs-vsctl add-br br0
3) Turn up mybridge interface :
ifconfig br0 up
4) Add the physical interface ens4 to the bridge (I'm connecting through the switch via SSH using the interface ens3) :
ovs-vsctl add-port br0 ens4
5) Remove ens4's IP addressing :
ifconfig ens4 0
6) Add to br0 the former ens4's IP adressing (I take the switch 1 for instance) :
ifconfig br0 192.168.1.18
7) Add a default gateway in the routing table :
route add default gw 192.168.1.1 br0
Unfortunately, after all those steps, I'm still unable to ping from Host_1 (whose IP address is 192.168.1.12) to my Switch_1 (whose IP address is 192.168.1.18, the IP address 192.168.0.30 is used for configuring the Switch via SSH connection) and vice-versa.
Any ideas ?
Thank you in advance
P.S. : If the image is not readable, please tell me, I'll make a new one.
I'm assuming those switches represent VMs, basically because in OpenStack you can't create switches.
That being said, due to ARP reasons, you have to change the MAC addresses. Try giving the bridge the same MAC address as ens4 and change the MAC address of ens4. The script should look like this:
NIC="ens4"
MAC=$(ifconfig $NIC | grep "HWaddr\b" | awk '{print $5}')
ovs-vsctl add-br br0 -- set bridge br0 other-config:hwaddr=$MAC
ovs-vsctl add-port br0 $NIC > /dev/null 2>&1
ifconfig $NIC 0.0.0.0
LAST_MAC_CHAR=${MAC:(-1)}
AUX="${MAC:0:${#MAC}-1}"
if [ "$LAST_MAC_CHAR" -eq "$LAST_MAC_CHAR" ] 2>/dev/null; then
NL="a"
else
NL="1"
fi
NEW_MAC="$AUX$NL"
ifconfig $NIC hw ether $NEW_MAC
Also, check you allow ICMP traffic in the security groups of the VMs.

What is the difference between these two OpenvSwitch commands?

What is the difference between these two OpenvSwitch commands?
ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev & ovs-vsctl add-br br0 .
The first command sets the bridge to userspace-only mode. The second command does the default setup for the bridge.
More information can be found here.

Setting controller IP in Ryu for physical switch

I am new to Ryu and trying to set it up with a physical switch connected to a VM on my computer. The switch's controller is set to 10.0.1.8 and I am trying to set the same on ryu controller. I used the following commands:
sudo ovs-vsctl add-br br0
sudo ovs-vsctl add-port br0 eth2
sudo ovs-vsctl set bridge br0 10.0.1.8 protocols=OpenFlow13
Doing a netstat shows that ryu controller is still listening on 0.0.0.0 as per the output below. Can someone please assist me here?
State PID/Program name
tcp 0 0 0.0.0.0:6633 0.0.0.0:*
It seems I had to include the --ofp-listen-host parameter and specify the controller IP there, as follows:
PYTHONPATH=. ./bin/ryu-manager --verbose --ofp-listen-host 10.0.1.8 ryu/app/simple_switch.py
The commands I was using earlier apply only to a Mininet topology.

Richard Stevens' sock program - multicast clients

I've started sock program like this:
me#ASUS $ ./sock -v -s -F -j 224.0.0.1 -u 127.0.0.11 5555
IP_ADD_MEMBERSHIP set
But, when I try to connect a client, I get this error:
me#ASUS $ ./sock 127.0.0.11 5555 -j 224.0.0.1
IP_ADD_MEMBERSHIP setsockopt error: Address already in use
Am I invoking clients wrong? How to connect multiple multicast clients on a single host to a server?
Thanks.
I was trying to figure this out and bumped into this. The following commands worked for me (same host or from different hosts):
sock -u -i -n 10 224.0.0.4 1234
sock -v -s -i -u -j 224.0.0.4 1234
The second is the receiver (what most people call the server but that term confuses me for UDP stuff).