Skip to content

Instantly share code, notes, and snippets.

@elico
Last active July 15, 2024 23:02
Show Gist options
  • Save elico/bb51c4b7b3edc83c6f804170090752b6 to your computer and use it in GitHub Desktop.
Save elico/bb51c4b7b3edc83c6f804170090752b6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
apk update
apk add openvswitch openvswitch-bash-completion bash bash-completion openvswitch-doc openvswitch-openrc vim tcpdump ruby ruby-rdoc git
sed -i -e "s@mouse\=a@mouse=r@g" /usr/share/vim/vim*/defaults.vim
grep "mouse=a" /usr/share/vim/vim*/defaults.vim
grep "auto switch0" /etc/network/interfaces >/dev/null
RES="$?"
if [ "${RES}" -gt "0" ]
then
cat <<EOF >> /etc/network/interfaces
auto eth1
iface eth1 inet manual
auto eth2
iface eth2 inet manual
auto eth3
iface eth3 inet manual
auto eth4
iface eth4 inet manual
auto eth5
iface eth5 inet manual
auto eth6
iface eth6 inet manual
auto eth7
iface eth7 inet manual
auto eth8
iface eth8 inet manual
auto eth9
iface eth9 inet manual
auto eth10
iface eth10 inet manual
auto eth11
iface eth11 inet manual
auto eth12
iface eth12 inet manual
auto eth13
iface eth13 inet manual
auto eth14
iface eth14 inet manual
auto eth15
iface eth15 inet manual
auto eth16
iface eth16 inet manual
auto eth17
iface eth17 inet manual
auto eth18
iface eth18 inet manual
auto eth19
iface eth19 inet manual
auto eth20
iface eth20 inet manual
auto eth21
iface eth21 inet manual
auto eth22
iface eth22 inet manual
auto eth23
iface eth23 inet manual
auto switch0
iface switch0 inet manual
EOF
fi
rc-update add ovs-modules
rc-update add ovsdb-server
rc-update add ovs-vswitchd
rc-service ovs-modules start
rc-service ovsdb-server start
rc-service ovs-vswitchd start
###
ovs-vsctl add-br switch0
ovs-vsctl set bridge switch0 stp_enable=true
###
ovs-vsctl add-port switch0 eth1
ovs-vsctl add-port switch0 eth2
ovs-vsctl add-port switch0 eth3
ovs-vsctl add-port switch0 eth4
ovs-vsctl add-port switch0 eth5
ovs-vsctl add-port switch0 eth6
ovs-vsctl add-port switch0 eth7
ovs-vsctl add-port switch0 eth8
ovs-vsctl add-port switch0 eth9
ovs-vsctl add-port switch0 eth10
ovs-vsctl add-port switch0 eth11
ovs-vsctl add-port switch0 eth12
ovs-vsctl add-port switch0 eth13
ovs-vsctl add-port switch0 eth14
ovs-vsctl add-port switch0 eth15
ovs-vsctl add-port switch0 eth16
ovs-vsctl add-port switch0 eth17
ovs-vsctl add-port switch0 eth18
ovs-vsctl add-port switch0 eth19
ovs-vsctl add-port switch0 eth20
ovs-vsctl add-port switch0 eth21
ovs-vsctl add-port switch0 eth22
ovs-vsctl add-port switch0 eth23
###
ifup eth1
ifup eth2
ifup eth3
ifup eth4
ifup eth5
ifup eth6
ifup eth7
ifup eth8
ifup eth9
ifup eth10
ifup eth11
ifup eth12
ifup eth13
ifup eth14
ifup eth15
ifup eth16
ifup eth17
ifup eth18
ifup eth19
ifup eth20
ifup eth21
ifup eth22
ifup eth23
ifup switch0
###
ovs-vsctl list-br
ovs-vsctl list-ports switch0
ovs-vsctl show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment