summaryrefslogtreecommitdiffstats
path: root/examples/test-net0.sh
blob: fa3a37ea608815b247a5d062d291fb0f0299181a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
ifname="${1:-wg0}"
host="${2:-ap1}"

ip link add dev $ifname type wireguard > /dev/null 2>&1

# [ "$ifname" != "net0" ] && ln -sf net0.bin "${ifname}.bin"

../unetd -D $PWD -d -h $PWD/hosts -N '{
	"name": "'"$ifname"'",
	"type": "dynamic",
	"auth_key": "'"$(cat ./net0.pub)"'",
	"key": "'"$(cat ./net0-${host}.key)"'",
	"file": "'"$PWD/net0.json"'",
	"tunnels": {
		"vx0": "l2-tunnel"
	},
	"peer_data": [ "'"$PWD/net0.peers"'" ],
	"update-cmd": "'"$PWD/../scripts/update-cmd.pl"'"
}'