iptables用配置nat转换



#clear all
iptable -F
# 允许内网卡接收源网络地址为 10.0.58.0/24 的数据包
iptables -A INPUT -i eth2 -s 10.0.58.0/24 -j ACCEPT

#允许目的网络地址为10.0.58.0/24的数据包从内网卡发送出去
iptables -A OUTPUT -o eth2 -d 10.0.58.0/24 -j ACCEPT

#允许转发内网卡接收的源网络地址为10.0.58.0/24的数据包
iptables -A FORWARD -i eth2 -s 10.0.58.0/24 -j ACCEPT

#允许转发目的网络地址为10.0.58.0/24的数据包从内网卡发送出去
iptables -A FORWARD -o eth2 -d 10.0.58.0/24 -j ACCEPT

#将所有从外网卡发送出去,源网络地址为10.0.58.0/24的数据包源地址伪装成172.16.58.136
iptables -t nat -A POSTROUTING -o eth1 -s 10.0.58.0/24 -j SNAT --to 172.16.58.136


posted @ 2013-05-23 09:19  mull  阅读(250)  评论(0编辑  收藏  举报