[Unit] Description=Batman gateway creation After=network.target sys-subsystem-net-devices-wlan0.device Wants=network.target sys-subsystem-net-devices-wlan0.device [Service] Type=oneshot RemainAfterExit=yes ExecStartPre=/sbin/sysctl -w net.ipv4.ip_forward=1 ExecStartPre=/sbin/ip link set up mtu 1560 dev wlan0 ExecStartPre=/sbin/iw wlan0 set type ibss ExecStartPre=/sbin/iw dev wlan0 ibss join NVIDIA 5180 ca:92:26:4b:32:5a ExecStart=/usr/local/sbin/batctl if add wlan0 ExecStart=/sbin/ip link set bat0 up #ExecStart=/usr/local/sbin/batctl gw_mode server ExecStart=/sbin/ip addr add 192.168.143.1/24 broadcast 192.168.143.255 dev bat0 ExecStartPost=/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE ExecStartPost=/sbin/iptables -A FORWARD -i eth0 -o bat0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT ExecStartPost=/sbin/iptables -A FORWARD -i bat0 -o eth0 -j ACCEPT ExecStop=/bin/echo 0 > /proc/sys/net/ipv4/ip_forward ExecStop=/sbin/ip link set down wlan0 ExecStop=/sbin/ip link set down bat0 ExecStop=/sbin/ip addr flush dev bat0 ExecStop=/sbin/ip route flush dev bat0 ExecStop=/sbin/iw wlan0 set type managed ExecStop=/sbin/iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE ExecStop=/sbin/iptables -D FORWARD -i eth0 -o bat0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT ExecStop=/sbin/iptables -D FORWARD -i bat0 -o eth0 -j ACCEPT ExecStop=/sbin/sysctl -w net.ipv4.ip_forward=0 [Install] WantedBy=multi-user.target