Right, now what? :)

So I've heard about vxlan, lots of talk about it, kind of knew what it actually was never really found it .. tempting ..

But I figured I'd better try it and see. So I wanted to do something silly as the first thing.

First configured it between two servers

server A - FreeBSD

ifconfig vxlan40 vxlanid 40 vxlanlocal 192.0.2.1 vxlanremote 192.0.2.2
ifconfig vxlan40 inet 172.16.40.1/24

server B - FreeBSD

ifconfig vxlan40 vxlanid 40 vxlanlocal 192.0.2.2 vxlanremote 192.0.2.1
ifconfig vxlan40 inet 172.16.40.2/24

testing it

zsh 1902 % ping -c 5 172.16.40.2
PING 172.16.40.2 (172.16.40.2): 56 data bytes
64 bytes from 172.16.40.2: icmp_seq=0 ttl=64 time=0.058 ms
64 bytes from 172.16.40.2: icmp_seq=1 ttl=64 time=0.057 ms
64 bytes from 172.16.40.2: icmp_seq=2 ttl=64 time=0.053 ms
64 bytes from 172.16.40.2: icmp_seq=3 ttl=64 time=0.185 ms
64 bytes from 172.16.40.2: icmp_seq=4 ttl=64 time=0.047 ms

--- 172.16.40.2 ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.047/0.080/0.185/0.053 ms

Ehm, that was a lot easier than I really thought it would be, so I wanted to up the ante since I'd heard it could do multicast.

First I'd need to be "smart" about picking the multicast group, something in 239.0.0.0/8 seems like the right thing to do, and there's a fairly simple way to convert from a VNI to MCAST-GROUP using the magic of zsh.

function vni-to-mcast {
  hex=$(printf "%06x" $1)
  printf "239"
  for pos in 1-2 3-4 5-6; do
    printf ".%d" "0x`echo "${hex}" | cut -c ${pos}`"
  done
  printf "\n"
}

Using it is fairly straight forward.

% vni-to-mcast 11
239.0.0.11

What a boring multicast group ;-)

Host A - FreeBSD in rc.conf

sysrc cloned_interfaces="vxlan11"
sysrc create_args_vxlan11="vxlanid 11 vxlandev nfe0 vxlanlocal 192.0.2.10 vxlangroup 239.0.0.11"
sysrc ifconfig_vxlan11="inet 172.16.11.2/24"
/etc/rc.d/netif start vxlan11

Host B - FreeBSD in rc.conf

sysrc cloned_interfaces="vxlan11"
sysrc create_args_vxlan11="vxlanid 11 vxlandev nfe0 vxlanlocal 192.0.2.6 vxlangroup 239.0.0.11"
sysrc ifconfig_vxlan11="inet 172.16.11.1/24"
/etc/rc.d/netif start vxlan11

Host C - Ubuntu

ip link add vxlan11 type vxlan id 11 dev eno1 group 239.0.0.11 dstport 4789 local 192.0.2.19
ip link set vxlan11 up
ip add add 172.16.11.4/24 dev vxlan11

And then from the ubuntu,

% ping -c 5 172.16.11.2
PING 172.16.11.2 (172.16.11.2) 56(84) bytes of data.
64 bytes from 172.16.11.2: icmp_seq=1 ttl=64 time=8.90 ms
64 bytes from 172.16.11.2: icmp_seq=2 ttl=64 time=8.98 ms
64 bytes from 172.16.11.2: icmp_seq=3 ttl=64 time=8.93 ms
64 bytes from 172.16.11.2: icmp_seq=4 ttl=64 time=8.56 ms
64 bytes from 172.16.11.2: icmp_seq=5 ttl=64 time=7.14 ms

--- 172.16.11.2 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 7.142/8.506/8.983/0.705 ms

Comments

comments powered by Disqus