From 0bf5a319540a244b2e35721437737efa2af8229a Mon Sep 17 00:00:00 2001 From: seantywork Date: Wed, 10 Dec 2025 13:57:29 +0000 Subject: [PATCH] ovs --- README.md | 37 +++++++++++++++++++++++++++++++++++++ ovs/.gitignore | 1 + ovs/install.sh | 18 ++++++++++++++++++ ovs/start.sh | 11 +++++++++++ ovs/test.sh | 31 +++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 ovs/.gitignore create mode 100755 ovs/install.sh create mode 100755 ovs/start.sh create mode 100755 ovs/test.sh diff --git a/README.md b/README.md index c144659..a38203e 100644 --- a/README.md +++ b/README.md @@ -3046,6 +3046,43 @@ conntrack -D -p tcp --dport 993 ``` +# OPENVSWITCH OVS + +```shell + +sudo apt update +sudo apt install build-essential make autoconf libtool +git clone https://github.com/openvswitch/ovs.git + +cd ovs + +git switch -c myovs origin/branch-3.6 + +./boot.sh + +./configure + +make + +sudo make install +``` + +```shell +# create, add +sudo ovs-vsctl add-br ovs-br0 + +sudo ovs-vsctl add-port ovs-br0 veth11 + +sudo ovs-vsctl add-port ovs-br0 veth21 + +sudo ip link set up veth11 + +sudo ip link set up veth21 + +sudo ip link set ovs-br0 up + +``` + # FIREWALL diff --git a/ovs/.gitignore b/ovs/.gitignore new file mode 100644 index 0000000..e055b0a --- /dev/null +++ b/ovs/.gitignore @@ -0,0 +1 @@ +ovs \ No newline at end of file diff --git a/ovs/install.sh b/ovs/install.sh new file mode 100755 index 0000000..778f4bd --- /dev/null +++ b/ovs/install.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +sudo apt update +sudo apt install build-essential make autoconf libtool +git clone https://github.com/openvswitch/ovs.git + +cd ovs + +git switch -c myovs origin/branch-3.6 + +./boot.sh + +./configure + +make + +sudo make install + diff --git a/ovs/start.sh b/ovs/start.sh new file mode 100755 index 0000000..0a394ab --- /dev/null +++ b/ovs/start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mkdir -p /usr/local/etc/openvswitch + +sudo ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema + +sudo /usr/local/share/openvswitch/scripts/ovs-ctl start + +sudo ovs-vsctl --no-wait init + +# sudo ovs-vswitchd --pidfile --detach --log-file \ No newline at end of file diff --git a/ovs/test.sh b/ovs/test.sh new file mode 100755 index 0000000..e266f49 --- /dev/null +++ b/ovs/test.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +sudo ovs-vsctl add-br ovs-br0 + +sudo ip netns add net1 + +sudo ip netns add net2 + +sudo ip link add dev veth11 type veth peer name veth12 netns net1 + +sudo ip link add dev veth21 type veth peer name veth22 netns net2 + +sudo ovs-vsctl add-port ovs-br0 veth11 + +sudo ovs-vsctl add-port ovs-br0 veth21 + +sudo ip netns exec net1 ip addr add 192.168.64.12/24 dev veth12 + +sudo ip netns exec net2 ip addr add 192.168.64.22/24 dev veth22 + +sudo ip netns exec net1 ip link set veth12 up + +sudo ip netns exec net1 ip link set veth22 up + +sudo ip link set up veth11 + +sudo ip link set up veth21 + +sudo ip link set ovs-br0 up + +sudo sysctl -w net.ipv4.ip_forward=1 \ No newline at end of file -- 2.43.0