VPNトンネルを構築した後、SSHを介してOpenVPNサーバーに入ることができますが、サーバー側のLANまたはインターネット上の他のコンピューターに接続することはできません。

VPNトンネルを構築した後、SSHを介してOpenVPNサーバーに入ることができますが、サーバー側のLANまたはインターネット上の他のコンピューターに接続することはできません。

Raspberry PiにOpenVPN(具体的にはPiVPN)をインストールし、インストール後にVPNトンネルを介してインターネットに接続できると思いましたが、もう機能しません。 VPN接続を確立した後、SSH端末を使用してVPNサーバーに接続できますが、LANまたはインターネット上の他のコンピュータにアクセスすることはできません。行方不明の行があるようです。

私のインストールの詳細は次のとおりです。

オペレーティングシステム:Raspbian GNU/Linux 9 (stretch)

OpenVPNバージョン:2.4.0

出力ifconfig

enxb827ebd63367: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.1.16  netmask 255.0.0.0  broadcast 10.255.255.255
        inet6 fe80::7bc4:3085:b661:9a31  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:d6:33:67  txqueuelen 1000  (Ethernet)
        RX packets 31518  bytes 22185202 (21.1 MiB)
        RX errors 0  dropped 24  overruns 0  frame 0
        TX packets 7395  bytes 632561 (617.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.8.0.1  netmask 255.255.255.0  destination 10.8.0.1
        inet6 fe80::de9a:e04b:bfbe:ba61  prefixlen 64  scopeid 0x20<link>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 100  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 29  bytes 1392 (1.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

出力sudo route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.1.1        0.0.0.0         UG    202    0        0 enxb827ebd63367
10.0.0.0        0.0.0.0         255.0.0.0       U     202    0        0 enxb827ebd63367
10.8.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0

10.0.1.0は私のLAN、10.8.0.0はVPN仮想ネットワークです。

出力sudo iptables -S -t nat

-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-A POSTROUTING -s 10.8.0.0/24 -o enxb827ebd63367 -j MASQUERADE

パケットがあるサブネットから別のサブネットに移動するのを防ぐルーティングに問題がありますか? VPNサーバーに接続すると、ping 8.8.8.8クライアントコンピュータからも接続できません。

更新:私のOpen VPN server.confファイルを追加しました。

誰でもそれが何を意味するのか教えてもらえますかroute 0.0.0.0

dev tun
proto udp
port 1194
ca /etc/openvpn/easy-rsa/pki/ca.crt
cert /etc/openvpn/easy-rsa/pki/issued/server.crt
key /etc/openvpn/easy-rsa/pki/private/server.key
dh /etc/openvpn/easy-rsa/pki/dh2048.pem
topology subnet
server 10.8.0.0 255.255.255.0
# server and remote endpoints
ifconfig 10.8.0.1 10.8.0.2
# I ADDED THIS ROUTE BUT IT DID NOT HELP: Route to LAN
push "route 10.0.1.0 255.255.255.0"
# Add route to Client routing table for the OpenVPN Server
push "route 10.8.0.1 255.255.255.255"
# Add route to Client routing table for the OPenVPN Subnet
push "route 10.8.0.0 255.255.255.0"
# your local subnet
push "route 0.0.0.0 "
# Set your primary domain name server address for clients
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
# Override the Client default gateway by using 0.0.0.0/1 and
# 128.0.0.0/1 rather than 0.0.0.0/0. This has the benefit of
# overriding but not wiping out the original default gateway.
push "redirect-gateway def1"
client-to-client
duplicate-cn
keepalive 10 120
tls-version-min 1.2
tls-auth /etc/openvpn/easy-rsa/pki/ta.key 0
cipher AES-256-CBC
auth SHA256
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
#crl-verify /etc/openvpn/crl.pem
status /var/log/openvpn-status.log 20
status-version 3
log /var/log/openvpn.log
verb 1

ベストアンサー1

おすすめ記事