This page looks best with JavaScript enabled

Some VXLAN stuff so I don't forget how it works

 ·  ☕ 2 min read

Just like my network namespace post, this post is going to be a basic cheat sheet for me so I don’t have to endlessly Google stuff for ages in case I need to use VXLANs again.

What is a VXLAN

Thta’s just a like a VLAN, essentially an overlay network that is not limited to 4000 IDs. It also has some nice features such as auto discovery of peers via broadcast on the same network.

Create a unicast vxlan interface

You can create a vxlan interface like so

1
2
3
$ ip link add name vx-0 type vxlan id 69 dev <IFACE> remote <REMOTE_IP> local <LOCAL_IP> dstport <PORT>
$ ip address add 10.69.0.1/24 dev vx-0
$ ip link set up dev vx-0

And mirror on the other host. Note that

  • IFACE is the “parent” interface of the VXLAN interface, it should be the interface you will use to
    communicate with the NUC.
  • REMOTE_IP is the IP of the remote vxlan endpoint, not on the overlay network (so like your LAN IP)
  • LOCAL_IP is the same but for your local machine
  • PORT is the port you will send packets to

It is worth noting you can just omit local IP dstport PORT the kernel should figure it out.

You can also bridge the interface like so:

1
2
3
4
5
6
$ ip link add name vx-0 type vxlan id 69 dev <IFACE> remote <REMOTE_IP> local <LOCAL_IP> dstport <PORT>
$ ip link add br-vx-0 type bridge
$ ip address add 10.69.0.1/24 dev br-vx-0
$ ip link set master br-vx-0 dev vx-0
$ ip link set up dev br-vx-0
$ ip link set up dev vx-0

More readings

[1] VXLAN practice
[2] Multiple unicast peers
[3] VXLAN guide by Vincent Bernat


Thomas
WRITTEN BY
Thomas
I am a Site Reliability Engineer, currently working from London. I hate that I like computers. I try to post potentially useful stuff from time to time.