这样弄 ocserv 的 no-route 路由表有问题吗?

2015-05-04 12:07:30 +08:00
 lenovo
no-route = 1.0.0.0/255.0.0.0
no-route = 14.0.0.0/255.0.0.0
no-route = 27.0.0.0/255.0.0.0
no-route = 36.0.0.0/255.0.0.0
no-route = 39.0.0.0/255.0.0.0
no-route = 42.0.0.0/255.0.0.0
no-route = 43.0.0.0/255.0.0.0
no-route = 45.0.0.0/255.0.0.0
no-route = 47.0.0.0/255.0.0.0
no-route = 49.0.0.0/255.0.0.0
no-route = 54.0.0.0/255.0.0.0
no-route = 58.0.0.0/255.0.0.0
no-route = 59.0.0.0/255.0.0.0
no-route = 60.0.0.0/255.0.0.0
no-route = 61.0.0.0/255.0.0.0
no-route = 101.0.0.0/255.0.0.0
no-route = 103.0.0.0/255.0.0.0
no-route = 106.0.0.0/255.0.0.0
no-route = 110.0.0.0/255.0.0.0
no-route = 111.0.0.0/255.0.0.0
no-route = 112.0.0.0/255.0.0.0
no-route = 113.0.0.0/255.0.0.0
no-route = 114.0.0.0/255.0.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.0.0.0
no-route = 118.0.0.0/255.0.0.0
no-route = 119.0.0.0/255.0.0.0
no-route = 120.0.0.0/255.0.0.0
no-route = 121.0.0.0/255.0.0.0
no-route = 122.0.0.0/255.0.0.0
no-route = 123.0.0.0/255.0.0.0
no-route = 124.0.0.0/255.0.0.0
no-route = 125.0.0.0/255.0.0.0
no-route = 139.0.0.0/255.0.0.0
no-route = 140.0.0.0/255.0.0.0
no-route = 144.0.0.0/255.0.0.0
no-route = 150.0.0.0/255.0.0.0
no-route = 152.0.0.0/255.0.0.0
no-route = 153.0.0.0/255.0.0.0
no-route = 157.0.0.0/255.0.0.0
no-route = 159.0.0.0/255.0.0.0
no-route = 161.0.0.0/255.0.0.0
no-route = 162.0.0.0/255.0.0.0
no-route = 163.0.0.0/255.0.0.0
no-route = 166.0.0.0/255.0.0.0
no-route = 167.0.0.0/255.0.0.0
no-route = 168.0.0.0/255.0.0.0
no-route = 171.0.0.0/255.0.0.0
no-route = 175.0.0.0/255.0.0.0
no-route = 180.0.0.0/255.0.0.0
no-route = 182.0.0.0/255.0.0.0
no-route = 183.0.0.0/255.0.0.0
no-route = 192.0.0.0/255.0.0.0
no-route = 202.0.0.0/255.0.0.0
no-route = 203.0.0.0/255.0.0.0
no-route = 210.0.0.0/255.0.0.0
no-route = 211.0.0.0/255.0.0.0
no-route = 218.0.0.0/255.0.0.0
no-route = 219.0.0.0/255.0.0.0
no-route = 220.0.0.0/255.0.0.0
no-route = 221.0.0.0/255.0.0.0
no-route = 222.0.0.0/255.0.0.0
no-route = 223.0.0.0/255.0.0.0

64行,看了下ios上cisco anyconnect的路由表,貌似都收到了
用起来貌似也分流了,就是不知道有多大误差?

9897 次点击
所在节点    问与答
67 条回复
lenovo
2015-05-04 23:12:34 +08:00
@LazyZhu 内网好像自动丢弃了,192.160.0.0/11 含了192.168.x.x,就不接收
排除以后好了
192.160.0.0/255.248.0.0
192.169.0.0/255.255.0.0
192.170.0.0/255.254.0.0
192.172.0.0/255.252.0.0
192.176.0.0/255.240.0.0
LazyZhu
2015-05-04 23:26:27 +08:00
@lenovo http://en.wikipedia.org/wiki/Reserved_IP_addresses
0.0.0.0/8
10.0.0.0/8
100.64.0.0/10
127.0.0.0/8
169.254.0.0/16
172.16.0.0/12
192.0.0.0/24
192.0.2.0/24
192.88.99.0/24
192.168.0.0/16
198.18.0.0/15
198.51.100.0/24
203.0.113.0/24
224.0.0.0/4
240.0.0.0/4
255.255.255.255/32
lenovo
2015-05-05 00:55:47 +08:00
@LazyZhu 多谢,最终结果:
不含内网147行: https://cnlic.com/wp-content/uploads/2015/04/cn-no-route.txt
包含内网155行: https://cnlic.com/wp-content/uploads/2015/04/cn-no-route2.txt

