- 论坛徽章:
- 0
|
没有那么复杂,iptables本身就可以实现,不连续的地址可以这样:
iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to-source 202.xxx.xxx.a --to-source 202.xxx.xxx.b --to-source 202.xxx.xxx.c
man iptables时有这样的解释:
--to-source ipaddr[-ipaddr][:port-port]
which can specify a single new source IP address, an inclusive range of IP addresses, and optionally, a port range (which is only valid if the rule also specifies -p tcp or -p udp). If no port range is specified, then source ports below 512 will be mapped to other ports below 512: those between 512 and 1023 inclusive will be mapped to ports below 1024, and other ports will be mapped to 1024 or above. Where possible, no port alteration will occur.
You can add several --to-source options. If you specify more than one source address, either via an address range or multiple --to-source options, a simple round-robin (one after another in cycle) takes place between these adresses.
[ 本帖最后由 pangty 于 2007-5-23 10:17 编辑 ] |
|