Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Phil Sutter <phil@ctekproducts.com>
To: netfilter@vger.kernel.org
Subject: port forwarding question
Date: Mon, 17 Mar 2008 09:26:35 -0700	[thread overview]
Message-ID: <1205771195.2681.14.camel@dev002.ctekproducts.com> (raw)

Hi,

We have been using commands like the following to forward a single port
on our Linux systems and it works fine:

iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 5080 -j DNAT --to
192.168.1.10:80

I am now trying to find a method for port forwarding a range of ports.
For instance, forwarding port 5080 - 5084 to ports 80 - 84 so that:
- port 5080 traffic ends up on port 80
- port 5081 traffic ends up on port 81
- port 5082 traffic ends up on port 82
- port 5083 traffic ends up on port 83
- port 5084 traffic ends up on port 84

I thought I could do the following but it does not work:

iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 5080:5085 -j DNAT
--to 192.168.1.10:80-85

Is there a way to do what I want to do with a single command or do I
have to forward each port with an individual command?

Thanks,

Phil Sutter



             reply	other threads:[~2008-03-17 16:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-17 16:26 Phil Sutter [this message]
2008-03-17 18:13 ` port forwarding question Jan Engelhardt
2008-03-17 18:32   ` Cloves Pereira Costa Jr
2008-03-17 20:01     ` Andrew Schulman
2008-03-18 16:36       ` Jan Engelhardt
  -- strict thread matches above, loose matches on Subject: below --
2009-05-06 18:25 Port Forwarding Question Aaron Clausen
2009-05-08 15:57 ` Michele Petrazzo - Unipex
     [not found]   ` <8ec0428d0905171444q4e8a75dj6e60bfbab93bc75d@mail.gmail.com>
2009-05-17 21:54     ` Aaron Clausen
2009-05-18  7:03       ` Покотиленко Костик
2007-04-30 17:37 Port forwarding question David
2007-05-02 12:00 ` Elvir Kuric
2006-09-21 19:55 Dimitri Yioulos
2006-09-21 20:23 ` Martijn Lievaart
2006-09-21 20:25 ` Mr Ritter
2006-09-21 20:32   ` Mr. Ritter
2006-09-21 20:53   ` Dimitri Yioulos
2006-09-21 21:14     ` Martijn Lievaart
2006-09-21 21:23       ` Dimitri Yioulos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1205771195.2681.14.camel@dev002.ctekproducts.com \
    --to=phil@ctekproducts.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox