我在iptables中添加了以下IP地址作为目标的规则:
iptables -A FOR_FILTER -d 66.235.138.59 -j ACCEPT
它成功添加了以下结果:
ACCEPT all -- anywhere *.d1.sc.omtrdc.net
我想应用于66.235.138.59的规则将不起作用,因为这个DNSparsing。 我想添加IP地址,所以iptables不会添加已parsing的域。
像这样的东西(但它不起作用):
iptables -A FOR_FILTER -d "66.235.138.59" -j ACCEPT iptables -A FOR_FILTER -d '66.235.138.59' -j ACCEPT
iptables在内部使用IP地址,如果您不想在列出规则时看到任何DNS名称,请使用iptables -L -n – 禁用反向DNS查找。
两件事情你的问题。 一,CodePainters指出,你需要使用-n切换到iptable规则列表中的IP地址。
第二件事情是,iptables处理规则的顺序。 如果以前的规则禁止连接,则添加另一个规则(在链的末尾添加-A)将无济于事。 您需要分析整个configuration,而不仅仅是一个规则。
从手册页:
-s, --source [!] address[/mask] Source specification. Address can be either a network name, a hostname **(please note that specifying any name to be resolved with a remote query such as DNS is a really bad idea)**, network IP address (with /mask), or a plain IP address. -d, --destination [!] address[/mask] Destination specification. See the description of the -s (source) flag for a detailed description of the syntax. -n, --numeric Numeric output. IP addresses and port numbers will be printed in numeric format. By default, the program will try to display them as host names, network names, or services (whenever appli- cable).
当您添加规则时,请使用IP号码而不是名称。 在列出规则时,如果需要名称,则省略-n选项。 要加快速度并删除ns查找步骤,请将-n添加到您的-L中。
你说:“我想申请66.235.138.59的规则将不会工作,因为这个DNSparsing。
我说,DNS与它无关。