This commit is contained in:
mzs114 2024-09-14 15:44:53 +08:00 committed by GitHub
commit ce5f3c4e8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -7,7 +7,10 @@ CHAIN_NAME="WIREGUARD_$WIREGUARD_INTERFACE"
iptables -t nat -D POSTROUTING -o $MASQUERADE_INTERFACE -j MASQUERADE -s $WIREGUARD_LAN iptables -t nat -D POSTROUTING -o $MASQUERADE_INTERFACE -j MASQUERADE -s $WIREGUARD_LAN
# Remove the drop rules between the peers
iptables -D FORWARD -i $WIREGUARD_INTERFACE -o $WIREGUARD_INTERFACE -j DROP
# Remove and delete the WIREGUARD_wg0 chain # Remove and delete the WIREGUARD_wg0 chain
iptables -D FORWARD -j $CHAIN_NAME iptables -D FORWARD -j $CHAIN_NAME
iptables -F $CHAIN_NAME iptables -F $CHAIN_NAME
iptables -X $CHAIN_NAME iptables -X $CHAIN_NAME

View file

@ -22,5 +22,8 @@ iptables -A $CHAIN_NAME -o lo -j ACCEPT
# Drop everything else coming through the Wireguard interface # Drop everything else coming through the Wireguard interface
iptables -A $CHAIN_NAME -i $WIREGUARD_INTERFACE -j DROP iptables -A $CHAIN_NAME -i $WIREGUARD_INTERFACE -j DROP
# Drop traffic between the peers
iptables -I FORWARD -i $WIREGUARD_INTERFACE -o $WIREGUARD_INTERFACE -j DROP
# Return to FORWARD chain # Return to FORWARD chain
iptables -A $CHAIN_NAME -j RETURN iptables -A $CHAIN_NAME -j RETURN