anyconnect 在 ios 上分流很爽,但安卓版本的 anyconnect 却不支持,怎么解?

2016-09-15 08:47:04 +08:00
 windhunter
同一台 server , ios 版 anyconnect 连上去境内外分流,
但我能找到的 android 机,版本从 4.2 到 6.0 ,用 anyconnect 后,流量却统统走 server 了。

各位安卓党是怎么解决这个问题的?
29975 次点击
所在节点    Android
48 条回复
tairan2006
2016-09-15 09:48:35 +08:00
基本用 hosts 就能翻绝大部分网站了…
mandymak
2016-09-15 11:15:20 +08:00
@windhunter PAC 分流?
LU35
2016-09-15 11:35:54 +08:00
不都是服务器设置的分流吗
alect
2016-09-15 13:00:47 +08:00
本人 ios 和 android 都正常分流,不知楼主怎么设置的啊
tinybaby365
2016-09-15 13:12:42 +08:00
Anyconnect 有个缺陷, server 给 client 推的路由在 vpn 连接断掉后会有残留。
windhunter
2016-09-15 14:04:55 +08:00
@mandymak 不是,用的是 no-route 简单的国内外分流。
@LU35 就是在服务器端设置,但是现在是 iOS 的 anyconnect 客户端有效分流, android 版 anconnect 的流量都走服务器了,所以我才纳闷。
@alect 配置文件来自 https://github.com/CNMan/ocserv-cn-no-route 只简单的替换了自己的 ip 、端口和证书。现在 iOS 版没问题, Android 版本无效,我才认为症结在 anyconnect 客户端。
@jiangfengbing 这事情已经不在意了。先调通。

补充说明一下,我 server 环境是 debian 7.11 32bit,ocsver 0.11.4. 配置文件如上所说来自 https://github.com/CNMan/ocserv-cn-no-route
xrui
2016-09-15 14:12:02 +08:00
安卓好像真的没有 no-route ……
我就是 iPad 上可以,安卓不行
datou
2016-09-15 14:16:31 +08:00
安卓版的 openconnect 客户端也不行吗?
LU35
2016-09-15 14:21:52 +08:00
@windhunter 肯定是你那边的问题.我安卓上也装过 anyconnect.在服务器上设置的分流.使用时分流是正常的.
kkxxxxxxx
2016-09-15 15:50:57 +08:00
缺点:路由表数量限制,分流效果有限,速度上不去
alect
2016-09-15 17:57:34 +08:00
安卓别用 no-route,无效。
fishg
2016-09-15 18:05:34 +08:00
安卓不支持 no-route ,用 route 表比较通用
taresky
2016-09-15 19:42:52 +08:00
自寻烦恼啊
Vicer
2016-09-15 20:07:08 +08:00
安卓,为什么不用 openconnect
windhunter
2016-09-15 22:56:54 +08:00
@datou @Vicer 是的,安卓版本 openconnect 和 anyconnect 都装了,不行。
@LU35 那么,求个 ocserv 的配置文件。我去比较比较...
@kkxxxxxxx 我知道这个缺点,但, anyconnect 自动重连很方便,而且不用越狱不用 root.
@alect @fishg 如果安卓版不支持 no-route,那么 route 的分流表我不会搞,另外多半要超过 200 条的路由限制。另外 @LU35 提到他用 no-route 分流成功,我还是希望能尝试下
@taresky 算是吧。人生贵在折腾!哈!
kozora
2016-09-16 01:19:44 +08:00
ios 的其实支持 pac 分流的
kkxxxxxxx
2016-09-16 02:10:08 +08:00
@windhunter iOS 上现在这么多支持 SS 的 App ,随便一个都很方便啊
Vicer
2016-09-16 03:06:38 +08:00
正在用 OpenConnect ,绝对没有问题。
另外给你个配置

#auth = "plain[passwd=/etc/ocserv/ocpasswd]"
auth = "certificate"

# TCP and UDP port number
tcp-port = 443
udp-port = 443

server-cert = /etc/ocserv/server.cert.pem
server-key = /etc/ocserv/server.key.pem
ca-cert = /etc/ocserv/ca.cert.pem

