Created
July 4, 2019 17:39
-
-
Save filiperfernandes/826b94912a6e59bf74b4648a8347ec81 to your computer and use it in GitHub Desktop.
PiOVS - Setup Raspberry pi as OpenvSwitch
This file contains hidden or 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
#!/bin/bash | |
# Usage: | |
# ./load-openvswitch [ip-address-of-eth0] [default-gateway-ip-address] | |
# Example: | |
# ./load-openvswitch 192.168.1.10 192.168.1.1 | |
sudo ifconfig ovsbr0 up | |
sudo ifconfig eth1 up | |
sudo ifconfig eth2 up | |
sudo ifconfig eth0 0 && sudo ifconfig ovsbr0 $1 netmask 255.255.255.0 | |
sudo route add default gw $2 ovsbr0 | |
sudo route del default gw $2 eth0 |
This file contains hidden or 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
#!/bin/bash | |
# Flash Ubuntu Server IOT Image to Rpi | |
# Ssh to rpi; host may vary; User:Pw -> ubuntu:ubuntu | |
ssh [email protected] | |
# Update and upgrade | |
sudo apt update && sudo apt upgrade -y | |
# | |
sudo apt install openvswitch-switch openvswitch-common bridge-utils | |
sudo ovs-vsctl add-br ovsbr0 | |
sudo ifconfig ovsbr0 up | |
# Add the number of desired ports (Must have same number of USB-Ethernet adapters) | |
sudo ovs-vsctl add-port ovsbr0 eth1 | |
sudo ovs-vsctl add-port ovsbr0 eth2 | |
sudo ovs-vsctl add-port ovsbr0 eth3 | |
sudo ifconfig eth1 up | |
sudo ifconfig eth2 up | |
sudo ifconfig eth3 up | |
# Set controller (Host and port may vary; common ports 6653 or 6633) | |
sudo ovs-vsctl set-controller ovsbr0 tcp:localhost:6653 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment