Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

So that would means,

localhost:10001 has the source address localhost:10002 ==> ... localhost:10256 ==> ... 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 ... ...

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

share|improve this question

1 Answer 1

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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