我正在尝试使用 IPtables 来保护 Portmap。为此,我应该拒绝从除192.168.0.0/24TCP 和 UDP 之外的所有 IP 接收包。
为此,我编写了这样的 IPtables 规则:
iptables -A INPUT -p tcp -s! 192.168.0.0/24 --dport 111 -j DROP
iptables -A INPUT -p udp -s! 192.168.0.0/24 --dport 111 -j DROP
Run Code Online (Sandbox Code Playgroud)
但我得到这样的错误:
Bad argument `192.168.0.0/24'
Try `iptables -h' or 'iptables --help' for more information.
Run Code Online (Sandbox Code Playgroud)
如何编辑规则以获得正确的规则?