LoginSignup
1
0

More than 5 years have passed since last update.

FirewalldでMySQL等サービスをIPアクセス制限する

Posted at

※ 各サービス自体でも制限できる場合あるがFirewalldでどう対応すればいいかのメモ/恒久化前提です。

(MySQLを例としてます)

すでに設定済みの場合activeなzoneから削除しておく.

$ firewall-cmd --zone=public --remove-service=mysql --permanent 

zone作成管理しやすくする

$ firewall-cmd --new-zone=mysql --permanent

許可するIPを追加する

$ firewall-cmd --zone=mysql --add-source=xxx.xxx.xxx.xxx --permanent

リロードして設定反映

$ firewall-cmd --reload

設定状況確認


$ firewall-cmd --get-active-zones

public
  interfaces: eth0
mysql
  sources: xxx.xxx.xxx.xxx

ちなみに許可するIPを削除する場合

$ firewall-cmd --zone=mysql --remove-source=xxx.xxx.xxx.xxx --permanent
1
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
1
0