iptables规则允许添加更多的ip

我在我的iptables中有这个规则

target prot opt source destination DROP tcp -- !10.0.0.61 anywhere tcp dpt:sip DROP tcp -- !c-74-70-17-69.hsd1.co.comcast.net anywhere tcp dpt:sip DROP tcp -- !c-74-70-17-69.hsd1.co.comcast.net anywhere tcp dpt:http DROP tcp -- !c-74-70-17-69.hsd1.co.comcast.net anywhere tcp dpt:https 

正如你可以看到它允许sip,http或https。 现在,如果我使用这个添加另一个

iptables -I INPUT -p tcp! -s 10.0.0.61 –dport 443 -j DROP

也允许443 10.0.0.61,它不起作用,并显示这一点

 target prot opt source destination DROP tcp -- !10.0.0.61 anywhere tcp dpt:https DROP tcp -- !10.0.0.61 anywhere tcp dpt:sip DROP tcp -- !c-75-70-17-69.hsd1.co.comcast.net anywhere tcp dpt:sip DROP tcp -- !c-75-70-17-69.hsd1.co.comcast.net anywhere tcp dpt:http DROP tcp -- !c-75-70-17-69.hsd1.co.comcast.net anywhere tcp dpt:https 

我究竟做错了什么?

我会尽力描述你做什么和你想要什么。 通过您的规则,您可以删除所有来自sip,http,https所有数据包,除了10.0.0.61c-75-70-17-69.hsd1.co.comcast.net

如果你想允许stream量来自sip,http,https 10.0.0.61c-75-70-17-69.hsd1.co.comcast.net sip,http,https ,你应该添加规则:

 iptables -I INPUT -m state --state NEW -p tcp -s 10.0.0.61 -m multiport --dports 80,443,5060 -j ACCEPT iptables -I INPUT -m state --state NEW -p tcp -s c-75-70-17-69.hsd1.co.comcast.net -m multiport --dports 80,443,5060 -j ACCEPT