1
Showfom 2015-01-31 16:20:28 +08:00 via iPhone
iptables?
|
2
chinawrj 2015-01-31 16:22:17 +08:00
iptables -A OUTPUT -p tcp --sport server_port -j ACCEPT
iptables -A OUTPUT -p tcp -m geoip --dst-cc CN -j DROP 另外iptables支持端口范围匹配 |
3
chinawrj 2015-01-31 16:24:07 +08:00
还有用啥,ipset啊,麻烦
|
4
tobyxdd 2015-01-31 16:29:18 +08:00
|
5
tobyxdd 2015-01-31 16:31:05 +08:00
可以只屏蔽http/https协议 或者直接禁止访问大陆IP的80和443端口
|
8
KyonLi 2015-01-31 18:04:13 +08:00 via Android
|
12
myliyifei OP @KyonLi NO, 你只加了一条规则,禁止localhost访问国内IP段,那么SS如何给客户端发送数据包呢? 我目前是实现了端口的方式,还要自定义链
|
14
ryd994 2015-01-31 22:41:05 +08:00 via Android
你先把related允许掉嘛,
只reject new就行 |
17
advans 2015-01-31 23:03:17 +08:00
不明白为什么非要费力气做这么不讨好的事儿!
|
19
ryd994 2015-01-31 23:14:45 +08:00 via Android
@myliyifei
output,如果是established,related ,允许 output,如果是 new,判断geoip规则 这样就是只限制出站的。 因为入站连接的返回部分会被作为established允许。 |
20
myliyifei OP @ryd994 恩,new的话,我直接用ipset判定好了。加不加NEW都没有意义吧?另外,SS会产生 related这个状态吗? netstat可以看到related状态吧
|
21
liruqi 2015-02-01 00:42:01 +08:00 via iPhone
|
23
jerryjhou 2015-02-02 06:11:24 +08:00 via iPad
|
24
myliyifei OP @ryd994 geoip准确吗? 和ipset的性能比较呢? 下面的文档说ipset用的是Jenkins3,但是搜不到这个
geoip vs ipset xt_geoip uses the (probably) most efficient format, a (non-compressed) packed blob. Loading one country into the kernel costs as much as the file on disk. Since ipset does not support arbitrary IPaddr–IPaddr ranges, one would need to approximate that using, for example, multiple Network/Prefixlength entries. Furthermore, if a hash set type is used, you can assume that, by the nature of hashes and/or trees, some buckets remain empty and/or additional metadata is required. The memory footprint with an ipset-based geoip thus is naturally larger. User reports[1] indicate it can become two orders of magnitude higher in certain cases (iptreemap). xt_geoip's lookup time is O(log2(ranges)), so to lookup an address within 20,000 ranges, at most 15 iterations each with address comparisons (at most 3) are required. ipset uses Jenkins3 for hashing, which has a certain time cost of its own. |