Mininet and Open vSwitch on CentOS 7
September 13, 2014 6 Comments
The following are the steps I took to get Mininet running in CentOS 7. I ran into many issues trying to get OVS installed and running. There was a conflict between the OVS script tools starting OVSDB and SELinux. I had to set SELinux to Passive to work around it. So depending on what system you are running this on, be advised of the following steps and what system level settings I changed for security. I assume most of these will be corrected once OVS officially supports CentOS/RHEL 7.
Installing Mininet on CentOS7
– I needed VM with 2GB memory to get OS installed.
– I used CentOS-7.0-1406-x86_64-livecd.iso to install the VM. I’m not going to outline steps for installing CentOS.
– I created a local user called mininet and gave it sudo access and ran the remainder as that user.
– Install SSHD
sudo yum -y install openssh-server
sudo chkconfig sshd on
sudo service sshd start
– Disable SELinux to get OVSDB to stasrt
sudo setenforce Permissive
– Modify sudoers secure_path to add /usr/local/bin so the ‘controller’ which be found.
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
– Install GIT
sudo yum -y install git
– Get Mininet.
git clone git://github.com/mininet/mininet.git
– Update installer mininet/util/install.sh.
***ADD the following before the line ‘test -e /etc/fedora-release && DIST=”Fedora”‘. Somewhere around line 47. May differ.
test -e /etc/centos-release && DIST="CentOS"
if [ "$DIST" = "CentOS" ]; then
install='sudo yum -y install'
remove='sudo yum -y erase'
pkginst='sudo rpm -ivh'
# Prereqs for this script
if ! which lsb_release &> /dev/null; then
$install redhat-lsb-core
fi
fi
***EDIT
if ! echo $DIST | egrep 'Ubuntu|Debian|Fedora|CentOS'; then
echo "Install.sh currently only supports Ubuntu, Debian and Fedora."
exit 1
fi
– Install Mininet and OpenFlow reference. Not OVS.
mininet/util/install.sh -nf
– Build and Install OVS
sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \
kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
libtool wget
mkdir -p /home/mininet/rpmbuild/SOURCES/
cd /home/mininet/rpmbuild/SOURCES/
wget http://openvswitch.org/releases/openvswitch-2.3.0.tar.gz
tar zxvf openvswitch-2.3.0.tar.gz
cd openvswitch-2.3.0
rpmbuild -bb --without check rhel/openvswitch.spec
sudo rpm -ivh --nodeps /home/mininet/rpmbuild/RPMS/x86_64/openvswitch*.rpm
– Start OVS
sudo /etc/init.d/openvswitch start
– Check working
[mininet@localhost ~]$ sudo ovs-vsctl show
76ed3664-6b6b-4325-85c1-c9a2bf735e30
ovs_version: "2.3.0"
– Test out Mininet
[mininet@localhost ~]$ sudo mn --test pingall
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
*** Starting 1 switches
s1
*** Waiting for switches to connect
s1
*** Ping: testing ping reachability
h1 -> h2
h2 -> h1
*** Results: 0% dropped (2/2 received)
*** Stopping 1 controllers
c0
*** Stopping 1 switches
s1 ..
*** Stopping 2 hosts
h1 h2
*** Done
completed in 5.397 seconds
So it seems to work. But there are a few things to note.
1. The kernel datapath is not installed. This is totally userspace. I could not get the kernel module to compile. Wait until official support of RHEL7.
2. The above is the extent of the testing I did. There may be other issues that crop up.
Hope this helps anyone that uses CentOS or RHEL 7 with Mininet.
This post ‘Mininet and OVS on CentOS 7’ first appeared on https://techandtrains.com/.
Every time I’m running: sudo mn –test pingall I’m getting “*** Waiting for switches to connect” s1… and its just stuck on that
Tried it on two different machines (rhel 7.1 and 7.0) -> same results.
Did it happen to you?
Is OVS running? There should be 2 OVS processes running all the time. Also, run ‘ovs-vsctl show’ while you have mininet running to see if the switches got created.
Hello,
Very nice guide. I followed the steps exactly. However, I got this error:
[root@localhost x86_64]# sudo rpm -ivh –nodeps /home/mininet/rpmbuild/RPMS/x86_64/openvswitch*.rpm
error: File not found by glob: /home/mininet/rpmbuild/RPMS/x86_64/openvswitch*.rpm
Then I copied the file manually and it ran:
[root@localhost x86_64]# cp openvswitch-2.3.0-1.x86_64.rpm /home/mininet/rpmbuild/RPMS/x86_64/
[root@localhost x86_64]# cp openvswitch-debuginfo-2.3.0-1.x86_64.rpm /home/mininet/rpmbuild/RPMS/x86_64/
[root@localhost x86_64]# sudo rpm -ivh –nodeps /home/mininet/rpmbuild/RPMS/x86_64/openvswitch-2.3.0-1.x86_64.rpm
Preparing… ################################# [100%]
Updating / installing…
It ran smoothly – it started and displayed the version, but when it was time to start mininet, it didn’t find the command:
[root@localhost openvswitch-2.3.0]# mn –test pingallbash: mn: command not found…
Similar command is: ‘nm’
I would very much appreciate some advice on how to proceed.
S.
I should probably do a followup to this article. This was written when I could not find any OVS packages. But now, OVS packages are available for CentOS 7 as part of the OpenStack distribution. This is probably the preferred method for OVS now.
yum install -y https://repos.fedorapeople.org/repos/openstack/openstack-kilo/rdo-release-kilo-1.noarch.rpm
yum install openvswitch openvswitch-test
Hi , I’m also stuck here ,
*** Adding links:
(h1, s1) (h2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
c0
*** Starting 1 switches
s1 …
*** Waiting for switches to connect
but ovs-vsctl show have Infomation
[stream@localhost ~]$ sudo ovs-vsctl show
88151a58-a657-4481-afae-d48a6b06b508
Bridge “s1”
Controller “ptcp:6654”
Controller “tcp:127.0.0.1:6653”
fail_mode: secure
Port “s1”
Interface “s1”
type: internal
Port “s1-eth2”
Interface “s1-eth2”
Port “s1-eth1”
Interface “s1-eth1”
ovs_version: “2.5.0”
Hello! I followed the steps u made it here.. but seems dat i have a small problem..
So when we start in “Build and Install OVS”
i tried to do this comands first..
wget http://openvswitch.org/releases/openvswitch-2.3.0.tar.gz
and i had a error.. so i had the idea do download the file and send it to the SOURCES directory and them i did
tar zxvf openvswitch-2.3.0.tar.gz
After dat.. i could follow the step cd openvswitch-2.3.0
But when i did seems to give me a error
rpmbuild -bb –without check rhel/openvswitch.spec
Error: File /root/rpmbuild/SOURCES/openvswitch-2.3.0.tar.gz: No such file or directory
Could u help me out?