在linux中使用iptables清空所有規(guī)則可以使用以下命令:
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
-
iptables -F
清除所有鏈的規(guī)則。 -
iptables -X
刪除自定義的鏈。 -
iptables -t nat -F
清除nat表中的所有規(guī)則。 -
iptables -t nat -X
刪除nat表中的自定義鏈。 -
iptables -t mangle -F
清除mangle表中的所有規(guī)則。 -
iptables -t mangle -X
刪除mangle表中的自定義鏈。 -
iptables -P INPUT ACCEPT
設(shè)置默認(rèn)的輸入鏈為接受狀態(tài)。 -
iptables -P FORWARD ACCEPT
設(shè)置默認(rèn)的轉(zhuǎn)發(fā)鏈為接受狀態(tài)。 -
iptables -P OUTPUT ACCEPT
設(shè)置默認(rèn)的輸出鏈為接受狀態(tài)。
恢復(fù)默認(rèn)規(guī)則也可以使用一條命令:
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
默認(rèn)規(guī)則為接受所有流量。文章來源:http://www.zghlxwxcb.cn/news/detail-401723.html
注意:上述操作會(huì)永久清空規(guī)則,在重啟后還需重新配置規(guī)則。文章來源地址http://www.zghlxwxcb.cn/news/detail-401723.html
到了這里,關(guān)于iptables清空所有規(guī)則和恢復(fù)默認(rèn)規(guī)則的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!