Last active
May 23, 2023 19:32
-
-
Save joshespi/835fb585055e47ca332eba52a4190d02 to your computer and use it in GitHub Desktop.
script to disable IPV6 on ubuntu22 LT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Append IPv6 disable configuration to /etc/sysctl.conf | |
echo "net.ipv6.conf.all.disable_ipv6=1 | |
net.ipv6.conf.default.disable_ipv6=1 | |
net.ipv6.conf.lo.disable_ipv6=1" | sudo tee -a /etc/sysctl.conf > /dev/null | |
# Apply the changes | |
sudo sysctl -p | |
# Create /etc/rc.local if it doesn't exist | |
if [ ! -f /etc/rc.local ]; then | |
sudo touch /etc/rc.local | |
sudo chmod +x /etc/rc.local | |
echo "#!/bin/bash" | sudo tee /etc/rc.local > /dev/null | |
echo "# /etc/rc.local" | sudo tee -a /etc/rc.local > /dev/null | |
fi | |
# Add commands to /etc/rc.local | |
sudo sed -i '/exit 0/d' /etc/rc.local | |
echo "/etc/sysctl.d" | sudo tee -a /etc/rc.local > /dev/null | |
echo "/etc/init.d/procps restart" | sudo tee -a /etc/rc.local > /dev/null | |
echo "exit 0" | sudo tee -a /etc/rc.local > /dev/null | |
# Change permission of /etc/rc.local | |
sudo chmod 755 /etc/rc.local | |
#check results | |
ip a |
tested, worked fine for Raspberry pi OS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can be run with
sudo bash -c "$(curl -fsSL https://gist.githubusercontent.com/joshespi/835fb585055e47ca332eba52a4190d02/raw/73bab2c25e019d11444eae7e670263e8e3bb3c83/ubuntu22_ipv6_disable.sh)"