GCP Always Freeで一部の国からの接続が無料対象外のため国単位で接続を拒否したい。
対象のセグメントが多いためgcloudコマンドで実行する。
【コマンド】
gcloud compute firewall-rules create denyXXX –action deny –network default –priority 100 –rules all –source-ranges 1.1.1.1/32,2.2.2.2/32
–source-ranges = CIDR形式で記載する。IPアドレスを複数していする場合はカンマ区切りで記載
【参考】
https://blog.halpas.com/archives/4666
https://www.ip2location.com/free/visitor-blocker
https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create?hl=ja
【一括設定用ファイル】
オーストラリア
https://drive.google.com/open?id=1io1kkg0tc0pKSvEiCByqIdfx3w7K2gFB
中国
https://drive.google.com/open?id=1npFvVrHhH5E6lYxdGNJUKj6a6CRHFzSs
One Response
[…] gza.jp – GCPでfirewall-rules作成し国単位で接続拒否を行う […]