0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OCIの永久無料枠を踏み台にして自宅サーバを公開する手順

Posted at

1.経緯

学習用にミニPCを購入し、自宅サーバにして公開しようと計画。

Apacheをインストールするも、自宅のマンション回線ではグローバルIPアドレスが割り当てられていなかった。

OCIの永久無料枠を踏み台にして、自宅サーバを公開しよう。
↑今ココ

2.作業前提

サーバはRocky Linux9.5、踏み台OCIはOracle Linux7.9は、VPNはTailscaleを使用。
サーバと踏み台OCIはVPNを使って通信可能な状態にあること。
サーバにWebサーバ用のミドルウェアがインストールされており、テストページにアクセスできること。

3.作業内容

OCI側のfirewalldでポートフォワーディングの設定をする

bash
#Linuxカーネルにパケット転送を許可
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf
#内容を反映
sudo sysctl -p
bash
#80番ポートへの通信を許可
sudo firewall-cmd --zone=public --permanent --add-port=80/tcp
#80番ポートへの通信を転送するよう設定
sudo firewall-cmd --zone=public --permanent --add-forward-port=port=80:proto=tcp:toaddr=[サーバのIPアドレス]:toport=80
#SNAT設定
sudo firewall-cmd --zone=public --add-masquerade --permanent
#設定の読み込み
sudo firewall-cmd --reload

マンション回線でもインターネット経由で通信できるのは便利ですね。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?