某日在openvpn服务器上配置iptables,配置完成,却发现forward中所有过滤居然都没有生效。传了个文件,发现流量居然都直接从input和output了,抓包后发现openvpn只是以其服务端口与两客户端建立了直接的连接实现了数据传输。百思不得其解,openvpn的的iptables示例明明就是在forward做过滤的啊。
百思不得其解之时,只好上水木社区求助。某大牛发来man page中的一段。大悟。
–client-to-client
Because the OpenVPN server mode handles multiple clients through
a single tun or tap interface, it is effectively a router. The
–client-to-client flag tells OpenVPN to internally route
client-to-client traffic rather than pushing all client-origi-
nating traffic to the TUN/TAP interface.When this option is used, each client will “see” the other
clients which are currently connected. Otherwise, each client
will only see the server. Don’t use this option if you want to
firewall tunnel traffic using custom, per-client rules.
原来我一直都误以为client-to-client这个选项是用来控制两客户端可否通讯与否。没想到却根本不是这么一回事,后来一问同事,才发现大家都这么认为。原因何在,就是大家都太信任网上一些汉化的配置实例。看来,大多数时候我们有必要自己去翻阅英文的文档啊!
