tools/check-ra-one-interfaces

49 lines
994 B
Text
Raw Normal View History

#!/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