From d44a7e8feca09c6fd6d3245c111f3b0044352c06 Mon Sep 17 00:00:00 2001 From: "tiago.ferreira" Date: Sun, 8 Feb 2026 14:35:05 +0000 Subject: [PATCH] Adicionar compartilha_internet.sh --- compartilha_internet.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 compartilha_internet.sh diff --git a/compartilha_internet.sh b/compartilha_internet.sh new file mode 100644 index 0000000..5cdb300 --- /dev/null +++ b/compartilha_internet.sh @@ -0,0 +1,8 @@ +#!/bin/bash +read -p "Qual a interface de saĆ­da para a internet? " IFACE +nft add table -exist ip nat +nft add chain -exist ip nat postrouting { type nat hook postrouting priority 100 \; } +if ! nft list chain ip nat postrouting | grep -q "oifname \"$IFACE\" masquerade"; then + nft add rule ip nat postrouting oifname "$IFACE" masquerade +fi +sysctl -w net.ipv4.ip_forward=1 \ No newline at end of file