In this article, we would like to bridge a Mininet environments to the Internet.
The host OS in this article refers to the machine running Mininet. The simulated host in Mininet will be refered as Mininet host
- You have a Mininet environment with OVS
s1and the default interface of the host OS is
- IP address of
We could simply use
ovs-vsctl add-port s1 eth0 to attach
s1 to the Internet.
However, the host OS will be disconnected immediately after you add
The host OS should use
s1 instead of
eth0 as its default gateway.
That is, after adding
s1, we need to:
- Remove the IP configuration on
- Add the IP address to
- Reconfigure default route of the host OS
This can be done by following commands:
If you are using Mininet through an SSH session, you need to finish these commands at once. Otherwise you will be disconnected during the process. This can be easily done by writing and using above-mentioned shell scripts.
Thank Ta-Ching Chen for the solution.