不仅执行
sudo iptables -F
没有效果,我先用
sudo iptables -L -n -t nat --line-number
找到数字后删除也报错
sudo iptables -D PREROUTING 1
错误信息为iptables: No chain/target/match by that name.
iptables: No chain/target/match by that name.
认证0级讲师
Ubuntu can do this using iptables:
第一步先关闭ufw: sudo ufw disable && sudo ufw default allow 设置INPUT/FORWARD/OUTPUT为allow(注意:如果为deny,下一步将使系统的所有网络访问中断,包括ssh) sudo iptables -F && sudo iptables -X && sudo iptables -Z && sudo iptables -L sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT sudo iptables -A INPUT -i lo -j ACCEPT sudo iptables -A INPUT -p tcp -i eth0 --dport 22 -j ACCEPT sudo iptables -A INPUT -p tcp -i eth0 --dport 80 -j ACCEPT sudo iptables -A INPUT -j DROP iptables-save > /etc/iptables.up.rules 切换到root用户执行,sudo会提示无权限.Redhat的保存操作为service iptables save. sudo nano /etc/network/interfaces 在末尾添加一行,在网络启动时应用防火墙规则: pre-up iptables-restore < /etc/iptables.up.rules 查看设置的规则: sudo iptables -nvL --line-numbers 插入一条规则到INPUT链第6的位置: sudo iptables -I INPUT 6 -j DROP 修改INPUT链的第6条规则: sudo iptables -R INPUT 6 -j ACCEPT 删除INPUT链第6条规则: sudo iptables -D INPUT 6
Have you not enabled the iptables service? I've been tricked before and forgot to turn it on!
Ubuntu can do this using iptables:
Have you not enabled the iptables service? I've been tricked before and forgot to turn it on!