Make sure Raspberry pi is connected to the internet.
$ sudo apt-get install openvswitch-switch
- Check whether OVS is properly installed in Raspberry Pi. To check run the command below
$ ovs-vsctl add-br ovs-br1
- Using DHCP server: If raspberry pi is able to get IP address from some DHCP server and a IP will be assigned to raspberry pi.
- Assigning Static IP address:
$ sudo vim /etc/dhcpcd.conf
- Insert the details below in /etc/dhcpcd.conf file. Change the parameters according to your network.
interface eth0
static ip_address=192.168.1.4/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
$ ovs-vsctl set-controller <BRIDGE> tcp:$CONTROLLER_ADDRESS:$CONTROLLER_PORT
For assinging multiple controllers to OVS:
$ ovs-vsctl set-controller <BRIDGE> tcp:$CONTROLLER_ADDRESS1:$CONTROLLER_PORT1 \
tcp:$CONTROLLER_ADDRESS2:$CONTROLLER_PORT2 \
tcp:$CONTROLLER_ADDRESS3:$CONTROLLER_PORT3 ...
- Creating a bridge
$ sudo ovs-vsctl add-br <BRIDGE_NAME>
When a bridge is created using OVS, by default a port of same name is created i.e when a bridge named br0 is created so port named br0 is created and it has interface br0.
- Connecting bridge to eth0
$ sudo ovs-vsctl add-port <BRIDGE_NAME> eth0
- Adding a new port, Internal Interface to an existing bridge
$ sudo ovs-vsctl add-port <BRIDGE_NAME> <PORT_NAME> -- set Interface <PORT_NAME> type=internal
$ sudo ip link set <PORT_NAME> up
or
$ sudo ifconfig <PORT_NAME> up
- Adding an IP address to an Interface
$ sudo ip addr add 192.168.0.123/24 dev <PORT_NAME>
or
$ sudo ifconfig <PORT_NAME> 192.168.0.123 netmask 255.255.255.0
- Adding default gateway to an Interface
$ sudo ip route add default via <GW> dev <Interface>
- Removing an IP address assigned to an Interface
$ sudo ifconfig <PORT_NAME> 0
- Listing all Interfaces
$ sudo ovs-vsctl list Interface
Use this link for installing and starting OpenVirteX.