自学内容网 自学内容网

Linux: network: icmp with unreachable - admin prohibited filter

最近遇到一个问题,就是对方返回icmp:unreachable - admin prohibited filter,这个错误。是从tcpdump里显示出来的,根据tcpdump的源代码查看:

/* rfc1716 */
#ifndef ICMP_UNREACH_FILTER_PROHIB
#define ICMP_UNREACH_FILTER_PROHIB13/* admin prohibited filter */

这个里的13是rfc1716里定义的一个宏,错误码:
https://datatracker.ietf.org/doc/html/rfc1716

13 = Communication Administratively Prohibited - generated if a router cannot forward a packet due to administrative filtering;

下面进入debug,这种一看就应该是iptables给拒掉了,然后返回的这个错误码。
但是使用iptables -nL去查看设置规则,里面是空的。这个时候就想不明白了,只能到网上找线索,果不其然,iptables的功能被firewalld的功能给污染了,无法通过iptables来判断规则。
https://unix.stackexchange.com/questions/552857/why-are-my-network-connections-being-rejected

临时解决的方法是将firewalld关闭:
systemctl disable --now firewalld

而且下一次遇到的时候,还需要使用nft list ruleset 的命令来查看netfilter的规则,而不是用iptables。因为前者更具有普遍性。
在分析的过程中,还发现,其实这个错误的另外一个可能是设置了ip rule来prihibit外部包:
man ip-rule 里的相关说明,可以从这里看到ip-rule的设置,也可以达到相同的icmp的错误。
The RPDB may contain rules of the following types:
unicast - the rule prescribes to return the route found in the routing table referenced by the rule.
blackhole - the rule prescribes to silently drop the packet.
unreachable - the rule prescribes to generate a ‘Network is unreachable’ error.
prohibit - the rule prescribes to generate ‘Communication is administratively prohibited’ error.

这也算是CentOS/Redhat升级netfilter/默认安装firewalld相关功能的一个问题。需要增加潜意识的。


原文地址:https://blog.csdn.net/qq_36428903/article/details/137821360

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!