1

So i have this linux router, that has 2000 differents ips. And i want to redirect local source ports between 10001 and 12000 linearly from source addresses in the subnet 192.168.0.0/21

So that would means,

localhost:10001 has the source address 192.168.0.1 localhost:10002 ==> 192.168.0.2 ... localhost:10256 ==> 192.168.1.1 ... etc

I know how to do that with 2000 lines of iptables, like this :

iptables -A POSTROUTING -t nat -p tcp --sport 10001 -j SNAT --to-source 192.168.0.1 ... ...

But what i'm after is avoiding doing 2000 lines of iptables and use port range/address range of iptables or somekind of trick that could be possible.

Anyone ?

Many thanks

0

Mmmm... I don't think so. You will need 2000 rules. Although you don't have to do them all manually.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.