I'm running Ubuntu 10.4 and I've tried disabling IPv6 as I don't currently need it. I rand the following to disable IPv6 and then rebooted my server:

echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf

After the reboot I can see that IPv& is disabled by running:

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

On running netstat -antlp i see that most of the IPv6 applications have closed but SSHd keeps running:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9090            0.0.0.0:*               LISTEN      663/java
tcp        0      0 0.0.0.0:9091            0.0.0.0:*               LISTEN      663/java
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      684/apache2
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      513/sshd
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      605/postgres
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      684/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      513/sshd

Ho can I close the SSH daemon on port 22 of the IPv6?

Thanks.

link|improve this question

64% accept rate
feedback

2 Answers

According to this

The way to enable ipv6 for SSHD is to write a line in your /etc/ssh/sshd_config that says ListenAddress ::

So I would do the reverse, edit your /etc/ssh/sshd_config file and delete that line.

So your file would have looked like

ListenAddress 0.0.0.0
ListenAddress ::

Now you simply want it to say

ListenAddress 0.0.0.0

-=EDIT=-

Another way to disable ipv6 is apparently listed on this post:

  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. Update the GRUB:

    sudo update-grub2
    or
    sudo update-grub

    depending on which version of Grub you are using.

link|improve this answer
Hi Mokubai. Both of those lines in my /etc/ssh/sshd_config seem to be commented out by default. Do I simply uncomment the ListenAddress 0.0.0.0 and restart the SSHd? – Mridang Agarwalla Aug 23 '11 at 9:50
I would certainly try that first, it may be that without either of those lines present (i.e. both are commented out) then it defaults to a "built-in" config with both ipv4 and ipv6 enabled. – Mokubai Aug 23 '11 at 10:19
Uncommenting that line did it, it seems. Yay! Thank you. – Mridang Agarwalla Aug 23 '11 at 19:09
..or maybe I spoke too quick. That didn't do it. – Mridang Agarwalla Aug 23 '11 at 20:10
feedback

I suspect that it binds to 0.0.0.0 and ::, but, if IPv6 is disabled on the interface, it will not accept connections on that interface. Did you tried to connect over disabled IPv6 interfaces?

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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