pve-scripts/bridge.sh
2025-12-31 14:32:28 +01:00

29 lines
887 B
Bash

#!/bin/bash
# installs on deb13
printf "\nWhat ip range do you want to route?"
printf "\nformat: 172.168.1.0/24"
read ip_range
# installs
apt update
apt install networkd-dispatcher
systemctl enable networkd-dispatcher
systemctl start networkd-dispatcher
# tcp forwarding
echo 'net.ipv4.ip_forward = 1' | tee -a /etc/sysctl.d/99-tailscale.conf
echo 'net.ipv6.conf.all.forwarding = 1' | tee -a /etc/sysctl.d/99-tailscale.conf
sysctl -p /etc/sysctl.d/99-tailscale.conf
# udp forwarding
printf '#!/bin/sh\n\nethtool -K %s rx-udp-gro-forwarding on rx-gro-list off \n' "$(ip -o route get 8.8.8.8 | cut -f 5 -d " ")" | tee /etc/networkd-dispatcher/routable.d/50-tailscale
chmod 755 /etc/networkd-dispatcher/routable.d/50-tailscale
# tailscale curl script
curl -fsSL https://tailscale.com/install.sh | sh
# log in and up
tailscale up --advertise-routes $ip_range --advertise-exit-node