Skip to content
This repository was archived by the owner on Jun 10, 2019. It is now read-only.

Commit 15c7d1c

Browse files
author
Paul Marks
committed
Do not remove ::1 from the loopback interface.
An environment with AF_INET6 sockets but no loopback interface creates nothing but pain. If an IPv4 server binds to 0.0.0.0:8080, clients may connect to 0.0.0.0:8080, which automatically picks 127.0.0.1 as a source address. However, when a server binds to [::]:8080, the absence of ::1 causes clients to fail with ENETUNREACH. For a demonstration, run the following in a python shell: import socket s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0) s.bind(("", 0)) print s.getsockname() # Example: ('::', 39079, 0, 0) s.listen(10) c = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0) c.connect(s.getsockname()) print c.getsockname(), c.getpeername() This yields the following error: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 101] Network is unreachable
1 parent 05e8d0c commit 15c7d1c

File tree

1 file changed

+1
-0
lines changed
  • bootstrapvz/providers/gce/tasks

1 file changed

+1
-0
lines changed

bootstrapvz/providers/gce/tasks/host.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def run(cls, info):
1515
network_configuration_path = os.path.join(info.root, 'etc/sysctl.d/70-disable-ipv6.conf')
1616
with open(network_configuration_path, 'w') as config_file:
1717
print >>config_file, "net.ipv6.conf.all.disable_ipv6 = 1"
18+
print >>config_file, "net.ipv6.conf.lo.disable_ipv6 = 0"
1819

1920

2021
class InstallHostnameHook(Task):

0 commit comments

Comments
 (0)