What is the difference between these two OpenvSwitch commands? - sdn

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.

Related

Unable to capture traffic greater than MTU 1500 in ovs tunnel

Created a bridge
ovs-vsctl add-br br0
Added a port of type vxlan in bridge br0
ovs-vsctl add-port br0 tun1 \
-- set Interface tun1 type=vxlan \
options:remote_ip=10.2.3.204 options:key=10 options:df_default=False
Added an internal port in bridge br0
ovs-vsctl add-port br0 iface1 \
-- set Interface iface1 type=internal options:df_default=False
Set the interfaces up
ip link set vxlan_sys_4789 up
ip link set iface1 up
I am receiving traffic in interface iface1 and I am expecting the same traffic encapsulated with the given tunnel.
I send packets with frame size 1472 bytes, I receive the same with the encapsulation done at the remote host (10.2.3.204). But when the frame size exceeds 1472 bytes, the packets get fragmented in interface iface1 and all the fragmented packets pass through the flow. But, I receive in remote host (10.2.3.204) only the last fragment of the traffic where more fragment bit is not set.
On further debugging, I found that in the tunnel interface, vxlan_sys_4789, I see that only the last fragment of the traffic is received, while others are dropped.
Is there any explicit condition in ovs to drop these packets?
Despite fragment flag is set true, why are the fragments not passing through the tunnel?
By default Open vSwitch overrides the internal interfaces (e.g. br0) MTU. If you have just an internal interface (e.g. br0) and a physical interface (e.g. eth0), then every change in MTU to eth0 will be reflected to br0. Any manual MTU configuration using ip on internal interfaces is going to be overridden by Open vSwitch to match the current bridge minimum.
Sometimes this behavior is not desirable, for example with tunnels. The MTU of an internal interface can be explicitly set using the following command:
ovs-vsctl set int br0 mtu_request=1450
After this, Open vSwitch will configure br0 MTU to 1450. Since this setting is in the database it will be persistent (compared to what happens with ip).
The MTU configuration can be removed to restore the default behavior with:
$ ovs-vsctl set int br0 mtu_request=[]
The mtu_request column can be used to configure MTU even for physical interfaces (e.g. eth0).

Not able create ports in OVS

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

Openvswitch change header field

I want add new field openvswitch pattern. My openvswitch (/var/log/openvswitch/ovs-vswitch.log) looking like follow ;
2017-05-21T18:00:06.572Z|00105|rconn|WARN|s2<->tcp:192.168.29.87:6633: connection failed (Network is unreachable)
2017-05-21T18:00:07.572Z|00106|stream_tcp|ERR|tcp:192.168.29.87:6633: connect: Network is unreachable
2017-05-21T18:00:07.572Z|00107|rconn|WARN|s1<->tcp:192.168.29.87:6633: connection failed (Network is unreachable)
2017-05-21T18:00:07.572Z|00108|stream_tcp|ERR|tcp:192.168.29.87:6633: connect: Network is unreachable
2017-05-21T18:00:07.572Z|00109|rconn|WARN|s2<->tcp:192.168.29.87:6633: connection failed (Network is unreachable)
2017-05-21T18:00:08.248Z|00110|bridge|WARN|could not open network device s1-eth2 (No such device)
2017-05-21T18:00:08.257Z|00111|bridge|WARN|could not open network device s1-eth1 (No such device)
I want to add switchID this file. Can I make that? Otherwise this is impossible.
Have a good day everybody.
what it's your meaning about openvswitch header?
for your log about, the error is about the port is not present,
you must add port to bridge that you make,
example:
the output of ifconfig is : enp3s0 and enp3s1
you want to add those port to ovs bridge
ovs-vsctl --may-exist add-br ovs-br #add ovs bridge name ovs-br
ovs-vsctl --may-exist add-port ovs-br enp3s0 #add enp3s0 to ovs-br
ovs-vsctl --may-exist add-port ovs-br enp3s1

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.

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.