Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Environment Setup

Option 1 (recommended): Mininet VM Image

  1. Download the Mininet VM image:
  1. Install a virtualization platform (free options):

Other options: Install Mininet on Ubuntu (source or packages)

Mininet download page:

Install from source (example):

git clone https://github.com/mininet/mininet
cd mininet
git tag  # list available versions
git checkout -b mininet-2.3.0 2.3.0  # choose a version
cd ..
mininet/util/install.sh -a

Quick sanity check (Mininet + OVS):

sudo mn --switch ovsbr --test pingall
ovs-vsctl --version   # check Open vSwitch

Install SDN controller software (Ryu)

For OpenFlow 1.3 labs, we use Ryu.

Simple install:

pip install ryu

If you hit Python version or dependency issues (common on Ubuntu with old eventlet), use uv to create an isolated Python 3.8 environment and install a known-good Ryu build:

sudo apt update
sudo apt install -y python3.8 python3.8-venv python3.8-dev curl

curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv --python 3.8
source .venv/bin/activate

uv pip install "pip<24" "setuptools<61" wheel pbr
uv pip install "eventlet==0.30.2"
uv pip install --no-build-isolation "git+https://github.com/faucetsdn/ryu@v4.34"

Launch Ryu and test the OpenFlow control plane

Important:

The Mininet command below uses a remote controller at 127.0.0.1:6653.

If Ryu is not running (nothing listening on port 6653), OVS switches cannot receive flow rules, and pingall will NOT work.

Terminal 1: start Ryu (OpenFlow port: 6653)

source .venv/bin/activate
ryu-manager ryu.app.simple_switch_13

Terminal 2: start Mininet and connect to the remote controller

ss -lntp | grep 6653

sudo mn --switch ovs,protocols=OpenFlow13 \
  --controller remote,ip=127.0.0.1,port=6653

In the Mininet CLI:

pingall

In-class exercise: inspect OpenFlow flow table

Dump flows (OpenFlow 1.3):

mininet> sh ovs-ofctl -O OpenFlow13 dump-flows s1

Example output:

mininet> sh ovs-ofctl -O OpenFlow13 dump-flows s1
 cookie=0x0, duration=25.182s, table=0, n_packets=4, n_bytes=336, priority=1,in_port="s1-eth2",dl_src=4e:f3:02:b2:8a:6f,dl_dst=0e:aa:99:2a:6f:16 actions=output:"s1-eth1"
 cookie=0x0, duration=25.180s, table=0, n_packets=3, n_bytes=238, priority=1,in_port="s1-eth1",dl_src=0e:aa:99:2a:6f:16,dl_dst=4e:f3:02:b2:8a:6f actions=output:"s1-eth2"
 cookie=0x0, duration=53.549s, table=0, n_packets=3, n_bytes=182, priority=0 actions=CONTROLLER:65535

Explain the meaning of the flow dump output (match fields, priority, counters, actions), e.g.:

  • table, priority
  • in_port, dl_src, dl_dst
  • actions=output:
  • packet/byte counters (n_packets, n_bytes)
  • the default rule sending packets to controller (actions=CONTROLLER:...)

Homework

Build a fat-tree topology and answer these questions:

  • Can you write a Python script to generate a fat-tree topology in Mininet?
  • Can you write a Ryu controller application to route packets in the fat-tree topology?
  • Can you implement ECMP routing in Ryu controller?

Tips:

  • Fat-tree topology: use a parameter k, create pods, and add edge/aggregation/core switches with a consistent naming scheme; link edge<->agg within a pod and agg<->core across pods.
  • Mininet: subclass Topo or build with Mininet() directly, then addSwitch/addHost/addLink with deterministic port mapping.
  • Ryu routing: install a table-miss flow, learn host locations from ARP/IP PacketIn, discover links via ryu.topology.switches, and compute shortest paths between edge switches.
  • Flow rules: match IPv4 dst and output to next hop port; proactively install for known destinations to avoid flooding.
  • ECMP: use OpenFlow 1.3 group type SELECT with multiple buckets (each bucket outputs to a different next hop); keep hashing per-flow (e.g., 5-tuple) consistent.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages