CentOS 8の不思議なiptableルール

CentOS 8の不思議なiptableルール

システムの再起動時にiptableの規則に従います。には定義されていません/etc/sysconfig/iptables

私は彼らがどこから来たのかわかりません。実際に定義されたルールは/etc/sysconfig/iptablesテーブルにもないため除外されます(前のセクションを参照)。

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:53
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:67
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:67

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            192.168.122.0/24     ctstate RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:68

問題を取り除いてfirewalldデバッグnftablesしましたが、違いはありません。私もiptablesそれを無効にしました。

[root@dan ~]# systemctl status firewalld
Unit firewalld.service could not be found.
[root@dan ~]# systemctl status nftables
Unit nftables.service could not be found.
[root@dan ~]# systemctl status iptables
iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)
Active: inactive (dead)

ドッカーが疑われますが、無効になっています。

[root@dan ~]# systemctl status docker
systemctl status dockerdocker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: https://docs.docker.com

また、一致するテキスト/ルールを見つけようとしましたが、幸運ではあり/etcませんでした。

[root@dan ~]# find /etc -type f -exec grep "192.168.122.0" {} /dev/null \;

再起動するとiptables正しくロードされるため、/etc/sysconfig/iptables起動順序に問題があるようです。

[root@dan ~]# systemctl restart iptables
[root@dan ~]# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
 

これをデバッグする方法についてのアイデアや洞察力はありますか?

ベストアンサー1

おすすめ記事