允許Traceroute探測 (在防火牆中禁用Time Exceeded類型的ICMP包)
![]() ![]() |
||||||||||
|
解決步驟如下:
(說明:如果 /etc/sysconfig/ 目錄下沒有 iptables 文件,需要安裝 iptables,請參考:https://www.cnblogs.com/miracle-luna/p/13714709.html)
1、修改 iptables 文件
在/etc/sysconfig/iptables 文件中,增加如下內容:
-A INPUT -p icmp --icmp-type time-exceeded -j DROP -A OUTPUT -p icmp --icmp-type time-exceeded -j DROP
修改后,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 # 解決time exceeded問題 -A INPUT -p icmp --icmp-type time-exceeded -j DROP -A OUTPUT -p icmp --icmp-type time-exceeded -j DROP -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
2、保存 iptables 文件
service iptables save
3、重載 iptables 文件
systemctl reload iptables
或者
service iptables reload
4、重啟 iptables 服務
systemctl restart iptables
或者
service iptables restart
5、查看 iptables 狀態
systemctl status iptables
或者
service iptables status