我需要在防火墙中阻止所有传入和传出连接,除了白名单中的 IP 地址。我目前在使用 ubuntu 的虚拟机上。我从这个网站尝试了这些命令:但是我无法连接到这个网站,它是谷歌,但是 ping 工作,我没有使用 linux 的经验,其他网站也不能工作。
iptables -A INPUT -s 172.217.23.206 -j ACCEPT
iptables -A OUTPUT -d 172.217.23.206 -j ACCEPT
iptables -P INPUT DROP
iptables -P OUTPUT DROP
Run Code Online (Sandbox Code Playgroud)