我有一个在Ubuntu Linux v14上运行的OpenVPN服务器。这是用于连接客户端的ifconfig的示例:
luis@Zarzamoro:/etc/openvpn$ sudo ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:192.168.211.141 P-t-P:192.168.211.142 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
我想要任何连接客户端的网络掩码255.255.255.0
,而不是255.255.255.255
。
当然,我可以通过多种方式从客户端更改它,例如:
# ifconfig tun0 netmask 255.255.255.0 up
...在/etc/network/if-up.d/
...等处的一些脚本
但是,如果可能的话,我想从服务器上进行操作。
这是:任何连接的客户端都会(从OpenVPN服务器)收到类似以下内容的信息:
luis@Zarzamoro:/etc/openvpn$ sudo ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:192.168.211.141 P-t-P:192.168.211.142 Mask:255.255.255.0
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
能做到吗?
首选适用于Windows和Linux客户端的答案。
更改topology
参数为/etc/openvpn/server.conf
(或无论它是):
# Network topology:
topology subnet
并在同一文件中指定IP地址池(包括网络掩码)(注释仅显示示例编号,因此请用您的替换):
# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
#server 10.8.0.0 255.255.255.0
server 192.168.211.0 255.255.255.0
通过以下方式重新启动服务器:
$ sudo /etc/init.d/openvpn restart
那应该是全部。
其他要点:
net30
,因此需要对其进行更改。works only on OpenVPN v2.1 or higher
。本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句