Skip to content

Instantly share code, notes, and snippets.

@nerdalert
Last active April 14, 2026 01:32
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

imroc commented Oct 8, 2022

Copy link
Copy Markdown

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

ccaapton commented Nov 24, 2023

Copy link
Copy Markdown

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
Copy Markdown
Author

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

@hjfxyz

hjfxyz commented Jan 9, 2024

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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