linux – 白名单使用iptables允许IP(输入/输出)

前端之家收集整理的这篇文章主要介绍了linux – 白名单使用iptables允许IP(输入/输出)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有几个ip范围,我希望我的服务器能够连接和用户连接.其他一切都应该被阻止.

我应该如何用iptables做到这一点?

我的操作系统是基于Debian的Linux发行版.

解决方法

我建议抓一个防火墙配置工具,比如 Firestarter,然后从那里开始.不过,这里有一些基础知识. @H_301_10@#Flush existing rules iptables -F # Set up default DROP rule for eth0 iptables -P INPUT DROP # Allow existing connections to continue iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT # Accept everything from the 192.168.1.x network iptables -A INPUT -i eth0 -s 192.168.1.0/24 -j ACCEPT # Allow connections from this host to 192.168.2.10 iptables -A OUTPUT -o eth0 -d 192.168.2.10 -j ACCEPT

猜你在找的Linux相关文章