六 052009
SNAT和DNAT是通过NAT表实现的
SNAT:
将172.16.1.78转换成192.168.1.19
iptables -t nat -A POSTROUTING -s 172.16.1.78 -j SNAT --to-source 192.168.1.19
DNAT:
iptables -t nat -A PREROUTING -d 192.168.1.19 -p tcp -m tcp --dport 80 -j DNAT --to-destination 172.16.1.78
这样访问192.168.1.19的端口就会转发到172.16.1.78的80端口上,如果想转发到172.16.1.78的8080端口上,可以用如下命令
iptables -t nat -A PREROUTING -d 192.168.1.19 -p tcp -m tcp --dport 80 -j DNAT --to-destination 172.16.1.78:8080
当然还需要在filter里允许访问80,8080端口,当然,这里允许了对局域网所有主机80,8080端口的访问,为安全,应该进一步细化规则
iptables -A FORWARD -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A FORWARD -p tcp -m tcp --dport 8080 -j ACCEPT
Posted by admin
Tagged with: iptables, Linux
六 052009
/usr/local/sbin/iptables -P INPUT ACCEPT
/usr/local/sbin/iptables -P FORWARD ACCEPT
/usr/local/sbin/iptables -P OUTPUT ACCEPT
#
# reset the default policies in the nat table.
#
/usr/local/sbin/iptables -t nat -P PREROUTING ACCEPT
/usr/local/sbin/iptables -t nat -P POSTROUTING ACCEPT
/usr/local/sbin/iptables -t nat -P OUTPUT ACCEPT
#
# flush all the rules in the filter and nat tables.
#
/usr/local/sbin/iptables -F
/usr/local/sbin/iptables -t nat -F
#
# erase all chains that's not default in filter and nat table.
#
/usr/local/sbin/iptables -X
/usr/local/sbin/iptables -t nat -X'
转载自:http://www.7880.com/Info/Article-657b9d40.html
Posted by admin
Tagged with: iptables
五 142009
本文将对iptables的配置做一个综述并且重点介绍一些iptables的配置工具。本文的讨论将着眼于linux内核的IP防火墙以及其各种界面的配置工具,比如:GUI或者脚本(shell、Perl或者特定的配置语言)。使用这些工具能够简化iptables的配置减少配置的错误。关于 iptables的知识请参考Rusty Russell写的Linux iptables HOWTO。
Continue reading »
Posted by admin
Tagged with: iptables, Linux
五 082009
* 限制特定封包傳入速度
* 限制特定埠口連入頻率
* iptables Log 記錄參數備忘
* 自定 Chain 使用備忘
* 防治 SYN-Flood 碎片攻擊
Continue reading »
Posted by admin
Tagged with: iptables, Linux
七 112008
这个是在物理机环境下做的,系统有两块网卡,eth0用于ADSL拨号,eth1用于连接局域网内的主机,保持eth0,eth1为激活状态。
1、建立拨号连接
按照以下步骤操作:
系统 ---> 管理 ----> 网络 ---> 新建 ---> 添加新设备类型--->选择xDSL 连接,输入用户名和密码,然后点击激活,文件 ---> 保存
此时,系统应该拨号成功并可以上网
Continue reading »
Posted by admin
Tagged with: iptables, Linux, NAT