Skip to content

Instantly share code, notes, and snippets.

@chenchun
Last active August 21, 2019 07:29
Show Gist options
  • Save chenchun/678ef870e99904da7dc243fdcaa71c12 to your computer and use it in GitHub Desktop.
Save chenchun/678ef870e99904da7dc243fdcaa71c12 to your computer and use it in GitHub Desktop.
setup unicast vxlan on two hosts
## 10.2.0.3
ip link add vxlan0 type vxlan id 2 dev eth1 dstport 8472
ip link set dev vxlan0 address 72:74:8b:9d:56:e4
ip link set dev vxlan0 up
ip ad add 192.168.50.1/24 dev vxlan0
vxlan_dev=vxlan0
peer_vxlan_mac=3e:33:f7:c5:a3:5b
peer_vxlan_ip=192.168.50.2
peer_host_ip=10.2.0.2
ip neigh add $peer_vxlan_ip lladdr $peer_vxlan_mac dev $vxlan_dev nud permanent
bridge fdb add to $peer_vxlan_mac dst $peer_host_ip dev $vxlan_dev
## 10.2.0.2
ip link add vxlan0 type vxlan id 2 dev eth1 dstport 8472
ip link set dev vxlan0 address 3e:33:f7:c5:a3:5b
ip link set dev vxlan0 up
ip ad add 192.168.50.2/24 dev vxlan0
vxlan_dev=vxlan0
peer_vxlan_mac=72:74:8b:9d:56:e4
peer_vxlan_ip=192.168.50.1
peer_host_ip=10.2.0.3
ip neigh add $peer_vxlan_ip lladdr $peer_vxlan_mac dev $vxlan_dev nud permanent
bridge fdb add to $peer_vxlan_mac dst $peer_host_ip dev $vxlan_dev
ip neigh show dev vxlan0
bridge fdb show dev vxlan0
ip ad show dev vxlan0
ip -d link show dev vxlan0
netstat -apn | grep udp
ip link del vxlan0
# on 10.2.0.3
ping 192.168.50.2
tcpdump -nnvveSXs 0 -T vxlan -i any port 8472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment