How to Disable IPv6 on Ubuntu Server Using Sysctl (When Connecting via PuTTY)

IPv6 is the most recent version of the Internet Protocol (IP) that provides an identification and location system for computers on networks and routes traffic across the Internet. However, there may be situations where you need to disable IPv6 on your Ubuntu server. Here’s how you can do it using Sysctl when connecting via PuTTY:

  1. Launch PuTTY and enter the IP address or hostname of your Ubuntu server.
  2. Click “Open” to establish the SSH connection.
  3. Enter your username and password when prompted.
  4. Run the following command to open the sysctl configuration file:
sudo nano /etc/sysctl.conf
  1. Add the following lines at the end of the file:
# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
  1. Save the file by pressing CTRL+O, then exit the text editor by pressing CTRL+X.
  2. Apply the changes by running the following command:
sudo sysctl -p

Please note that disabling IPv6 may have unintended consequences, so proceed with caution and make sure it is necessary for your specific use case.