centos7 linux防火墻基本命令

2021-01-28    分類: 網(wǎng)站建設(shè)

在centos 7中,引入了新的防火墻服務(wù)firewall,但其依然是構(gòu)建在iptables基礎(chǔ)上的,其關(guān)系如下圖:

圖片來源于網(wǎng)絡(luò),侵刪

今天分享下firewall的常用管理命令

安裝與啟動(dòng)

安裝 => [root@zabbix ~]# yum install firewalld 啟用 => [root@zabbix ~]# systemctl start firewalld 狀態(tài) => [root@zabbix ~]# systemctl status firewalld 禁用 => [root@zabbix ~]# systemctl disable firewalld停止 => [root@zabbix ~]# systemctl stop firewalld 自啟 => [root@zabbix ~]#systemctl enable firewalld.service

基礎(chǔ)配置

添加22端口

[root@zabbix ~]#firewall-cmd --zone=public --add-port=22/tcp --permanent(permanent參數(shù)表示永久生效)

刪除22端口

[root@zabbix ~]#firewall-cmd --zone= public --remove-port=22/tcp --permanent

ICMP回顯打開和關(guān)閉(ping)

[root@zabbix ~]#firewall-cmd --permanent --remove-icmp-block=echo-request [root@zabbix ~]#irewall-cmd --permanent --add-icmp-block=echo-request 

規(guī)則生效

[root@zabbix ~]#firewall-cmd --reload

信息查詢

查看網(wǎng)卡所屬區(qū)域

[root@zabbix ~]#firewall-cmd --get-zone-of-interface=ens32


查看端口開放列表


查看所有區(qū)域的信息


rich rules(富規(guī)則)

rich rules用于實(shí)現(xiàn)更強(qiáng)的功能,如日志syslog和auditd、端口轉(zhuǎn)發(fā)、偽裝和限制速率等,或者是實(shí)現(xiàn)更為詳細(xì)的允許/限制條件

如開放指定端口給指定的IP

[root@zabbix ~]#firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.3.10" port protocol="tcp" port="22" accept"即只有192.168.3.10可以訪問本地的22端口

后面我們會(huì)分享更為詳細(xì)的rich rules知識(shí)

本文題目:centos7 linux防火墻基本命令
新聞來源:http://www.bm7419.com/news34/97784.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開發(fā)、靜態(tài)網(wǎng)站網(wǎng)站設(shè)計(jì)、網(wǎng)站維護(hù)小程序開發(fā)、外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)