日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁(yè) > 嵌入式 > 嵌入式動(dòng)態(tài)
[導(dǎo)讀]從CentOS6升級(jí)到CentOS7時(shí),防火墻命令已更改,但是我仍然習(xí)慣于以前的iptables命令。 本文介紹如何啟用iptables規(guī)則防火墻。

從CentOS6升級(jí)到CentOS7時(shí),防火墻命令已更改,但是我仍然習(xí)慣于以前的iptables命令。 本文介紹如何啟用iptables規(guī)則防火墻。

1.CentOS7自帶防火墻關(guān)閉

查看防火墻狀態(tài)(not running代表沒(méi)開(kāi)啟)

# firewall-cmd --state

not running

停止firewall

# systemctl stop firewalld.service

禁止firewall開(kāi)機(jī)啟動(dòng)

# systemctl disable firewalld.service

2.安裝配置iptables

安裝

# yum install -y iptables-services

編輯防火墻配置文件

默認(rèn)規(guī)則如下,修改規(guī)則保存退出。

# vim /etc/sysconfig/iptables# sample configuration for iptables service# you can edit this manually or use system-config-firewall# please do not ask us to add additional ports/services to this default configuration*filter:INPUT ACCEPT [0:0]:FORWARD ACCEPT [0:0]:OUTPUT ACCEPT [0:0]-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT-A INPUT -j REJECT --reject-with icmp-host-prohibited-A FORWARD -j REJECT --reject-with icmp-host-prohibitedCOMMIT

重啟防火墻

# systemctl restart iptables.service #最后重啟防火墻使配置生效。

3.其他命令

設(shè)置防火墻開(kāi)機(jī)啟動(dòng)

# systemctl enable iptables.service

禁止iptables服務(wù)

# systemctl disable iptables

暫停服務(wù)

# systemctl stop iptables

解除禁止iptables

# systemctl enable iptables

開(kāi)啟服務(wù)

# systemctl start iptables

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專(zhuān)欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關(guān)閉