OpenVPN:不在子网之间路由

OpenVPN:不在子网之间路由

我已经开始拔头发了。

尝试让服务器和客户端使用他们的私有子网地址(而不是 OpenVPN 地址)相互通信。

服务器IP:10.0.0.111/24,客户端网络:10.20.30.120/24

之间可以建立连接10.8.0.1 (server) <=> 10.8.0.10 (client)

但两者之间不可能存在任何联系10.0.0.111 (server) <=> 10.20.30.120 (client)

使用最新的 OpenVPN 发行版。两台机器都是 Windows 7 32 位。日志文件中没有错误消息。两端的防火墙都已关闭。

请帮忙。

服务器.ovpn:

port 1194
proto udp
dev tun
dev-node MyTap
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 10.0.0.0 255.255.255.0"
client-config-dir ccd
route 10.20.30.0 255.255.255.0 10.8.0.10
keepalive 10 120
cipher AES-256-CBC
persist-key
persist-tun
status openvpn-status.log
verb 3
explicit-exit-notify 1

ccd/客户端1

ifconfig-push 10.8.0.10 255.255.255.0
iroute 10.20.30.0 255.255.255.0

客户端.ovpn

client
dev tun
dev-node MyTap
proto udp
remote xxx.xxx.xxx.xxx 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client1.crt
key client1.key
remote-cert-tls server
cipher AES-256-CBC
verb 3

服务器的路由表:

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0         10.0.0.1       10.0.0.111     10
         10.0.0.0    255.255.255.0         On-link        10.0.0.111    266
       10.0.0.111  255.255.255.255         On-link        10.0.0.111    266
       10.0.0.255  255.255.255.255         On-link        10.0.0.111    266
         10.8.0.0    255.255.255.0         On-link          10.8.0.1    276
         10.8.0.1  255.255.255.255         On-link          10.8.0.1    276
       10.8.0.255  255.255.255.255         On-link          10.8.0.1    276
       10.20.30.0    255.255.255.0        10.8.0.10         10.8.0.1     20
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link        10.0.0.111    266
        224.0.0.0        240.0.0.0         On-link          10.8.0.1    276
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link        10.0.0.111    266
  255.255.255.255  255.255.255.255         On-link          10.8.0.1    276
===========================================================================
Persistent Routes:
  None

客户端的路由表:

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0       10.20.30.1     10.20.30.120     10
         10.0.0.0    255.255.255.0         10.8.0.1        10.8.0.10    276
         10.8.0.0    255.255.255.0         On-link         10.8.0.10    276
        10.8.0.10  255.255.255.255         On-link         10.8.0.10    276
       10.8.0.255  255.255.255.255         On-link         10.8.0.10    276
       10.20.30.0    255.255.255.0         On-link      10.20.30.120    266
     10.20.30.120  255.255.255.255         On-link      10.20.30.120    266
     10.20.30.255  255.255.255.255         On-link      10.20.30.120    266
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link      10.20.30.120    266
        224.0.0.0        240.0.0.0         On-link         10.8.0.10    276
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link      10.20.30.120    266
  255.255.255.255  255.255.255.255         On-link         10.8.0.10    276
===========================================================================
Persistent Routes:
  None

答案1

经过一番努力终于找到了答案。我原以为 OpenVPN 就像接口之间的路由器,但事实并非如此!

如何将 Win7 PC 设置为路由器? https://superuser.com/questions/394505/how-can-i-setup-a-win-7-pc-as-a-router

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Value Name: IpEnableRouter
Value Type: REG_DWORD
Value Data: 1

相关内容