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?

[email protected]:~# sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1
[email protected]:~# sysctl net.ipv6.conf.default.disable_ipv6
net.ipv6.conf.default.disable_ipv6 = 1
[email protected]:~# sysctl net.ipv6.conf.lo.disable_ipv6
net.ipv6.conf.lo.disable_ipv6 = 1


[email protected]:~# 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))

5 Answers 5


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

source: http://www.noobslab.com/2012/05/disable-ipv6-if-your-internet-is.html

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"

source: http://blog.evilcoder.net/disable-ipv6-on-bind9-linux/#sthash.U95y4s6U.dpuf

  • Warning - don't click the link above. there is a virus or somethig Feb 2, 2016 at 7:20
  • There are 2 links above, can you be more specific?
    – boatcoder
    Feb 9, 2016 at 21:54
  • This is unnecessarily complicated, just blacklist the ipv6 module.
    – Anders
    Mar 22, 2016 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.

From http://namhuy.net/1419/disable-ipv6-ubuntu-linux-mint.html

  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.

  • 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.
    – ACC
    Sep 16, 2013 at 20:06
  • Just remove the module ipv6, and you are done. Why you ever wanted to do this...
    – Anders
    Mar 22, 2016 at 1:38
  • It's not a separate module that can blacklisted, it's builtin. You cannot remove the ipv6 module.
    – datashaman
    Dec 22, 2016 at 15:40

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/net.properties


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.


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .