0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ルーターを2つ使ってサーバ公開用ネットワークを構築した話

Last updated at Posted at 2019-09-26

■まえおき

マインクラフトやTerrariaなどでModを使用する場合、個人でサーバを建てる必要がある。
最初はGoogle Cloud Platformで構築してたが24時間起動だとやはりコストがかかるため余ったPCを使って個人サーバを建てた。
公開するにあたって公開用のネットワークとプライベートネットワークを分ける必要が出たのでそのメモ書き。

■ネットワーク構成図

Excelで簡単に記載した。
・Router1~Router2の間が公開用のネットワーク(左側の赤破線部分)
・Router2~がプライベートネットワーク(右側の赤破線部分)
無題.png

ここで問題となるのがRouter2配下のVPNサーバの存在。
VPNサーバまでポート開放しなければいけないが、ポート開放の解説をしている大抵のサイトでは2重ルーターはポート開放できないとある。

■2重ルーターでポート開放するには?

答えは簡単。
2つのルーターでポート解放してあげればいい。

ServerがTCP:7777、VPN ServerがTCP:8888を待ち合わせているとする。

①Serverのポート開放
・Router1配下に設置されているためRouter1でTCP:7777 IP:192.168.0.3とポート解放する。

②VPN Serverのポート開放
1.Router1からRouter2までポート開放
 →Router1でTCP:8888 IP:192.168.0.2
2.Router2からVPN Serverまでポート開放
 →Router2でTCP:8888 IP:192.168.1.2

このようにするとルーターが複数あってもポート開放ができる。
(間違っていたら教えてください。)

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?