vm-start/ethernet_restreint/clean_no_restrent.sh

34 lines
596 B
Bash
Raw Normal View History

2024-02-19 18:38:08 +01:00
#!/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
2024-02-19 18:38:08 +01:00
echo "clean firewall"
echo "0" | $rooter tee /proc/sys/net/ipv4/ip_forward
$rooter sv stop nftables
$rooter sv start nftables
2024-02-19 18:38:08 +01:00
echo "clean veth0 and br0"
$rooter ip link del veth0
$rooter ip link del br0
$rooter ip link del dummy0
2024-02-19 18:38:08 +01:00
echo "clean the rest of the bridges."
$rooter ip link del br1
$rooter ip link del br2
2024-02-19 18:38:08 +01:00