#!/bin/sh set -e batctl meshif ${BATMAN_INTERFACE} interface create ip link add ${BATMAN_BRIDGE} type bridge ip link set ${BATMAN_INTERFACE} master ${BATMAN_BRIDGE} ip link set ${BATMAN_INTERFACE} up ip link set ${BATMAN_BRIDGE} up # setup ips if [ "${BATMAN_BRIDGE_IPV4}" ] ; then ip -4 addr add ${BATMAN_BRIDGE_IPV4} dev ${BATMAN_BRIDGE} fi if [ "${BATMAN_BRIDGE_IPV6}" ] ; then ip -6 addr add ${BATMAN_BRIDGE_IPV6} dev ${BATMAN_BRIDGE} fi # mark node as dhcp server batctl meshif ${BATMAN_INTERFACE} gw server ${BATMAN_LIMIT_DOWNLOAD}Mbit/${BATMAN_LIMIT_UPLOAD}Mbit # configure routing ip rule add iif ${BATMAN_BRIDGE} table ${BATMAN_FORWARD_TABLE} [ "${BATMAN_FORWARD_GATEWAY4}" ] && \ ip -4 route add table ${BATMAN_FORWARD_TABLE} default via ${BATMAN_FORWARD_GATEWAY4} [ "${BATMAN_FORWARD_GATEWAY6}" ] && \ ip -6 route add table ${BATMAN_FORWARD_TABLE} default via ${BATMAN_FORWARD_GATEWAY6} nft add rule nat POSTROUTING counter masquerade while true ; do sleep 1 done