centos 7中防火墻是一個(gè)非常的強(qiáng)大的功能了,但對(duì)于centos 7中在防火墻中進(jìn)行了升級(jí)了,下面我們一起來(lái)詳細(xì)的看看關(guān)于CentOS7中防火墻的一些常用配置。
# 啟動(dòng) systemctl start firewalld# 查看狀態(tài)systemctl status firewalld# 停止關(guān)閉systemctl disable firewalldsystemctl stop firewalld# 把一個(gè)源地址加入白名單,以便允許來(lái)自這個(gè)源地址的所有連接# 這個(gè)在集群中使用常見(jiàn)# 設(shè)置后利用firewall-cmd --reload更新防火墻規(guī)則firewall-cmd --add-rich-rule 'rule family="ipv4" source address="192.168.1.215" accept' --permanentfirewall-cmd --reload# 特定域內(nèi)的用戶通過(guò)ssh可以連接,24標(biāo)識(shí)255.255.255.0firewall-cmd --remove-service=ssh --permanentfirewall-cmd --add-rich-rule 'rule family=ipv4 source address=172.16.30.0/24 service name=ssh accept' --permanent firewall-cmd --reloadfirewall-cmd --list-all # 將一個(gè)用戶加入白名單firewall-cmd --add-lockdown-whitelist-user=hadoop --permanentfirewall-cmd --reload# 將用戶id從白名單中去掉firewall-cmd --remove-lockdown-whitelist-uid=uidfirewall-cmd --reload# 查看所有打開(kāi)的端口:firewall-cmd --list-ports# 在某個(gè)區(qū)域打開(kāi)端口firewall-cmd --zone=public --add-port=8080/tcp --permanent# 關(guān)閉端口firewall-cmd --remove-port=465/tcp # 打開(kāi)服務(wù),參見(jiàn)/etc/firewalld 目錄下services文件夾中的服務(wù),可以配置firewall-cmd --permanent --zone=public --add-service=sambafirewall-cmd --add-service=http --permanent firewall-cmd --reload# 關(guān)閉服務(wù)firewall-cmd --zone=public --remove-service=sambafirewall-cmd --reload
官方文檔以及常用參考:
https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html
https://www.server-world.info/en/note?os=CentOS_7&p=firewalld
以上所述是小編給大家介紹的CentOS7中防火墻的一些常用配置介紹,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注