Repository : ssh://git@open-mesh.org/doc
On branches: backup-redmine/2018-08-24,backup-redmine/2019-09-14,master
commit d8cab567ceb535dd435e76c7b44c5916e2d14aae Author: Sven Eckelmann sven@narfation.org Date: Sun Aug 12 15:56:24 2018 +0000
doc: open-mesh/hub-gluon.sh
d8cab567ceb535dd435e76c7b44c5916e2d14aae open-mesh/hub-gluon.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
diff --git a/open-mesh/hub-gluon.sh b/open-mesh/hub-gluon.sh new file mode 100644 index 0000000..0cf694f --- /dev/null +++ b/open-mesh/hub-gluon.sh @@ -0,0 +1,42 @@ +#! /bin/sh +USER="$(whoami)" +BRIDGE=br0 +ETH=enp10s0 +VXLAN=vx_mesh_lan +# calculated on gluon node via: lua -lgluon.util -e 'print(tonumber(gluon.util.domain_seed_bytes("gluon-mesh-vxlan", 3), 16))' +VXLAN_ID=12094920 + + +xor2() { + echo -n "${1:0:1}" + echo -n "${1:1:1}" | tr '0123456789abcdef' '23016745ab89efcd' +} + +interface_linklocal() { + local macaddr="$(cat /sys/class/net/"${ETH}"/address)" + local oldIFS="$IFS"; IFS=':'; set -- $macaddr; IFS="$oldIFS" + + echo "fe80::$(xor2 "$1")$2:$3ff:fe$4:$5$6" +} + +sudo ip link add "${BRIDGE}" type bridge +for i in `seq 1 5`; do + sudo ip tuntap add dev tap$i mode tap user "$USER" + sudo ip link set tap$i up + sudo ip link set tap$i master "${BRIDGE}" +done + +sudo ip link set "${BRIDGE}" up + +sudo ip link del "${VXLAN}" +sudo ip -6 link add "${VXLAN}" type vxlan \ + id "${VXLAN_ID}" \ + dstport 4789 \ + local fe80::1ee9:9241:425b:7590 \ + group ff02::15c \ + dev "${ETH}" \ + udp6zerocsumtx udp6zerocsumrx \ + ttl 1 + +sudo ip link set "${VXLAN}" up master "${BRIDGE}" +sudo ip addr replace 192.168.2.1/24 dev "${BRIDGE}"