All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sertys <sertys@supportivo.org>
To: Netfilter list <netfilter@lists.netfilter.org>
Subject: Re: Altering a packet's port
Date: Tue, 22 Mar 2005 00:00:04 +0200	[thread overview]
Message-ID: <opsn0cqeu476nf2y@xonix> (raw)
In-Reply-To: <00c501c52e56$acbe6070$bf07a8c0@civicXp>

On Mon, 21 Mar 2005 15:43:44 -0500, Nicolas Ross  
<rossnick-lists@cybercat.ca> wrote:

> Hi all !
>
> I have a quite "standard" setup as follow :
>
> 192.168.7.x/24 -> iptables/router  SNAT --to-source a.b.c.d  -> internet
>
> What I want to do, is that if a packet originites from the local net  
> (192.168.7.x) on tcp port 22, that the final destination of the packet  
> would wtill be the same host, but on port 8022...
>
> Like this :
>
> Normal :
>
> 192.168.7.1 ssh to f.g.h.i on port 22
>
> the connection is :
>
> 192.168.7.1:sport -> f.g.h.i:8022
>
> Is it possible ?
>
> I've tried with REDIRECT, but it afects the destination of the packet,  
> but I don't want that...
>
> Thanks,
>
> Nicolas

Redirect works on local hooks. Just DNAT it, dude.
iptables -t nat -A PREROUTING -p tcp -s 192.168.x.x --dport 22 -j DNAT  
--to-destination f.g.h.i:8022

It's crucial to define dport, not sport, cause your sport is not 22, it's  
a client port > 1024 and random.


-- 
www.supportivo.org

I can't stop myself checking for pigs in the outlets. Everybody thinks i'm  
a punk, cause of the hairstyle(220V).
end


  reply	other threads:[~2005-03-21 22:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-21 20:43 Altering a packet's port Nicolas Ross
2005-03-21 22:00 ` Sertys [this message]
2005-03-22  1:27   ` Nicolas Ross
2005-03-22 11:29     ` Jason Opperisano
2005-03-22 14:42       ` Nicolas Ross
2005-03-22 14:59         ` R. DuFresne
2005-03-22 15:12           ` R. DuFresne
2005-03-22 15:15             ` Nicolas Ross
2005-03-22 18:18               ` Toby
2005-03-22 18:29                 ` Toby
2005-03-22 18:49                   ` Nicolas Ross

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=opsn0cqeu476nf2y@xonix \
    --to=sertys@supportivo.org \
    --cc=netfilter@lists.netfilter.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 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.