Skip to content

Instantly share code, notes, and snippets.

@nerdalert
Last active January 22, 2026 03:26
Show Gist options
  • Select an option

  • Save nerdalert/5276aeaf04cb730b21be1929ab6905a4 to your computer and use it in GitHub Desktop.

Select an option

Save nerdalert/5276aeaf04cb730b21be1929ab6905a4 to your computer and use it in GitHub Desktop.

Geneve tunnels using netlink examples

Scenario A - pointing to an interface as the next hop

Host A configuration (eth0 - 192.168.1.191):

# Remote Address is the IP of Host B eth0
sudo ip link add name geneve0 type geneve id 1000 remote 192.168.1.192
sudo ip link set geneve0 up
sudo ip addr add 10.200.1.1/32 dev geneve0
sudo ip route add 10.200.2.1/32 dev geneve0

Host B configuration (eth0 - 192.168.1.192):

# Remote Address is the IP of Host A eth0
sudo ip link add name geneve0 type geneve id 1000 remote 192.168.1.191
sudo ip link set geneve0 up
sudo ip addr add 10.200.2.1/32 dev geneve0
sudo ip route add 10.200.1.1/32 dev geneve0

Verify connectivity between geneve0 interfaces

# On host A
ping 10.200.2.1
# On host B
ping 10.200.1.1

Scenario B - pointing to an ip as the next hop with the geneve tunnels on the same broadcast domain

Host A configuration (eth0 - 192.168.1.191):

# Remote Address is the IP of Host B eth0
sudo ip link add name geneve0 type geneve id 1000 remote 192.168.1.192
sudo ip link set geneve0 up
sudo ip addr add 10.200.1.1/30 dev geneve0

Host B configuration (eth0 - 192.168.1.192):

# Remote Address is the IP of Host A eth0
sudo ip link add name geneve0 type geneve id 1000 remote 192.168.1.191
sudo ip link set geneve0 up
sudo ip addr add 10.200.1.2/30 dev geneve0

Verify connectivity between geneve0 interfaces

# On host A
ping 10.200.1.2
# On host B
ping 10.200.1.1
@imroc
Copy link

imroc commented Oct 8, 2022

Tha last part:

# On host A
ping 10.200.2.2
# On host B
ping 10.200.2.1

should be changed to:

# On host A
ping 10.200.1.2
# On host B
ping 10.200.1.1

@ccaapton
Copy link

ccaapton commented Nov 24, 2023

How to modify the default udp port used by geneve? I saw a dstport option in the configuration fields, but not srcport.

@nerdalert
Copy link
Author

Yeah, doesn't look supported. Could always SNAT if you had to set the src port ¯\(ツ)

@hjfxyz
Copy link

hjfxyz commented Jan 9, 2024

Hello, my operating system is Debian. Can you teach me how to write the configuration to/etc/network/interfaces persistence?Thank you

cat > /etc/network/interfaces <<EOF
up ip link add name gen0 type geneve id 1000 remote 192.168.1.192
up ip link set dev gen0 up
up ip addr add 10.200.1.1/30 dev gen0
EOF

But not elegant enough

@rajeshrah22
Copy link

For scenario A, I was using 2 VMs as hosts on a Fedora laptop. I had to enable udp port 6081 in firewalld on both servers. Did not need to touch the host (laptop) firewall rules as it by default allows communication between VMs in the virtual network.

Thanks for this, I was able to get started with learning about geneve.

@rajeshrah22
Copy link

https://gist.github.com/rajeshrah22/bda1183f74ab078589fc5c6d78b34715
For an example with network namespaces within one host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment