Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I disabled IPv6 on an Ubuntu box which has ssh and rsync running. But both of these are still listening on an IPv6 address. How should I fix this? sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1 sysctl net.ipv6.conf.default.disable_ipv6
net.ipv6.conf.default.disable_ipv6 = 1 sysctl net.ipv6.conf.lo.disable_ipv6
net.ipv6.conf.lo.disable_ipv6 = 1

And ss -lnp6
State      Recv-Q Send-Q        Local Address:Port    Peer Address:Port
LISTEN     0      128            :::22                 :::*      users:(("sshd",1505,4))
LISTEN     0      5              :::873                :::*      users:(("rsync",3423,5))
share|improve this question
related:… – Kevin Bowen Sep 16 '13 at 6:29
Whatever the problem is, it's very unlikely that disabling IPv6 will solve it. – Michael Hampton Sep 17 '13 at 3:11
We do not use ipv6 (yet). So just trying to reduce security risk. – Abhishek Chanda Sep 17 '13 at 18:33
possible duplicate of How to disable IPv6 in Ubuntu 14.04? – A J Sep 7 '15 at 6:57
I would say the duplicate possibility is reversed since this question predates that one. – boatcoder Feb 9 at 21:53
up vote 37 down vote accepted

This worked for me:

Add these lines to the bottom of sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Then run sudo sysctl -p or reboot


This of course won't stop bind from blindly trying to use ipv6 though, so you also need to alter /etc/default/bind9 like so:

# run resolvconf? 
# startup options for the server 
OPTIONS="-4 -u bind"


share|improve this answer
Warning - don't click the link above. there is a virus or somethig – Tom Bennett Feb 2 at 7:20
There are 2 links above, can you be more specific? – boatcoder Feb 9 at 21:54
This is unnecessarily complicated, just blacklist the ipv6 module. – Anders Mar 22 at 1:31

To check if IPv6 is enabled or disabled, from a terminal window:

$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

0 means it’s enabled and 1 is disabled.

To disable IPv6

$ sudo su -
# nano /etc/sysctl.conf

and add these lines to sysctl.conf file

#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Save sysctl.conf file with new config, then reboot your system

# reboot

Check your system again

$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

Now you should see “1″ means IPv6 has been disabled on your system.


share|improve this answer
  1. Open a terminal and type the following command (if you don't use Gedit, replace it with your text editor such as Kate, etc).

    sudo gedit /etc/default/grub
  2. And search for this:


    Modify it so it looks like this:

  3. Now, let's update the GRUB:

    sudo update-grub2

    Or if you don't use GRUB 2, do:

    sudo update-grub
  4. And finally, restart your system.

share|improve this answer
I know that should work, but did not seem to solve my problem! netstat -nutlp | grep :: shows that sshd and ntpd are listening on ipv6 addresses. – Abhishek Chanda Sep 16 '13 at 20:06
Just remove the module ipv6, and you are done. Why you ever wanted to do this... – Anders Mar 22 at 1:38

Disable listening on ipv6 addresses for some services.

sshd /etc/default/ssh

# Options to pass to sshd

avahi-daemon /etc/avahi/avahi-daemon.conf


java /etc/java-7-openjdk/


Then restart services

service restart sshd
service restart avahi-daemon
service restart tomcat7

In my case tomcat was using java with ipv6. May differ for you.

share|improve this answer

To just turn of IPv6 on your computer, why you ever wanted to do that, is easy. Just add one line to a configuration file. Yes, you have to be root to create the file.

$ cat <<EOF >/etc/modprobe.d/blacklist-ipv6.conf
# To turn off IPv6, though you don't need too.
# But anyways.
blacklist ipv6

# eof

Just reboot or try:

$ sudo rmmod ipv6
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.