LoginSignup
0
0

More than 5 years have passed since last update.

How to allow firewalld for HTTP for specific IP addresses on CentOS 7.2

Last updated at Posted at 2018-06-19

CentOS 7.2 の firewalld で http (80) を特定の IP アドレスに対して許可する方法です。

追加

firewalld 起動

# systemctl start firewalld.service # 起動
# systemctl enable firewalld.service # 自動起動

zone 追加

http という zone を追加します。

# firewall-cmd --permanent --new-zone=http
# firewall-cmd --permanent --zone=http --set-target=ACCEPT
# firewall-cmd --permanent --zone=http --add-service=http # サービスを指定
# firewall-cmd --reload

IP アドレス追加

# firewall-cmd --permanent --zone=http --add-source=203.0.113.1 # 追加
# firewall-cmd --permanent --zone=http --add-source=203.0.113.2 # どんどん追加
...
# firewall-cmd --reload

確認

# firewall-cmd --get-active-zones # 追加した zone (http) とソースが表示されれば OK

削除

zone 削除

# firewall-cmd --permanent --delete-zone=http

IP アドレス削除

# firewall-cmd --permanent --zone=http --remove-source=203.0.113.1

参考記事

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