Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

And

[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))
share|improve this question
    
related: askubuntu.com/questions/41543/… –  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
2  
We do not use ipv6 (yet). So just trying to reduce security risk. –  Abhishek Chanda Sep 17 '13 at 18:33

3 Answers 3

up vote 28 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

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? 
RESOLVCONF=yes 
# startup options for the server 
OPTIONS="-4 -u bind"

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

share|improve this answer

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

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:

    GRUB_CMDLINE_LINUX
    

    Modify it so it looks like this:

    GRUB_CMDLINE_LINUX="ipv6.disable=1"
    
  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

Your Answer

 
discard

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.