Skip to content

Instantly share code, notes, and snippets.

@insom
Created April 3, 2017 00:43
Show Gist options
  • Save insom/f8e259a7bd867cdbebae81c0eaf49776 to your computer and use it in GitHub Desktop.
Save insom/f8e259a7bd867cdbebae81c0eaf49776 to your computer and use it in GitHub Desktop.
#!/bin/bash
modprobe ipv6
modprobe udp_tunnel
modprobe ip6_udp_tunnel
ip link add dev wg0 type wireguard
wg setconf wg0 /etc/wireguard/config
wg showconf wg0
brctl addbr internet
brctl stp internet on
ip link set up dev wg0
case $(uname -n) in
epsilon)
ip addr add 10.88.88.4/24 dev wg0
ip addr add 10.99.99.4/24 dev internet
ip link add vorke type vxlan remote 10.88.88.3 id 1 dstport 4789
ip link add bob type vxlan remote 10.88.88.1 id 2 dstport 4789
ip link add rho type vxlan remote 10.88.88.2 id 4 dstport 4789
;;
vorke)
ip addr add 10.88.88.3/24 dev wg0
ip addr add 10.99.99.3/24 dev internet
ip link add bob type vxlan remote 10.88.88.1 id 3 dstport 4789
ip link add epsilon type vxlan remote 10.88.88.4 id 1 dstport 4789
ip link add rho type vxlan remote 10.88.88.2 id 5 dstport 4789
;;
rho)
ip addr add 10.88.88.2/24 dev wg0
ip addr add 10.99.99.2/24 dev internet
ip link add epsilon type vxlan remote 10.88.88.4 id 4 dstport 4789
ip link add vorke type vxlan remote 10.88.88.3 id 5 dstport 4789
ip link add bob type vxlan remote 10.88.88.1 id 6 dstport 4789
ip link add pi0 type vxlan remote 10.88.88.5 id 7 dstport 4789
;;
bob)
ip addr add 10.88.88.1/24 dev wg0
ip addr add 10.99.99.1/24 dev internet
ip link add vorke type vxlan remote 10.88.88.3 id 3 dstport 4789
ip link add epsilon type vxlan remote 10.88.88.4 id 2 dstport 4789
ip link add rho type vxlan remote 10.88.88.2 id 6 dstport 4789
;;
pi0)
ip addr add 10.88.88.5/24 dev wg0
ip addr add 10.99.99.5/24 dev internet
ip link add rho type vxlan remote 10.88.88.2 id 7 dstport 4789
;;
esac
sysctl -w net.ipv6.conf.internet.disable_ipv6=0
sudo ip link set up dev internet
for i in epsilon bob vorke rho pi0; do
ip link set up $i
brctl addif internet $i
ethtool -K $i tx off
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment