Open Vswitch Remotely Connect 2 Computers

We can remotely connect 2 computer together through cloud using ovs (OpenVSwitch)

Do the following:

Server

First, install openvswitch. We will use this server as a switch

sudo apt install openvswitch-switch

Next Add vxlan port

*ip* link add vxlan0 type vxlan id 10

Number 10 here is the VLAN Tagging of id 10

sudo ovs-vsctl add-port br0 vxlan0

Add vxlan0 to virtual bridge br0

sudo ovs-vsctl set interface vxlan0 type=vxlan options:remote_ip=<PC1_IP> options:key=10

Confirm with sudo ovs-vsctl show

We do another one for vxlan1 since 1 port per computer

sudo ovs-vsctl set interface vxlan1 type=vxlan options:remote_ip=<PC1_IP> options:key=10

Note: the PC1_IP and PC2_IP is not the vxlan ip we assign below but rather reachable default interface that Server can talk to PC1 and PC2

Pasted image 20250331224406.png

PC1

Create the vxlan interface

sudo ip link add vxlan0 type vxlan id 10 remote <SERVER_IP> dstport 4789
sudo ip link set vxlan0 up
sudo ip addr add 192.168.3.2/24 dev vxlan0

This will assign an abitrary ip address to vxlan0

Confirm the setting

ip addr show vxlan0

PC2

Create the vxlan interface

sudo ip link add vxlan0 type vxlan id 10 remote <SERVER_IP> dstport 4789
sudo ip link set vxlan0 up
sudo ip addr add 192.168.3.3/24 dev vxlan0

This will assign an abitrary ip address to vxlan0

Confirm the setting

ip addr show vxlan0

Ping 2 pc

PC1: ping 192.168.3.3
PC2: ping 192.168.3.2

They all should work now