ryu-manager's --observe-links option generates 'Unknown version (0x04)' on switches - openvswitch

I am trying to configure a SDN using 1 Ryu controller and 3 OpenvSwitch datapaths.
Here is the code I run on my datapaths to let them talk to the controller:
ovs-vsctl set bridge br0 protocols=[OpenFlow13]
ovs-vsctl set-controller br0 tcp:192.168.100.1:6633
Then trying to get the topology of the network via HTTP/REST I run this on the controller:
ryu-manager --observe-links /path-to-apps/rest_topology.py
Running tcpdump on anyone of the switches I read errors like this:
version unknown (0x04), type 0x03, length 8, xid 0x0000000 09:56:34.645491 IP 192.168.100.1.6633 > 192.168.100.2.53550: Flags [P.], seq 1:9, ack 8, win 235, options [nop,nop,TS val 2070367608 ecr 1308752524], lenght 8: OpenFlow
(I get this error for every ryu application I run, even "simple_switch_13.py")
I tried removing the line ovs-vsctl set bridge br0 protocols[OpenFlow13] but it did not work: switches were not connecting to the controller at all.
Any suggestion?
Thanks

Version unknown means that the tcpdump tool does not know which protocol "0x04" is.
That is a well made packet, not an error!
So if you want to know what 0x04 is try using Wireshark or a more complete software.
It will turn out it's a OpenFlow protocol packet.

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

To know port numbers in openvswitch

I am running a switch test Switch Test on real environment with one openvswitch and real sdn switch.
I created a bridge on openvswitch and added ports (ex. eth0, eht1). But I want to know logical port numbers (like 1, 2) which command gives me correct information. ovs-ofctl show bridge s1 shows
1(eth3): mac address etc
2(eth4):
5(eth5):
and ovs-dpctl show
port 2: eth3
port 3: eth4
port 4: eth5
But results are not showing proper mapping of physical to logical ports. Observer eth5 in both cases for ofctl it gives 5 and for dpctl it gives 4. Is there any way to get correct port id's.
I personally feel both these commands are not giving correct port ids. To isolate this scenario. On Mininet I created 2 openvswitchs and run dpctl command as above it gives me 1,2,3,4,5,6 as port numbers but I am not able to run the test with these port numbers. For both switches I used 1,2,3 test executes successfully. What I mean it, if I give 1,2,3 port numbers for one switch and 4,5,6 for another switch tests doesn't execute. Any help is much appreciated.
you can use to show ofport
sudo ovs-vsctl -- --columns=name,ofport list Interface
You can use this command to specify the ofport of the port you are adding in the bridge:
ovs-vsctl add-port br0 eth0 -- set Interface eth0 ofport=1
i think you can try ovs-vsctl list Interface

Netcat will not send messages through UDP connection between Socket PDU blocks in GNU Radio Companion

I am fairly new to Linux and GNU Radio.
I am trying to use GNU Radio to process information. To pass information into GNU Radio, I was planning on using the Socket PDU blocks to pass in information through a socket. To test out the connection I placed 2 Socket PDU blocks in GNU Radio Companion and connected them together, then I used netcat to send and receive messages and files.
I was able to get the connection to work when I had both Socket PDU blocks to TCP server. The sending block was set to port 52001 and the receiving block to 52002. In one terminal I typed:
nc localhost 52002
In a second terminal I typed:
nc localhost 52001
After that, any messages I typed in the second terminal appeared in the first.
I tried to do the same thing with setting the Socket PDU blocks to UDP Server and using the commands:
nc -u localhost 52002
nc -u localhost 52001
But nothing I typed in the second terminal would appear in the first.
What am I missing here? Does netcat just not work with this kind of stuff, or am I forgetting a step? With being new to Linux, GNU Radio and network protocols, I don't even know where to start.
You'll have to go to the receiving terminal and press enter. This will send an empty UDP packet to the server and tell it about the existence of this terminal/socket.
Just
nc -u localhost 52001
doesn't do anything as UDP has no connection setup.

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.