我在 10.0.1.0 (client1) 和 192.168.0.0 (client2) 子网上有两个 openvpn 客户端,服务器的 openvpn 连接的 IP 为 192.168.150.1
服务器启用了 ip 转发。
目前,client1 的 vpn ip 是 192.168.150.10,PtP ip 是 192.168.150.9 我在 client1 上创建了以下静态路由:
route add -net 10.0.1.0 netmask 255.255.255.0 gw 192.168.150.9
Run Code Online (Sandbox Code Playgroud)
client1 上的路由表如下所示:
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.150.9 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
192.168.150.1 192.168.150.9 255.255.255.255 UGH 0 0 0 tun0
10.0.1.0 192.168.150.9 255.255.255.0 UG 0 0 0 tun0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
Run Code Online (Sandbox Code Playgroud)
我认为允许来自客户端 1 的流量到达客户端 2 网络上的计算机是正确的,但它不起作用。192.168.150.9(PtP 地址)是路由通过的正确地址吗?我尝试使用 192.168.150.1 但我无法创建路由。
我还尝试将其添加到服务器配置中:
push "route 192.168.0.0 255.255.255.0"
push "route 10.0.1.0 255.255.255.0"
Run Code Online (Sandbox Code Playgroud)
它在 client1 上创建以下路由:
10.0.1.0 192.168.150.9 255.255.255.0 UG 0 0 0 tun0
Run Code Online (Sandbox Code Playgroud)
但它不起作用。“推”路线的例子肯定是正确的吗?还有什么我需要做的吗?服务器上什么都没有?只启用ip转发?
kyr*_*isu 16
防火墙日志中是否出现任何内容?您能否使用 tcpdump 准确诊断交通刹车的位置?你用的是什么系统(linux,freebsd,哪个版本)?
也可以在服务器配置中尝试这个(来自 OpenVPN文档):
# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
;client-to-client
Run Code Online (Sandbox Code Playgroud)
小智 5
为了让我的客户端通过 OpenVPN 服务器相互通信,我需要client-to-client按照 @kyrisu 的建议在我的配置中取消注释,但我还必须添加topology subnet到我的服务器配置中:
# 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
topology subnet
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29048 次 |
| 最近记录: |