Add simple script checking the accept_ra state on running ONE servers

This commit is contained in:
Timothée Floure 2024-04-16 16:54:06 +02:00
parent 8fbc63d79b
commit f4da6cd2cf
Signed by: tfloure
GPG Key ID: 4502C902C00A1E12
1 changed files with 48 additions and 0 deletions

48
check-ra-one-interfaces Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
cat << EOF
===================================
Interfaces with non-zero accept_ra:
===================================
EOF
ra_interfaces=""
for sysctl_prefix in /proc/sys/net/ipv6/conf/*; do
conffile="$sysctl_prefix/accept_ra"
interface=$(basename "$sysctl_prefix")
accept_ra=$(cat "$conffile")
if echo "$interface" | grep -q "one\|vlan"; then
if [ "$accept_ra" != "0" ]; then
echo " $interface"
ra_interfaces="$ra_interfaces $interface"
fi
fi
done
cat << EOF
===================================
You might want to run the following
commands:
===================================
EOF
for interface in $ra_interfaces; do
echo "echo 0 > /proc/sys/net/ipv6/conf/$interface/accept_ra"
done
if [ $(cat /proc/sys/net/ipv6/conf/default/accept_ra) != "0" ]; then
cat <<- EOF
/!\ accept_ra is enabled on newly created interfaces /!\\
/!\ accept_ra is enabled on newly created interfaces /!\\
/!\ accept_ra is enabled on newly created interfaces /!\\
EOF
fi