vm-start/ethernet_restreint/clean_no_restrent.sh
2024-02-21 20:43:31 +00:00

33 lines
596 B
Bash
Executable file

#!/bin/sh
if which doas 2> /dev/null
then
rooter=$(which doas)
elif which sudo 2> /dev/null
then
rooter=$(which sudo)
sudo echo "Exec of the script" || exit 1
elif [ "$(id -u)" == "0" ]
then
rooter=""
else
echo "Error, no enough rights" >&2
exit
fi
echo "clean firewall"
echo "0" | $rooter tee /proc/sys/net/ipv4/ip_forward
$rooter sv stop nftables
$rooter sv start nftables
echo "clean veth0 and br0"
$rooter ip link del veth0
$rooter ip link del br0
$rooter ip link del dummy0
echo "clean the rest of the bridges."
$rooter ip link del br1
$rooter ip link del br2