在我工作的地方,我们有相同的子网池(192.168.1.x)。因此,当连接到OpenVPN服务器时,我无法访问home的子网地址。
解决这场冲突的最佳/最简单方法是什么?我想避免改变我的家庭路由器DHCP池地址。
发布于 2020-02-03 13:31:14
是的,这里的好教训是永远不要在公司环境中使用192.168.0.0/24,192.168.0.1/24,就像永远不要使用802.1qVLAN ID 1一样。
但是,有些情况下你什么也做不了。对于这些情况,从2.4开始的OpenVPN支持内部无状态地址转换(NAT),即a.k.a。网络映射来自man openvpn:
--client-nat snat|dnat network netmask alias
This pushable client option sets up a stateless one-to-one NAT rule on
packet addresses (not ports), and is useful in cases where routes or
ifconfig settings pushed to the client would create an IP numbering
conflict.
network/netmask (for example 192.168.0.0/255.255.0.0) defines the
local view of a resource from the client perspective, while
alias/netmask (for example 10.64.0.0/255.255.0.0) defines the remote
view from the server perspective.
Use snat (source NAT) for resources owned by the client and dnat
(destination NAT) for remote resources.
Set --verb 6 for debugging info showing the transformation of
src/dest addresses in packets.因此,在客户端.conf文件中添加一行:
client-nat dnat 192.168.2.0 255.255.255.0 192.168.1.0
route 192.168.2.0 255.255.255.0然后,如果您的服务器端有192.168.1.5系统,客户端将能够作为192.168.2.5访问它,从而解决寻址冲突。诸若此类。
发布于 2013-04-11 16:50:00
对openvpn子网来说,这是一个糟糕的选择,因为它被许多家庭路由器所使用。但是,除非您可以更改openvpn配置,否则您将不得不更改您的家庭网络。因为它是DHCP,所以不会造成太大的麻烦--只需将其更改为192.168.42.0/24,然后让您的设备重新连接。
编辑:
"push“指令将将位于OpenVPN服务器(您工作的网络)后面的网络添加到客户端(您的家用计算机)上的路由表中。push指令必须与工作子网匹配,并且它不应该与home子网相同。
https://serverfault.com/questions/498439
复制相似问题