扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:51cto 2007年10月14日
关键字:
在本页阅读全文(共2页)
-A PREROUTING –p tcp --dport 110 –j ACCEPT -A PREROUTING –p tcp --dport 25 –j ACCEPT -A FORWARD –p tcp --dport 110 –j ACCEPT -A FORWARD –p tcp --sport 110 –j ACCEPT -A FORWARD –p tcp --dport 25 –j ACCEPT -A FORWARD –p tcp --sport 25 –j ACCEPT |
-A PREROUTING –i eth0 –p tcp –d 218.100.100.111 --dport 80 –j DNAT --to-destination 192.168.5.179:80 -A PREROUTING –i eth1 –p tcp –d 218.100.100.111 –dport 80 –j DNAT –to-destination 192.168.5.179:80 |
-A POSTROUTING –s 192.168.5.0/24 –j SNAT –to 218.100.100.111 之后加上一句: -A POSTROUTING –p tcp --dport 80 –j ACCEPT |
数据源 : ip:199.199.199.199 sport:12345 数据目标: ip:218.100.100.111 dport 80 此时,通过-A PREROUTING –i eth0 –p tcp –d 218.100.100.111 --dport 80 –j DNAT --to-destination 192.168.5.179:80 告诉199.199.199.199,您要访问的真正地址应该是192.168.5.179:80,然后我们通过-A POSTROUTING –p tcp --dport 80 –j ACCEPT 目标地址218.100.100.111:80伪装成 192.168.5.179:80 。 数据源 : ip:199.199.199.199 sport:12345 数据目标: ip:192.168.5.179 dport 80 当192.168.5.179返回数据时: 数据源 : ip:192.168.5.179 sport:80 数据目标: ip:199.199.199.199 dport 12345 数据经过 -A POSTROUTING –s 192.168.5.0/24 –j SNAT –to 218.100.100.111 后, 数据源 : ip:218.100.100.111 sport:80 数据目标: ip:199.199.199.199 dport 12345 |
*nat :PREROUTING DROP [0:0] :OUTPUT DROP [0:0] :POSTROUTING DROP [0:0] -F -Z -X -A PREROUTING –i eth0 –p tcp –d 218.100.100.111 --dport 80 –j DNAT --to-destination 192.168.5.179:80 -A PREROUTING –i eth1 –p tcp –d 218.100.100.111 --dport 80 –j DNAT –to-destination 192.168.5.179:80 -A PREROUTING –p tcp --dport 80 –j ACCEPT -A PREROUTING –p udp --dport 53 –j ACCEPT -A PREROUTING –p tcp --dport 22 –j ACCEPT -A PREROUTING –p tcp --dport 1863 –j ACCEPT -A PREROUTING –p tcp --dport 443 –j ACCEPT -A PREROUTING –p tcp --dport 8000 –j ACCEPT -A PREROUTING –p udp --dport 8000 –j ACCEPT -A PREROUTING –p udp --dport 4000 –j ACCEPT -A PREROUTING –p tcp --dport 110 –j ACCEPT -A PREROUTING –p tcp --dport 25 –j ACCEPT -A POSTROUTING –s 192.168.5.0/24 –j SNAT –to 218.100.100.111 -A POSTROUTING –p tcp --dport 80 –j ACCEPT -L –v COMMIT *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT DROP [0:0] -F -Z -X -A INPUT –p tcp --dport 22 –j ACCEPT -A OUTPUT –p tcp --sport 22 –j ACCEPT -A FORWARD –p tcp --dport 80 –j ACCEPT -A FORWARD –p tcp --sport 80 –j ACCEPT -A FORWARD –p udp --dport 53 –j |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。