最后贴个在线转换合并的工具网页,很不错:)
http://www.stopforumspam.com/aggregate
wysard
2015-05-05 01:27:38 +08:00
我是这么写的:
# Option to allow sending arbitrary custom headers to the client after
# authentication and prior to VPN tunnel establishment.
#custom-header = "X-My-Header: hi there"

#example: custom-header = "X-CSTP-Split-Exclude: IPrange/Mask"
custom-header = "X-CSTP-Split-Exclude: 10.0.0.0/255.0.0.0"

不知和路由表的实现方式是否一样。
LazyZhu
2015-05-05 09:44:34 +08:00
You can specify either split-include or split-exclude, but you cannot specify both options.

http://www.cisco.com/c/en/us/products/collateral/security/ios-sslvpn/prod_white_paper0900aecd80512071.html
kkxxxxxxx
2015-05-05 15:08:15 +08:00
@lenovo Instagram不全
lenovo
2015-05-05 15:21:04 +08:00
@kkxxxxxxx 这个路由表是指定哪些IP不走VPN,没在这里列出的全部走VPN了,Instagram应该没有国内的IP吧
lenovo
2015-05-05 15:23:28 +08:00
@LazyZhu 含内网的只有192.160.0.0/11这一条有问题,最后分开弄了,要不然PC端整条都接收不到
bellchu
2015-05-05 16:32:01 +08:00
@lenovo 试过了没? 客户端接收这么多条路由记录之后慢吗?

我看了看我的小路由器,注入了1658条路由。性能无损。
bellchu
2015-05-05 16:35:36 +08:00
IP routing table name is default (0x0)
IP routing table maximum-paths is 32
Route Source Networks Subnets Replicates Overhead Memory (bytes)
connected 0 4 0 240 720
static 1658 1097 0 165300 495900
internal 58 129576
Total 1716 1101 0 165540 626196
lenovo
2015-05-05 17:15:27 +08:00
@bellchu 部署在 /t/187793 里的VPS上了,你可以试试...
bellchu
2015-05-05 17:29:51 +08:00
@lenovo 好的 多谢! 我有空试试看 你自己用下来客户端CPU占用率如何?
kkxxxxxxx
2015-05-06 08:59:59 +08:00
lenovo
2015-05-06 09:37:21 +08:00
@kkxxxxxxx 服务器端要修改src/vpn.h后重新编译才行,要不就是只接收96条,你发的链接里刚好是96条

为尽可能实现精准的国内外智能分流,需要修改src/vpn.h,增大路由表数量:找到#define MAX_CONFIG_ENTRIES 96这一行(第417行),把96改成200以上(Cisco AnyConnect最多只能接收200条路由表)
kkxxxxxxx
2015-05-10 12:06:12 +08:00
@lenovo 嗯,有修改200条,只是我不会写路由表,所以只能拿别人的来用,哈
jaleo
2015-05-11 13:57:19 +08:00
@lenovo [不含内网147行: https://cnlic.com/wp-content/uploads/2015/04/cn-no-route.txt
包含内网155行: https://cnlic.com/wp-content/uploads/2015/04/cn-no-route2.txt]
请问这些地址是国内的IP吗?
lenovo
2015-05-11 14:04:11 +08:00
@jaleo 范围扩大了,包含国内IP,也包含部分国外IP
纯国内的,参考https://github.com/CNMan/ocserv-cn-no-route/blob/master/chnroute_merged.txt
jaleo
2015-05-11 14:26:18 +08:00
@lenovo 这个太长了 有什么工具可以合并成200条之内?
lenovo
2015-05-11 16:24:15 +08:00
@jaleo cn-no-route2.txt 就是200条之内,要想合并就要扩大范围,200条之内最优解就是143行,再加上一些内网的IP
moonagic
2015-05-14 14:29:27 +08:00
ocserv修改后重新编译过,但是anyconnect客户端里还是只显示了96条路由
比较费解...

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

https://tanronggui.xyz/t/188298

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

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

© 2021 V2EX