【CentOS 7.1】配置防火牆

來源:互聯網
上載者:User

標籤:centos 7.1 firewall iptables

// 查看 firewalld

[[email protected] sysconfig]# systemctl status firewalld.service

firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)

   Active: active (running) since 四 2015-07-02 15:19:05 CST; 1 day 10h ago

 Main PID: 901 (firewalld)

   CGroup: /system.slice/firewalld.service

           └─901 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid


7月 02 15:19:04 wode006 systemd[1]: Starting firewalld - dynamic firewall .....

7月 02 15:19:05 wode006 systemd[1]: Started firewalld - dynamic firewall d...n.

Hint: Some lines were ellipsized, use -l to show in full.

[[email protected] sysconfig]# 


// 關閉 firewalld

[[email protected] sysconfig]# systemctl stop firewalld.service

[[email protected] sysconfig]# systemctl status firewalld.service

firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)

   Active: inactive (dead) since 六 2015-07-04 01:29:24 CST; 2s ago

 Main PID: 901 (code=exited, status=0/SUCCESS)


7月 02 15:19:04 wode006 systemd[1]: Starting firewalld - dynamic firewall .....

7月 02 15:19:05 wode006 systemd[1]: Started firewalld - dynamic firewall d...n.

7月 04 01:29:23 wode006 systemd[1]: Stopping firewalld - dynamic firewall .....

7月 04 01:29:24 wode006 systemd[1]: Stopped firewalld - dynamic firewall d...n.

Hint: Some lines were ellipsized, use -l to show in full.

[[email protected] sysconfig]#


// 禁止開機啟動 firewalld

[[email protected] sysconfig]# systemctl disable firewalld.service

rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service‘

rm ‘/etc/systemd/system/basic.target.wants/firewalld.service‘

[[email protected] sysconfig]# systemctl status firewalld.service

firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)

   Active: inactive (dead)


7月 02 15:19:04 wode006 systemd[1]: Starting firewalld - dynamic firewall .....

7月 02 15:19:05 wode006 systemd[1]: Started firewalld - dynamic firewall d...n.

7月 04 01:29:23 wode006 systemd[1]: Stopping firewalld - dynamic firewall .....

7月 04 01:29:24 wode006 systemd[1]: Stopped firewalld - dynamic firewall d...n.

Hint: Some lines were ellipsized, use -l to show in full.

[[email protected] sysconfig]# 


// 安裝 iptables

[[email protected] sysconfig]# yum install iptables-services

已載入外掛程式:fastestmirror, langpacks

Repository base is listed more than once in the configuration

Repository updates is listed more than once in the configuration

Repository extras is listed more than once in the configuration

Repository centosplus is listed more than once in the configuration

Repository base is listed more than once in the configuration

Repository updates is listed more than once in the configuration

Repository extras is listed more than once in the configuration

Repository centosplus is listed more than once in the configuration

Loading mirror speeds from cached hostfile

正在解決依賴關係

--> 正在檢查事務

---> 軟體包 iptables-services.x86_64.0.1.4.21-13.el7 將被 安裝

--> 解決依賴關係完成


// 配置 iptables

[[email protected] sysconfig]# vi /etc/sysconfig/iptables

[[email protected] sysconfig]# 

# allowed ssh

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT



// 重啟防火牆

[[email protected] sysconfig]# service iptables restart

Redirecting to /bin/systemctl restart  iptables.service

[[email protected] sysconfig]# systemctl restart iptables.service

[[email protected] sysconfig]# 



【CentOS 7.1】配置防火牆

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.