LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1091|回复: 0

关天路由静态IP地址转换问题?

[复制链接]
发表于 2003-4-24 10:38:50 | 显示全部楼层 |阅读模式
最近我想将我们内部IP的一台电脑转换成外部公网IP(内部IP为172.21.1.9 转换成 218.5.238.9)可没有成功!请问有哪位高手帮我解决一下?

iptables -t  nat -A POSTROUTING -s 172.21.1.9 -j SNAT  --to 218.5.238.9
iptables -t  nat -A PREROUTING  -d 218.5.238.9 -j DNAT --to 172.21.1.9

iptables -t nat -A POSTROUTING -s 172.21.1.9 -j RETURN
iptables -t nat -A POSTROUTING -d 172.21.1.9 -j RETURN

iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -F
iptables -A OUTPUT -p icmp --icmp-type host-redirect -j DROP
iptables -A OUTPUT -p icmp --icmp-type network-redirect -j DROP

iptables -A INPUT -p icmp --icmp-type host-redirect -j DROP
iptables -A INPUT -p icmp --icmp-type network-redirect -j DROP
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表