Managing networks with OpenFlow
Level 1: There and Back Again
Imagine two hosts connected by a switch (Figure 4). Initially, I won't define a controller and set flow entries manually. To check whether the connection has been established, host 1 uses the CLI in Mininet to ping host 2 (Listing 1). I ping host 2 from host 1:
mininet h1 ping -c 4 h2 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.From 10.0.0.1 icmp_seq=1 Destination Host Unreachable[...]
Listing 1
Creating a Network in Mininet
The attempt fails because the switch initially does not forward packets without flow entries and without a controller. The absence of a controller and flow entries is revealed using the dpctl
command, a utility shipped with OpenFlow that provides access to a switch's flow table:
~$ dpctl dump-flows tcp:127.0.0.1:6634 stats_reply (xid=0x6929ef28): flags=none type=1(flow)
dpctl
then sets a flow entry that forwards the incoming packets arriving at port 1 of the switch to port 2:
~$ dpctl add-flowtcp:127.0.0.1:6634 in_port=1,actions=output:2
Again, nothing: The second ping fails because, although the switch forwards packets to host 2, host 2 is not responding.
If you now use dpctl
to create another flow entry that forwards from port 2 to port 1, the results are positive: The two hosts communicate freely through the switch, as long as the idle timeout does not interfere (Listing 2).
Listing 2
A Working Flow Table
Level 2: Where is Arp?
Scenario 2 uses a network structure identical to Scenario 1, but it sends the initial command to ensure that Open vSwitch enters the game as a built-in controller:
sudo mn --topo single,2 --switch ovsk --controller ovsc
The connection test with ping
is immediately successful; the flow table shows three flow entries (Listing 3).
Listing 3
Reading Flow Tables
In addition to the Arp reply, two ICMP requests and replies appear in Listing 3; these requests originate from the flow entry generated by the ping. What happened to the Arp request, which usually comes as a broadcast over the network? If you sniff the control channel, which connects the switch and the controller, using tcpdump or Wireshark, you can determine that the controller has the Arp requests forwarded directly, which does not require a flow entry.
If you use Wireshark with the OpenFlow dissector, which is part of the Mininet image, you can see and analyze the OpenFlow controller's entire communication. Figure 5 shows an example of the handshake between the controller and the switch: The switch uses the Features Reply
to signal to the controller which OpenFlow actions it supports.
Level 3: Tree-Like
In the third and final scenario, Mininet generates a network with a tree topology (Figure 6), in which three hosts each are connected to switches S2 through S4. Mininet then plugs the three switches into an aggregation switch (S1). This topology is typical for networks in companies or data centers. This time, the admin defines a remote controller, assigns an IP address, and sets an OpenFlow standard controller port.
![](/var/linux_magazin/storage/images/issues/2014/162/openflow/figure-6/614079-1-eng-US/Figure-6_large.png)
sudo mn --topo tree,depth=2,fanout=3 --mac --switch ovsk--controller=remote,ip=<Controller-IP>,port=6633
The admin can select any computer on the local network and launch a controller (e.g., Floodlight) in the basic configuration:
java -jar floodlight.jar
If Mininet is online, Floodlight detects both the connections to the switches as well as the topology from the console output. Now, you can enter
http://<Controller_IP>:8080/ui/index.html
to launch the Floodlight web user interface and view the switches and hosts that have been detected – the Topology tab presents a graphical display. The graph in Figure 6 might be more functional than pretty, but it is sufficient for an overview.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.