Switch to nft interface by default

This commit is contained in:
2025-10-14 15:34:23 +03:00
parent 302e24b8df
commit a3d03d2133
8 changed files with 93 additions and 37 deletions
+18 -11
View File
@@ -1,14 +1,21 @@
# Flush iptables (Code from archlinux)
iptables=ip$1tables
if ! type -p "$iptables" &>/dev/null; then
echo "error: invalid argument"
exit 1
#!/bin/sh
# Usage: iptables-flush [-6]
iptables=/usr/sbin/iptables
tables="filter mangle raw"
if [ "$1" = "-6" ]; then
iptables=/usr/bin/ip6tables
else
# Only ipv4 has a nat table
tables="$tables nat"
fi
while read -r table; do
tables+=("/usr/share/iptables/empty-$table.rules")
done <"/proc/net/ip$1_tables_names"
for table in ${tables}; do
$iptables -t "$table" -F
$iptables -t "$table" -X
done
if (( ${#tables[*]} )); then
cat "${tables[@]}" | "$iptables-restore"
fi
for chain in INPUT FORWARD OUTPUT; do
$iptables -P "$chain" ACCEPT
done