socket-file = /var/run/ocserv-socket
pid-file = /var/run/ocserv.pid
run-as-user = nobody
run-as-group = daemon
cert-user-oid = 2.5.4.3
isolate-workers = false
max-clients = 256
max-same-clients = 128
keepalive = 32400
dpd = 30
mobile-dpd = 120
#output-buffer = 1000
try-mtu-discovery = true
compression = true
no-compress-limit = 256
auth-timeout = 40
idle-timeout = 1200
mobile-idle-timeout = 1200
cookie-timeout = 43200
persistent-cookies = true
deny-roaming = false
rekey-time = 43200
rekey-method = ssl
use-utmp = true
use-occtl = true
device = ocserv
predictable-ips = false
ping-leases = false
cisco-client-compat = true
tls-priorities = "NORMAL:%SERVER_PRECEDENCE:%COMPAT:-VERS-SSL3.0"
ipv4-network = 192.168.8.0
ipv4-netmask = 255.255.255.0
dns = 192.168.8.1
#dns = 182.254.116.116

# no-route list
no-route = 你的服务器 IP/255.255.255.255
no-route = 192.168.0.0/255.255.0.0

no-route = 1.0.0.0/255.192.0.0
no-route = 1.64.0.0/255.224.0.0
no-route = 1.112.0.0/255.248.0.0
no-route = 1.176.0.0/255.240.0.0
no-route = 1.192.0.0/255.240.0.0
no-route = 14.0.0.0/255.224.0.0
no-route = 14.96.0.0/255.224.0.0
no-route = 14.128.0.0/255.224.0.0
no-route = 14.192.0.0/255.224.0.0
no-route = 27.0.0.0/255.192.0.0
no-route = 27.96.0.0/255.224.0.0
no-route = 27.128.0.0/255.224.0.0
no-route = 27.176.0.0/255.240.0.0
no-route = 27.192.0.0/255.224.0.0
no-route = 27.224.0.0/255.252.0.0
no-route = 36.0.0.0/255.192.0.0
no-route = 36.96.0.0/255.224.0.0
no-route = 36.128.0.0/255.192.0.0
no-route = 36.192.0.0/255.224.0.0
no-route = 36.240.0.0/255.240.0.0
no-route = 39.0.0.0/255.255.0.0
no-route = 39.64.0.0/255.224.0.0
no-route = 39.96.0.0/255.240.0.0
no-route = 39.128.0.0/255.192.0.0
no-route = 40.72.0.0/255.254.0.0
no-route = 40.125.128.0/255.255.128.0
no-route = 40.126.64.0/255.255.192.0
no-route = 42.0.0.0/255.248.0.0
no-route = 42.48.0.0/255.240.0.0
no-route = 42.80.0.0/255.240.0.0
no-route = 42.96.0.0/255.224.0.0
no-route = 42.128.0.0/255.128.0.0
no-route = 43.224.0.0/255.224.0.0
no-route = 45.65.16.0/255.255.240.0
no-route = 47.92.0.0/255.252.0.0
no-route = 47.96.0.0/255.224.0.0
no-route = 49.0.0.0/255.248.0.0
no-route = 49.48.0.0/255.248.0.0
no-route = 49.64.0.0/255.224.0.0
no-route = 49.112.0.0/255.240.0.0
no-route = 49.128.0.0/255.224.0.0
no-route = 49.208.0.0/255.240.0.0
no-route = 49.224.0.0/255.224.0.0
no-route = 52.80.0.0/255.252.0.0
no-route = 54.222.0.0/255.254.0.0
no-route = 58.0.0.0/255.128.0.0
no-route = 58.128.0.0/255.224.0.0
no-route = 58.192.0.0/255.224.0.0
no-route = 58.240.0.0/255.240.0.0
no-route = 59.32.0.0/255.224.0.0
no-route = 59.64.0.0/255.224.0.0
no-route = 59.96.0.0/255.240.0.0
no-route = 59.144.0.0/255.240.0.0
no-route = 59.160.0.0/255.224.0.0
no-route = 59.192.0.0/255.192.0.0
no-route = 60.0.0.0/255.224.0.0
no-route = 60.48.0.0/255.240.0.0
no-route = 60.160.0.0/255.224.0.0
no-route = 60.192.0.0/255.192.0.0
no-route = 61.0.0.0/255.192.0.0
no-route = 61.80.0.0/255.248.0.0
no-route = 61.128.0.0/255.192.0.0
no-route = 61.224.0.0/255.224.0.0
no-route = 91.234.36.0/255.255.255.0
no-route = 101.0.0.0/255.128.0.0
no-route = 101.128.0.0/255.224.0.0
no-route = 101.192.0.0/255.240.0.0
no-route = 101.224.0.0/255.224.0.0
no-route = 103.0.0.0/255.0.0.0
no-route = 106.0.0.0/255.128.0.0
no-route = 106.224.0.0/255.240.0.0
no-route = 110.0.0.0/255.128.0.0
no-route = 110.144.0.0/255.240.0.0
no-route = 110.160.0.0/255.224.0.0
no-route = 110.192.0.0/255.192.0.0
no-route = 111.0.0.0/255.192.0.0
no-route = 111.64.0.0/255.224.0.0
no-route = 111.112.0.0/255.240.0.0
no-route = 111.128.0.0/255.192.0.0
no-route = 111.192.0.0/255.224.0.0
no-route = 111.224.0.0/255.240.0.0
no-route = 112.0.0.0/255.128.0.0
no-route = 112.128.0.0/255.240.0.0
no-route = 112.192.0.0/255.252.0.0
no-route = 112.224.0.0/255.224.0.0
no-route = 113.0.0.0/255.128.0.0
no-route = 113.128.0.0/255.240.0.0
no-route = 113.192.0.0/255.192.0.0
no-route = 114.16.0.0/255.240.0.0
no-route = 114.48.0.0/255.240.0.0
no-route = 114.64.0.0/255.192.0.0
no-route = 114.128.0.0/255.240.0.0
no-route = 114.192.0.0/255.192.0.0
no-route = 115.0.0.0/255.0.0.0
no-route = 116.0.0.0/255.0.0.0
no-route = 117.0.0.0/255.128.0.0
no-route = 117.128.0.0/255.192.0.0
no-route = 118.16.0.0/255.240.0.0
no-route = 118.64.0.0/255.192.0.0
no-route = 118.128.0.0/255.128.0.0
no-route = 119.0.0.0/255.128.0.0
no-route = 119.128.0.0/255.192.0.0
no-route = 119.224.0.0/255.224.0.0
no-route = 120.0.0.0/255.192.0.0
no-route = 120.64.0.0/255.224.0.0
no-route = 120.128.0.0/255.240.0.0
no-route = 120.192.0.0/255.192.0.0
no-route = 121.0.0.0/255.128.0.0
no-route = 121.192.0.0/255.192.0.0
no-route = 122.0.0.0/254.0.0.0
no-route = 124.0.0.0/255.0.0.0
no-route = 125.0.0.0/255.128.0.0
no-route = 125.160.0.0/255.224.0.0
no-route = 125.192.0.0/255.192.0.0
no-route = 137.59.88.0/255.255.252.0
no-route = 139.0.0.0/255.224.0.0
no-route = 139.128.0.0/255.128.0.0
no-route = 140.64.0.0/255.240.0.0
no-route = 140.128.0.0/255.240.0.0
no-route = 140.192.0.0/255.192.0.0
no-route = 144.0.0.0/255.255.0.0
no-route = 144.7.0.0/255.255.0.0
no-route = 144.12.0.0/255.255.0.0
no-route = 144.52.0.0/255.255.0.0
no-route = 144.123.0.0/255.255.0.0
no-route = 144.255.0.0/255.255.0.0
no-route = 146.196.56.0/255.255.252.0
no-route = 150.0.0.0/255.255.0.0
no-route = 150.96.0.0/255.224.0.0
no-route = 150.128.0.0/255.240.0.0
no-route = 150.192.0.0/255.192.0.0
no-route = 152.104.128.0/255.255.128.0
no-route = 153.0.0.0/255.192.0.0
no-route = 153.96.0.0/255.224.0.0
no-route = 157.0.0.0/255.255.0.0
no-route = 157.18.0.0/255.255.0.0
no-route = 157.61.0.0/255.255.0.0
no-route = 157.122.0.0/255.255.0.0
no-route = 157.148.0.0/255.255.0.0
no-route = 157.156.0.0/255.255.0.0
no-route = 157.255.0.0/255.255.0.0
no-route = 159.226.0.0/255.255.0.0
no-route = 160.19.208.0/255.255.248.0
no-route = 160.19.216.0/255.255.252.0
no-route = 160.20.48.0/255.255.252.0
no-route = 161.207.0.0/255.255.0.0
no-route = 162.105.0.0/255.255.0.0
no-route = 163.0.0.0/255.192.0.0
no-route = 163.96.0.0/255.224.0.0
no-route = 163.128.0.0/255.192.0.0
no-route = 163.192.0.0/255.224.0.0
no-route = 166.111.0.0/255.255.0.0
no-route = 167.139.0.0/255.255.0.0
no-route = 167.189.0.0/255.255.0.0
no-route = 167.220.244.0/255.255.252.0
no-route = 168.160.0.0/255.255.0.0
no-route = 170.179.0.0/255.255.0.0
no-route = 171.0.0.0/255.128.0.0
no-route = 171.192.0.0/255.224.0.0
no-route = 175.0.0.0/255.128.0.0
no-route = 175.128.0.0/255.192.0.0
no-route = 180.64.0.0/255.192.0.0
no-route = 180.128.0.0/255.128.0.0
no-route = 182.0.0.0/255.0.0.0
no-route = 183.0.0.0/255.192.0.0
no-route = 183.64.0.0/255.224.0.0
no-route = 183.128.0.0/255.128.0.0
no-route = 192.124.154.0/255.255.255.0
no-route = 192.188.170.0/255.255.255.0
no-route = 202.0.0.0/255.128.0.0
no-route = 202.128.0.0/255.192.0.0
no-route = 202.192.0.0/255.224.0.0
no-route = 203.0.0.0/255.0.0.0
no-route = 210.0.0.0/255.192.0.0
no-route = 210.64.0.0/255.224.0.0
no-route = 210.160.0.0/255.224.0.0
no-route = 210.192.0.0/255.224.0.0
no-route = 211.64.0.0/255.248.0.0
no-route = 211.80.0.0/255.240.0.0
no-route = 211.96.0.0/255.248.0.0
no-route = 211.136.0.0/255.248.0.0
no-route = 211.144.0.0/255.240.0.0
no-route = 211.160.0.0/255.248.0.0
no-route = 218.0.0.0/255.128.0.0
no-route = 218.160.0.0/255.224.0.0
no-route = 218.192.0.0/255.192.0.0
no-route = 219.64.0.0/255.224.0.0
no-route = 219.128.0.0/255.224.0.0
no-route = 219.192.0.0/255.192.0.0
no-route = 220.96.0.0/255.224.0.0
no-route = 220.128.0.0/255.128.0.0
no-route = 221.0.0.0/255.224.0.0
no-route = 221.96.0.0/255.224.0.0
no-route = 221.128.0.0/255.128.0.0
no-route = 222.0.0.0/255.0.0.0
no-route = 223.0.0.0/255.224.0.0
no-route = 223.64.0.0/255.192.0.0
no-route = 223.128.0.0/255.128.0.0
Vicer
2016-09-16 03:10:03 +08:00
另外建议你用 ocserv 0.10.12 。
很稳定。
有好处。
windhunter
2016-09-16 16:09:33 +08:00
@kkxxxxxxx @kozora 谢谢你们的提醒。我要解决的问题不在于 iOS 客户端,相反, iOS 上的 anyconnect 已经能满足我的需要了。是奇葩的 android 版 anyconnect 不能达到我的要求。
@Vicer 感谢你提供的配置文件。下午有空试了一下,用你的配置文件依旧不行(只修改了认证方式、 ip 地址 和端口),不管是 openconnect 和 anyconnect 都不行。看来要试试给 ocserv 降级了。这个只能晚上回去弄了。再次感谢。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/306383

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX