Во-первых, я должен поблагодарить @A.B за его ответ, который прояснил мою проблему. Хотя я пытался использовать политику для встроенной цепочки -без предоставления интерфейса, это сработало.....
[root@fedora29 ~]# iptables --table filter --policy INPUT DROP [root@fedora29 ~]# iptables --table filter --policy OUTPUT DROP [root@fedora29 ~]# iptables-save > /etc/network/iptables [root@fedora29 ~]# iptables-apply /etc/network/iptables Applying new ruleset... done. Can you establish NEW connections to the machine? (y/N) y ... then my job is done. See you next time.
Однако, когда я попытался составить список правил с помощью iptables -L
, я заметил, что новые правила не создавались, но политика правил изменялась, как показано...
[root@fedora29 ~]# iptables -L Chain INPUT (policy DROP) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy DROP) target prot opt source destination [root@fedora29 ~]# ping 10.0.3.1 PING 10.0.3.1 (10.0.3.1) 56(84) bytes of data. ping: sendmsg: Operation not permitted ping: sendmsg: Operation not permitted --- 10.0.3.1 ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 23ms [root@fedora29 ~]# iptables -S -P INPUT DROP -P FORWARD ACCEPT -P OUTPUT DROP
Нет причин хранить исходники, потому что вы всегда можете загрузить их снова.