今天在Ucloud国际版的机器上配置某个不可描述的服务时,遇到了 socket.error: [Errno 99] Cannot assign requested address 的错误,详细如下:
image.png

[root@liabio ~]# docker logs c0c34ba49967
2019-07-15 00:02:26 INFO     loading libcrypto from libcrypto.so.1.0.0
2019-07-15 00:02:26 INFO     starting server at 128.1.132.124:8002
Traceback (most recent call last):
  File "/usr/local/bin/ssserver", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/shadow44444socks/server.py", line 68, in main
    tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False))
  File "/usr/local/lib/python2.7/dist-packages/shadow44444socks/tcprelay.py", line 582, in __init__
    server_socket.bind(sa)
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 99] Cannot assign requested address

原先以为是resolver的问题,但是指定了Google的nameservers仍然无解,于是想到可能是服务器IP地址设置的问题,因为阿里云默认给网卡绑定的是内网IP地址。

于是修改某服务的配置文件中的Server IP为 0.0.0.0,再启动服务,问题解决。

切记要在安全组里把用到的端口(一般是8001)放行。