Linux で OpenVPN を使用してインターネット経由の LAN アクセス用の VPN サーバーを設定する

Linux で OpenVPN を使用してインターネット経由の LAN アクセス用の VPN サーバーを設定する

インターネット VPN サーバー経由で LAN を設定して、自分のコンピューターにアクセスしたり、友達とゲームをしたりできるようにしたいのですが、ネットワークに関する知識があまりありません。しかし、これに関するガイドを見つけました:

https://codentium.com/using-openvpn-to-play-old-games-with-your-friends.html

サービスを開始した後にエラーが発生するまで、すべて順調に進んでいました。エラーは次のとおりです。

「journalctl -xe」の出力:

-- Unit openvpn.games.service has begun starting up.
Nov 03 16:54:56 vm9707380586.bitcommand.com openvpn.games[2418]:  * Starting virtual private network daemon
Nov 03 16:54:56 vm9707380586.bitcommand.com ovpn-games[2432]: Options error: Unrecognized option or missing or extra parameter(s) in /etc/openvpn/games.conf: push (2.4.4)

Nov 03 16:54:56 vm9707380586.bitcommand.com ovpn-games[2432]: Use --help for more information.
Nov 03 16:54:56 vm9707380586.bitcommand.com openvpn.games[2418]:    ...fail!
Nov 03 16:54:56 vm9707380586.bitcommand.com systemd[1]: openvpn.games.service: Control process exited, code=exited status=1
Nov 03 16:54:56 vm9707380586.bitcommand.com systemd[1]: openvpn.games.service: Failed with result 'exit-code'.
Nov 03 16:54:56 vm9707380586.bitcommand.com systemd[1]: Failed to start LSB: Openvpn VPN service.
-- Subject: Unit openvpn.games.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit openvpn.games.service has failed.

push 10.42.42.0 255.255.255.0に変更した後もpush "10.42.42.0 255.255.255.0"、別のエラーが発生します。

-- Unit openvpn.games.service has begun starting up.
Nov 03 14:21:25 vm9707380586.bitcommand.com openvpn.games[1446]:  * Starting virtual private network daemon
Nov 03 14:21:25 vm9707380586.bitcommand.com ovpn-games[1461]: Options error: ifconfig parms 'pool-persist' and 'games-ips.txt' must be valid addresses
Nov 03 14:21:25 vm9707380586.bitcommand.com ovpn-games[1461]: Use --help for more information.
Nov 03 14:21:25 vm9707380586.bitcommand.com openvpn.games[1446]:    ...fail!
Nov 03 14:21:25 vm9707380586.bitcommand.com systemd[1]: openvpn.games.service: Control process exited, code=exited status=1
Nov 03 14:21:25 vm9707380586.bitcommand.com systemd[1]: openvpn.games.service: Failed with result 'exit-code'.
Nov 03 14:21:25 vm9707380586.bitcommand.com systemd[1]: Failed to start LSB: Openvpn VPN service.
-- Subject: Unit openvpn.games.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit openvpn.games.service has failed. 

私の VPS オペレーティング システム: Ubuntu 18.04.5 LTS。

ウェブサイトに完全に従って設定を行いました。

解決策が見つかりませんでした。修正方法を教えてください。

編集1:

私の設定ファイル(/etc/openvpn/games.conf)は次のとおりです。

ca certs/keys/ca.crt
cert certs/keys/games.crt
key certs/keys/games.key
dh certs/keys/dh2048.pem

port 1194
proto udp
proto udp6
dev tap

user nobody
group nobody

server 10.42.42.0 255.255.255.0
client-to-client
push "route 10.42.42.0 255.255.255.0"
push 10.42.42.0 255.255.255.0
push "route-metric 512"
push "route 0.0.0.0 0.0.0.0"
topology subnet

persist-key
ifconfig pool-persist games-ips.txt

keepalive 10 120
comp-lzo

status /var/log/openvpn/games-status.log
log /var/log/openvpn/games.log
verb 4

このコマンドを試した後、このエラーが発生します:

openvpn --config /etc/openvpn/games.conf

Options error: Unrecognized option or missing or extra parameter(s) in /etc/openvpn/games.conf:15: push (2.4.4)
Use --help for more information.

push コマンドの後に二重引用符が欠落しているのではないかと疑ったので、push 10.42.42.0 255.255.255.0に変更しましたpush "10.42.42.0 255.255.255.0"が、それでも別のエラーが発生します。

Options error: ifconfig parms 'pool-persist' and 'games-ips.txt' must be valid addresses
Use --help for more information.

答え1

設定ファイルの構文が間違っているようです。設定ファイルを実際に確認しないと、問題が何であるかを正確に判断することは困難です。

以下のコマンドを使用して openvpn プロセスをフォアグラウンドで実行すると、より詳細なエラーが見つかる場合があります。

openvpn --config /etc/openvpn/games.conf

編集:

の出力を確認したところ、openvpn --config /etc/openvpn/games.conf問題は 23 行目にあるようです。正しい構文は ですifconfig-pool-persist games-ips.txt

関連情報