Issue: "Cannot assign requested address" when connecting to ::1

ipv6

#1

hi,

With a .travis.yml set to:

language: python     
python:              
    - "3.5"          
install:             
    - python3 test.py

and test.py:

import socket                                         
                                                      
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect(('::1', 1234))                              

As can be seen here, I’m getting this error on Travis:

[Errno 99] Cannot assign requested address

The expected behavior is:

[Errno 111] Connection refused

(Note: this is a duplicate of https://github.com/travis-ci/travis-ci/issues/8711 , and https://github.com/travis-ci/travis-ci/issues/10350 which got closed)


#2

There’s actually a Github repo dedicated to testing Travis IPv6 support! As of now, it says that only container-based Linuxes and MacOS have IPv6 addresses assigned, and only loopback and link-local at that.


#3

Thanks for your help. I tried setting “sudo: false”, there is no noticeable change :confused:


#4

I’ve rerun the tests, adding Xenial to the mix, too. There’s no IPv6 support in any of the Linuxes, only in MacOS.

With sudo: required, you might be able to enable it yourself if the kernel has the necessary modules.


#5

These commands had no effect:

sysctl -w net.ipv6.conf.all.disable_ipv6=0
sysctl -w net.ipv6.conf.lo.disable_ipv6=0

https://travis-ci.org/ProgVal/test_travis/builds/460658222


#6

sysctl -w reconfigures the kernel. Obviously, you need to run it with superuser rights.