注册谷歌云想撸个免费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)