不积跬步,无以至千里;不积小流,无以成江海。

谷歌云VM搭ss服务无法启动(socket.error: [Errno 99] Cannot assign requested address)

学无止境 康康 7375℃ 4评论

注册谷歌云想撸个免费ss,发现ss起不来

启动输出日志

ssserver -c /etc/shadowsocks/config.json --log-file ./info.log -d restart

查看日志:

Traceback (most recent call last):
File "/usr/bin/ssserver", line 9, in <module>
load_entry_point('shadowsocks==2.8.2', 'console_scripts', 'ssserver')()
File "/usr/lib/python2.7/site-packages/shadowsocks/server.py", line 68, in main
tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False))
File "/usr/lib/python2.7/site-packages/shadowsocks/tcprelay.py", line 582, in __init__
server_socket.bind(sa)
File "/usr/lib64/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 99] Cannot assign requested address

发现socket绑定IP的时候报错

查看网卡信息:

[root@centos-ssr agent]# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc fq state UP group default qlen 1000
link/ether 42:01:0a:a8:00:02 brd ff:ff:ff:ff:ff:ff
inet 10.168.0.2/32 brd 10.168.0.2 scope global noprefixroute dynamic eth0
valid_lft 2692sec preferred_lft 2692sec
inet6 fe80::4001:aff:fea8:2/64 scope link
valid_lft forever preferred_lft forever

发现并没有绑定公网IP,应该是做了公网->内网的映射

查看host配置,发现内网做了一段映射,这时候将ss配置中的server 改为  centos-ssr.us-west2-b.c.prefab-glazing-233316.internal

10.168.0.2  centos-ssr.us-west2-b.c.prefab-glazing-233316.internal centos-ssr

再次启动ss,日志提示成功绑定端口

2019-03-03 03:35:02 INFO starting server at centos-ssr.us-west2-b.c.prefab-glazing-233316.internal:9600

2019-03-03 03:35:02 INFO starting server at centos-ssr.us-west2-b.c.prefab-glazing-233316.internal:9512

最终的配置 cat /etc/shadowsocks/config.json

{

"fast_open": true,

"local_address": "127.0.0.1",

"local_port": 1080,

"method": "aes-256-cfb",

"port_password": {

"9512": "xxx",

"9600": "xxx"
},

"prefer_ipv6": false,

"server": "centos-ssr.us-west2-b.c.prefab-glazing-233316.internal",

"timeout": 300,

"workers": 1
}

 

 

转载请注明:左手代码右手诗 » 谷歌云VM搭ss服务无法启动(socket.error: [Errno 99] Cannot assign requested address)

喜欢 (3)or分享 (0)
发表我的评论
取消评论

 

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(4)个小伙伴在吐槽
  1. 最后客户端配置的时候用的是哪个地址?
    lizehua2019-07-09 17:22 回复
    • 绑定的实际IP地址,或者域名
      康康2019-07-19 09:57 回复
  2. 我也遇到了同样的问题,请问要怎么查看绑定的实际 ip?就是怎么得到的您红色标注的地址呢
    嘤嘤嘤2019-10-10 11:20 回复
    • 谷歌云控制台里有显示
      康康2019-10-12 14:10 回复