Simple Setup: Two Hosts Connected to an L2 Switch
In this article, we will discuss the process of setting up a VXLAN overlay network for two hosts running Ubuntu 24.04, connected to an L2 switch. The following commands should be executed on both hosts, replacing `
Prerequisites
Before starting the setup, ensure that the following prerequisites are met:
- Both hosts are running Ubuntu 24.04
- Both hosts are connected to an L2 switch
- The VXLAN kernel module is loaded
Step 1: Install Required Packages
Install the following required packages on both hosts:
sudo apt-get update && sudo apt-get install -y vxlan
Step 2: Configure VXLAN Network Interfaces
Create a new VXLAN network interface on both hosts with the following command:
sudo ip link add name vxlan0 type vxlan id dev remote
Replace `
Enable the VXLAN network interface and set its IP address:
sudo ip link set vxlan0 up
sudo ip address add dev vxlan0 /
Replace `
Step 3: Configure Routing
Add a route to the VXLAN network on both hosts:
sudo ip route add / via dev vxlan0
Replace `
Step 4: Test Connectivity
Test connectivity between the two hosts using ping:
ping -c 4
Replace `` with the IP address of the remote host's VXLAN network interface.
- Installed required packages: vxlan
- Created a new VXLAN network interface on both hosts
- Enabled the VXLAN network interface and set its IP address
- Added a route to the VXLAN network on both hosts
- Tested connectivity between the two hosts