我正在尝试学习如何使用iptables
。我尝试通过 http 和 https 阻止所有流量。
我的输入和输出链是空的。
我最初做了以下事情:
sudo iptables -A OUTPUT -p tcp --dport 80 -j DROP
sudo iptables -A OUTPUT -p tcp --dport 443 -j DROP
但是,我仍然可以访问新网页,例如https://systemd.io/或https://fr.euronews.com/,但不能访问https://unix.stackexchange.com/
因为这还不够,所以我决定为 OUTPUT 链添加类似的规则......
sudo iptables -A INPUT -p tcp --sport 80 -j DROP
sudo iptables -A INPUT -p tcp --sport 443 -j DROP
我仍然可以访问那些网站......我不确定这是如何实现的。
在 FORWARD 链中,我有 3 条规则(重复多次),
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
我不确定它们是否影响输入链或输出链......