Skip to content

Instantly share code, notes, and snippets.

@nerdalert
Last active January 9, 2024 10:42
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nerdalert/5276aeaf04cb730b21be1929ab6905a4 to your computer and use it in GitHub Desktop.
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

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