簡單開使使用 iptables 防火牆在個人電腦上

本文介绍了如何在Debian系统中配置iptables防火墙,包括基本的规则设定、启动时自动加载配置的方法等。通过示例展示了如何阻止特定类型的TCP连接。

https://my.oschina.net/chuangpoyao/blog/72655

 

man iptables
man ip6tables

http://www.frozentux.net/documents/iptables-tutorial/

 

 

抓 iptables 東東

http://www.netfilter.org/projects/iptables/downloads.html

安裝

http://my.oschina.net/chuangpoyao/blog/57347

第一個防衛條件在個人電腦上

iptables -A INPUT -i eth0 -p tcp --syn -j DROP

所有 tcp 要求進來 eth0 丟掉

-----------------------------------------------------------------------

debian 開機自動化(對不起,不知其他版可用否):

存檔

iptables-save > /etc/iptables_rules.conf

 建自動化檔,下指令(這好像是 20120813 現在正規 iptables 官方建意,但這不能滿足我開機啟動 pppoe,pppoe 好像跟 /etc/network/if-up.d 無關)

echo \#\!\/bin\/sh > /etc/network/if-up.d/iptables 
echo "iptables-restore < /etc/iptables_rules.conf" >> /etc/network/if-up.d/iptables
echo "ip6tables-restore < /etc/ip6tables_rules.conf" >> /etc/network/if-up.d/iptables
chmod +x /etc/network/if-up.d/iptables

--------------------------------------

 或(現在 20120813 改用這,因 pppoe)

echo \#\!\/bin\/sh > /etc/init.d/firewall
echo "iptables-restore < /etc/iptables_rules.conf" >> /etc/init.d/firewall
echo "ip6tables-restore < /etc/ip6tables_rules.conf" >> /etc/init.d/firewall
chmod 755 /etc/init.d/firewall
update-rc.d firewall start 20 2 3 4 5 . stop 20 0 1 6 .

 

转载于:https://my.oschina.net/chuangpoyao/blog/59018

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值