-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openvswitch - fix multiple issues, ref #885
- Loading branch information
Bernhard Ehlers
committed
May 14, 2024
1 parent
1e210bf
commit 867d9df
Showing
6 changed files
with
75 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Docker Open vSwitch for GNS3 | ||
|
||
This creates a container for using Open vSwitch in GNS3. | ||
|
||
This container supports ethernet interfaces and comes | ||
with bridges from br0 to br3. | ||
|
||
By default, all interfaces are connected to br0. | ||
|
||
If you set the `MANAGEMENT_INTERFACE` environment variable to | ||
an interface name, that interface will not be connected to br0. | ||
|
||
|
||
## Building the container | ||
|
||
``` | ||
docker build -t gns3/openvswitch . | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (C) 2024 GNS3 Technologies Inc. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
firstrun=0 | ||
[ -f "/etc/openvswitch/conf.db" ] || firstrun=1 | ||
|
||
if [ $firstrun -ne 0 ]; then | ||
# create database | ||
ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema | ||
fi | ||
|
||
# start openvswitch daemons | ||
mkdir -p /var/log/openvswitch /var/run/openvswitch | ||
ovsdb-server --detach --pidfile --remote=punix:/var/run/openvswitch/db.sock \ | ||
--log-file --verbose=off:syslog | ||
ovs-vswitchd --detach --pidfile --log-file --verbose=off:syslog | ||
|
||
if [ $firstrun -ne 0 ]; then | ||
ovs-vsctl --no-wait init | ||
|
||
# create br0..br3 | ||
for intf in br0 br1 br2 br3; do | ||
ovs-vsctl add-br $intf | ||
ovs-vsctl set bridge $intf datapath_type=netdev | ||
done | ||
|
||
# add all ethernet interfaces to br0, except MANAGEMENT_INTERFACE | ||
[ "$MANAGEMENT_INTERFACE" = 1 ] && MANAGEMENT_INTERFACE=eth0 | ||
sed -n 's/^ *\(eth[0-9]*\): .*/\1/p' /proc/net/dev | sort -V | \ | ||
while read -r intf; do | ||
[ "$intf" = "$MANAGEMENT_INTERFACE" ] || ovs-vsctl add-port br0 "$intf" | ||
done | ||
fi | ||
|
||
# activate br0..br3 | ||
for intf in br0 br1 br2 br3; do | ||
ip link set dev $intf up | ||
done |