Server Fault is a question and answer site for system and network administrators. 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

On my Linux box, I have various daemons which can bind to all IPv6-enabled interfaces on ::. When they do so, Linux sends IPv4 requests to that daemon mapped as, for instance, ::ffff:

I would instead like IPv4 connections to be refused and only IPv6 connections accepted when a daemon binds to ::. To receive IPv4 connections, I want the daemon to have to explicitly bind to (as well as ::).

In other words, I want to run a service exclusively on IPv6, and not on IPv4.

Is there a way to accomplish this?

share|improve this question
up vote 15 down vote accepted

This is controlled by the net.ipv6.bindv6only sysctl. Add the following to /etc/sysctl.conf and run sudo sysctl -p to effect the change.


Applications can also explicitly only bind to the IPv6 address instead of changing this globally, for example, nginx has the ipv6only option to the listen directive. This corresponds to the IPV6_V6ONLY option to setsockopt().

share|improve this answer
Fortunately I found that the app (in this case, OpenSSH) was already setting IPV6_V6ONLY on the socket when I set ListenAddress :: so I didn't need to resort to using the sysctl (and reconfiguring everything else). – Michael Hampton Jul 26 '12 at 5:10

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.