Skip to content

Instantly share code, notes, and snippets.

@fmaree
Created June 4, 2013 11:21
Show Gist options
  • Save fmaree/5705231 to your computer and use it in GitHub Desktop.
Save fmaree/5705231 to your computer and use it in GitHub Desktop.
Disable IPv6 support of a RHEL6 system
#!/bin/sh
#
# Disable IPv6 support of RHEL6 systems
#
echo "In script ($0)..." >> /var/log/anaconda.log
RHELVER=`cat /etc/redhat-release | sed "s/.*release \([0-9]*\).*/\1/"`
if [ $RHELVER -ge "6" ] && [ -d /etc/modprobe.d ]; then
chkconfig ip6tables off
echo "blacklist ipv6" >> /etc/modprobe.d/ipv6.conf
cat << EOF >> /etc/sysctl.conf
# Disable ipv6 support
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
EOF
cat << EOF >> /etc/sysconfig/network
NETWORKING_IPV6=off
IPV6INIT=no
EOF
else
echo "unable to disable ipv6 support" >> /var/log/anaconda.log
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment