Skip to content

Instantly share code, notes, and snippets.

@djoreilly
Created February 17, 2020 10:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save djoreilly/6a87032f4658e8080cc8666c3befac2c to your computer and use it in GitHub Desktop.
Save djoreilly/6a87032f4658e8080cc8666c3befac2c to your computer and use it in GitHub Desktop.
Linux VxLAN performance test setup script
#!/bin/bash
set -xe
# $0 host dev remote_ip
# host is 1 or 2
# on vmA
# ./mk-vx.sh 1 ens3 10.10.10.9
# on vmB
# ./mk-vx.sh 2 ens3 10.10.10.15
if [[ $# -ne 3 ]]; then
echo "Usage: $0 <1|2> <base-interface> <remote-tunnel-ip>"
exit
fi
H=$1
OH=$((3 - H))
# mac for vxlan interface
MAC=2a:c2:d3:00:00:0$H
O_MAC=2a:c2:d3:00:00:0$OH
DEV=$2
# ip for vxlan interface
INNER_IP=192.168.0.$H
REMOTE_IP=$3
REMOTE_INNER=192.168.0.$OH
ip link del vxlan42 || true
ip link add vxlan42 type vxlan id 42 dstport 4789 nolearning dev $DEV proxy udpcsum
#ip link add vxlan42 type vxlan id 42 dstport 4789 nolearning dev $DEV proxy udpcsum remcsumtx remcsumrx
#ip link add vxlan42 type vxlan id 42 dstport 4789 nolearning dev $DEV proxy noudpcsum
#ip link add vxlan42 type vxlan id 42 dstport 4747 nolearning dev $DEV proxy udpcsum
ip link set address $MAC vxlan42
ip neigh add $REMOTE_INNER lladdr $O_MAC dev vxlan42
bridge fdb append $O_MAC dev vxlan42 dst $REMOTE_IP
ip address add ${INNER_IP}/29 dev vxlan42
ip link set vxlan42 up
ip -d link show vxlan42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment