在centos8主机上运行centos7容器时。在容器中,向一个链中添加一个iptables规则(例如,筛选表输入链),该规则不仅将被添加到输入链中,还将添加到其他链中(例如输出、前向、甚至PREROUTING、POSTROUTING)。
上运行centos8容器
docker run -it --privileged centos:8 sh
中安装iptable
yum install -y iptablesiptables -V
iptables version: v1.8.4 (nf_tables)iptables -t nat -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
# Warning: iptables-legacy tables present, use iptables-legacy to see themiptables -I INPUT -i eth0 -j REJECT添加了一个新规则:
iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- eth0 * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- eth0 * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- eth0 * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
# Warning: iptables-legacy tables present, use iptables-legacy to see them如果在centos8主机上运行centos8容器,则不会发生这种情况。
发布于 2020-12-03 11:27:32
一句话:主机和容器混合iptables和nftable。
https://stackoverflow.com/questions/65121302
复制相似问题