在 iptables 中添加一条规则,目标 ip 不会解析到它的域

PyT*_*hoN 6 domain-name-system linux iptables

我在 iptables 中添加此规则,并使用以下 IP 地址作为目标:

iptables -A FOR_FILTER -d 66.235.138.59 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

它成功添加了它,结果如下:

ACCEPT     all  --  anywhere             *.d1.sc.omtrdc.net
Run Code Online (Sandbox Code Playgroud)

由于此 DNS 解析,我想应用于 66.235.138.59 的规则将不起作用。我想按原样添加 IP 地址,因此 iptables 不会添加解析的域。

像这样(但它不起作用):

iptables -A FOR_FILTER -d "66.235.138.59" -j ACCEPT
iptables -A FOR_FILTER -d '66.235.138.59' -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

小智 9

iptables 在内部使用 IP 地址,如果您在列出规则时不想看到任何 DNS 名称,请使用iptables -L -n- 它禁用反向 DNS 查找。