All of lore.kernel.org
 help / color / mirror / Atom feed
* question about port forwarding using dnat
@ 2013-03-07 13:02 Hamed Afshar
  2013-03-07 20:56 ` Pascal Hambourg
  0 siblings, 1 reply; 2+ messages in thread
From: Hamed Afshar @ 2013-03-07 13:02 UTC (permalink / raw)
  To: netfilter

Hi,
I need to manipulate all output requests for an IP range and change the destination port.
For a specific IP, the following rule works for me:

iptables -t nat -A OUTPUT -p tcp -d 1.2.3.4 --dport 22 -j DNAT --to-destination 1.2.3.4:555

which is changing the destination port to 555 on all outgoing requests for port 22 for IP 1.2.3.4.
But I need to apply this to an IP range.
something like this:

iptables -t nat -A OUTPUT -p tcp -d 1.2.3.0/24 --dport 22 -j DNAT --to-destination 1.2.3.0/24:555

to do the following:
1.2.3.1:22 => 1.2.3.1:555
1.2.3.2:22 => 1.2.3.2:555
1.2.3.3:22 => 1.2.3.3:555
etc

iptables accepts IP range with "-d" switch. but as for "--to-destination", it doesn't accept IP range.

Does anyone have any idea how should I do this?

Thanks in advance
Hamed Afshar

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-07 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-07 13:02 question about port forwarding using dnat Hamed Afshar
2013-03-07 20:56 ` Pascal Hambourg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.