Open Vswitch Cheat Sheet
Open Vswitch Cheat Sheet
vSwitch Cheat Sheet
Over the past year I've spent some time compiling troubleshooting
documents and procedures for all things cloud (OpenStack, SDN,
Open vSwitch, etc). I wanted to make a series on 'cheat sheets', or
common day to day con䅘ﰀguration/troubleshooting commands and
techniques for di섵媀erent cloud components.
First on the list is Open vSwitch (aka OVS), which has become an
integral part of OpenStack networking. It provides the ability to
replicate many of the features of a traditional layer 2 switch, while
http://therandomsecurityguy.com/openvswitchcheatsheet/ 1/8
23/03/2016 Open vSwitch Cheat Sheet
Base commands
ovs-vsctl
The above should be fairly self explanatory. Below are the common
http://therandomsecurityguy.com/openvswitchcheatsheet/ 2/8
23/03/2016 Open vSwitch Cheat Sheet
ovs-ofctl
Below are the common con䅘ﰀgurations used with the ovs-ofctl tool:
ovs-dpctl
ovs‐dpctl add‐dp dp1
http://therandomsecurityguy.com/openvswitchcheatsheet/ 4/8
23/03/2016 Open vSwitch Cheat Sheet
ovs‐dpctl add‐if dp1 eth0
ovs‐dpctl dump‐flows
ovs-appctl
Now, with all of these tools at your disposal, let's go over some
common troubleshooting scenarios.
Troubleshooting
http://therandomsecurityguy.com/openvswitchcheatsheet/ 5/8
23/03/2016 Open vSwitch Cheat Sheet
The above con䅘ﰀguration creates an OVS bridge (brbm) and links the
physical interface eth2 to brbm. If you've enabled ip_forwarding
and have created the bridge interfaces in your network interfaces
䅘ﰀle but have zero connectivity to the new interface, then how do
you troubleshoot? Let's use some of the tools above to verify our
con䅘ﰀguration:
root@testnode1:~# ovs‐vsctl show
cae63bc8‐ba98‐451a‐a652‐a3b0e8a0f553
Bridge brbm
Port "eth2"
Interface "eth2"
Port brbm
Interface brbm
type: internal
root@testnode1:~# ovs‐vsctl list‐ports brbm
eth2
root@testnode1:~# ovs‐ofctl dump‐ports brbm
OFPST_PORT reply (xid=0x2): 1 ports
port LOCAL: rx pkts=23, bytes=1278, drop=0, errs=0, frame=0,
over=0, crc=0
tx pkts=369369, bytes=62820789, drop=0, errs=0, coll=0
root@testnode1:~# ovs‐ofctl dump‐ports‐desc brbm
OFPST_PORT_DESC reply (xid=0x2):
LOCAL(brbm): addr:78:e7:d1:24:73:85
config: 0
state: 0
speed: 0 Mbps now, 0 Mbps max
root@testnode1:/etc/network# ifconfig
brbm Link encap:Ethernet HWaddr 78:e7:d1:24:73:85
inet addr:10.23.32.15 Bcast:0.0.0.0 Mask:255.255.248.0
inet6 addr: fe80::16:e1ff:fe1f:f3e4/64 Scope:Link
UP BROADCAST RUNNING MTU:1500 Metric:1
RX packets:369369 errors:0 dropped:159944 overruns:0
frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:62820789 (62.8 MB) TX bytes:1278 (1.2 KB)
eth2 Link encap:Ethernet HWaddr 78:e7:d1:24:73:85
inet6 addr: fe80::7ae7:d1ff:fe24:7385/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14148 errors:0 dropped:68 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
http://therandomsecurityguy.com/openvswitchcheatsheet/ 6/8
23/03/2016 Open vSwitch Cheat Sheet
collisions:0 txqueuelen:1000
RX bytes:2198636 (2.1 MB) TX bytes:648 (648.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:17701 errors:0 dropped:0 overruns:0 frame:0
TX packets:17701 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1487216 (1.4 MB) TX bytes:1487216 (1.4 MB)
root@testnode1:/etc/network# cat /proc/sys/net/ipv4/ip_forward
1
From the output above I see that although the OVS and interfaces
䅘ﰀle looks correct, I do not see any port tra䄯㠀c aside from LOCAL.
LOCAL tra䄯㠀c is tra䄯㠀c generated from the host (ICMP in/out, ARP,
etc). What is missing from the original OVS con䅘ﰀguration statement
is a restart of the networking stack. After the restart, we can see
proper 섟쀀ow generation:
root@testnode1:~# ovs‐ofctl dump‐ports‐desc brbm
OFPST_PORT_DESC reply (xid=0x2):
1(eth2): addr:78:e7:d1:24:73:85
config: 0
state: 0
current: 10GB‐FD FIBER
advertised: 10GB‐FD FIBER
supported: 10GB‐FD FIBER
speed: 10000 Mbps now, 10000 Mbps max
root@testnode1:~# ovs‐ofctl dump‐ports brbm
OFPST_PORT reply (xid=0x2): 3 ports
port 5: rx pkts=6071934, bytes=37086750067, drop=0, errs=0,
frame=0, over=0, crc=0
tx pkts=6888905, bytes=626021363, drop=0, errs=0, coll=0
port 1: rx pkts=32317009, bytes=32290813174, drop=0, errs=0,
frame=0, over=0, crc=0
tx pkts=25212056, bytes=83553302356, drop=0, errs=0, coll=0
port LOCAL: rx pkts=12293904, bytes=1780442549, drop=0, errs=0,
frame=0, over=0, crc=0
tx pkts=24816664, bytes=31363410668, drop=0, errs=0, coll=0
CONCLUSION
http://therandomsecurityguy.com/openvswitchcheatsheet/ 7/8
23/03/2016 Open vSwitch Cheat Sheet
CONCLUSION
Open vSwitch provides a handful of useful tools for troubleshooting
di섵媀erent con䅘ﰀgurations. I've only covered a handful of commands
that I've used but may turn this into a more in depth series.
0 Comments therandomsecurityguy
1 Login
Start the discussion…
Be the first to comment.
AUTHOR
dc
http://therandomsecurityguy.com/openvswitchcheatsheet/ 8/8