HI
u can also use NETMAP patch. can apply it from patch-o-matic
-Manish Kumar Arya
On Fri, 29 Mar 2002 01:03:53
EtherMage wrote:
>> I would like to NAT one /24 network into another /24 network.
>>
>> I need to hold the last octet constant:
>>
>>
>> A.B.C.1 --> X.Y.Z.1
>> A.B.C.2 --> X.Y.Z.2
>> ... (on down through the entire /24)
>>
>> Is there a single (or two) command(s) that would do this, or do I need to
>> have a DNAT and SNAT rule for each IP in the network?
>
>I don't know of one, but you could easily write a simple script to generate
>all 508 rules in 5 lines or so.
>
>This one's in Perl, just to demonstrate:
>$start_triplet="A.B.C.";
>$dest_triplet="X.Y.Z.";
>foreach $ip in (1..254) {
> system("iptables -t nat -s $start_triplet$ip -j SNAT --to
>$dest_triplet$ip");
> system("iptables -t nat -s $dest_triplet$ip -j DNAT --to
>$start_triplet$ip");
>}
>
>Note the trailing periods in the $start_triplet and $dest_triplet variables.
>
>Hope this helps,
>-EtherMage
>
>
>
>
See Dave Matthews Band live or win a signed guitar
http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp