0

For those who don’t know - Mininet is a tool that allows for the automated creation of multiple OVS switches, chroot linux ‘containers’ as hosts and links them all together to prototype OVS powered networks.

I’m trying to create a slightly out of the box mininet environment and stuck with how mininet handles containers and networking. I understand that when you create a new host in mininet, a veth pair is created between the mininet instance and the ‘host’.

enter image description here

In this diagram, I’ve outlined the standard mininet behaviour in blue - the veth pair between the mininet instance and the host. I’m trying to create link inscribed in red, a veth pair between the mininet ‘host’ and the linux networking stack on the mininet server.

This scenario would allow me to run a controller on the host and communicate with the host mininet machine and the rest of the virtual network.

How would I go about creating a new veth pair between a chroot ‘container’ and the host machine?

Alex Turner
  • 313
  • 3
  • 10

1 Answers1

0

You can a new veth pair with the following commands.

#!/bin/bash
CONTAINERPID=$(get the pid of the container)
ip link add dev swport1 type veth peer h1-eth1
ip link set dev swport1 up
ip link set netns "${CONTAINERPID}" dev h1-eth1

This will created a 'downed' link in the container, which you will need to bring up inside of the container and add IP addresses etc to.

Matthew Ife
  • 22,927
  • 2
  • 54
  • 71