通过 VPN 网络访问路由器客户端

通过 VPN 网络访问路由器客户端

我有以下 VPN 网络,问题是如何使用 192.168.8.X IP 地址访问 Raspberry Pi 或任何 OpenWRT 路由器 VPN 客户端。

我可以从我的笔记本电脑使用 10.8.0.6 访问 OpenWRT VPN CLIENT,但对 192.168.8.1 ping 没有响应。

另外,我可以从我的笔记本电脑访问服务器 IP 192.168.1.1。

####################  
# my laptop        #  
# VPN IP 10.8.0.10 #   
####################
        |
        |
        | internet
        |
        |   
#########################
# OpenWRT VPN SERVER    # 
# VPN IP 10.8.0.1       #        
# Router ip 192.168.1.1 #
#########################          
        |
        |
        | internet
        |
        |   
#########################      ####################     
# OpenWRT VPN CLIENT    #-----># Raspberry Pi     #
# VPN IP 10.8.0.6       #      #                  #  
# Router ip 192.168.8.1 #      # IP 192.168.8.123 # 
#########################      #################### 

对于 VPN 服务器配置文件我有:

config openvpn 'myvpn'
        option enabled '1'
        option verb '3'
        option proto 'udp'

        option dev 'tun'
        option dev 'tun0'
        option topology subnet
        option pull

        option server '10.8.0.0 255.255.255.0'
        option keepalive '10 120'
        option ca '/etc/openvpn/ca.crt'
        option cert '/etc/openvpn/my-server.crt'
        option key '/etc/openvpn/my-server.key'
        option dh '/etc/openvpn/dh2048.pem'
        option port 'XXXX'
        option client_to_client '1'
        option down '/usr/bin/ovpn-down'

        list push 'route 192.168.1.0 255.255.255.0'
        list push 'route 192.168.10.0 255.255.255.0'
        list push 'route 192.168.8.0 255.255.255.0'

        list push 'dhcp-option DNS 192.168.10.1'
        list push 'dhcp-option DNS 192.168.8.1'

        list push 'route 10.8.0.1 255.255.255.255'
        list push 'route 10.8.0.0 255.255.255.0'

        list push 'redirect-gateway def1'

添加新信息:

服务器路由:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.0.0.1        0.0.0.0         UG    0      0        0 pppoe-wan
10.0.0.1        *               255.255.255.255 UH    0      0        0 pppoe-wan
10.8.0.0        10.8.0.2        255.255.255.0   UG    0      0        0 tun0
10.8.0.2        *               255.255.255.255 UH    0      0        0 tun0
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan

还在服务器上添加了一条新路线:

192.168.8.0     10.8.0.1        255.255.255.0   UG    0      0        0 tun0

客户端配置文件:

dev tun
proto udp
route 192.168.8.0/24
log openvpn.log
verb 3
client
remote-cert-tls server
remote dns.server.com XXXX

客户端路由表:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.8.0.1        128.0.0.0       UG    0      0        0 tun0
default         192.168.100.1   0.0.0.0         UG    10     0        0 eth0
10.8.0.0        *               255.255.255.0   U     0      0        0 tun0
10.8.0.1        10.8.0.1        255.255.255.255 UGH   0      0        0 tun0
128.0.0.0       10.8.0.1        128.0.0.0       UG    0      0        0 tun0
xx.xx.xx.xx     192.168.100.1   255.255.255.255 UGH   0      0        0 eth0
192.168.1.0     10.8.0.1        255.255.255.0   UG    0      0        0 tun0
192.168.8.0     *               255.255.255.0   U     0      0        0 br-lan
192.168.10.0    10.8.0.1        255.255.255.0   UG    0      0        0 tun0
192.168.100.0   *               255.255.255.0   U     10     0        0 eth0

另外,我尝试过不使用该list push 'route 192.168.8.0 255.255.255.0'选项,但仍然无法访问网络 IP 192.168.8.1。

有任何想法吗?

相关内容