All of lore.kernel.org
 help / color / mirror / Atom feed
From: leroy christophe <christophe.leroy@c-s.fr>
To: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter@vger.kernel.org
Cc: GUITTON Alex <alex.guitton@c-s.fr>
Subject: Problem setting up nftables dnat : dport set to 0 instead of requested value (22)
Date: Wed, 10 Dec 2014 15:39:04 +0100	[thread overview]
Message-ID: <54885B08.1010700@c-s.fr> (raw)

Hi,

I'm trying to redirect incoming tcp connections for port 222 to local 
port 22 (because I will dnat incoming connections for port 22 to another 
destination).
I've set the following ruleset, and logs shows that the port get value 0 
instead of 22.

What am I doing wrong ?

Thanks
Christophe

[ 7621.325382] IN=eth0 OUT= 
MAC=08:00:51:20:44:5b:08:00:27:fe:42:1e:08:00 SRC=172.25.231.37 
DST=172.25.231.5 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=18010 DF PROTO=TCP 
SPT=54872 DPT=222 WINDOW=14600 RES=0x00 SYN URGP=0
[ 7621.325785] IN=eth0 OUT= 
MAC=08:00:51:20:44:5b:08:00:27:fe:42:1e:08:00 SRC=172.25.231.37 
DST=172.25.231.5 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=18010 DF PROTO=TCP 
SPT=54872 DPT=0 WINDOW=14600 RES=0x00 SYN URGP=0

# nft list ruleset -nn
table ip filter {
         chain input {
                  type filter hook input priority 0;
                  oifname "lo" accept
                  ct state established,related accept
                  ct state new tcp dport 22 log accept
                  ip protocol icmp accept
                  udp dport { 138, 1534, 137, 17500, 67, 631, 68} drop
                  log reject with icmp type host-prohibited
         }
}
table ip nat {
         chain prerouting {
                  type nat hook prerouting priority 0;
                  tcp dport 222 counter packets 1 bytes 60 log dnat :22
         }

         chain postrouting {
                  type nat hook postrouting priority 0;
                  ip saddr 192.168.0.3 oif eth1 masquerade
         }
}


             reply	other threads:[~2014-12-10 14:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 14:39 leroy christophe [this message]
2014-12-10 18:22 ` Problem setting up nftables dnat : dport set to 0 instead of requested value (22) Pablo Neira Ayuso
2014-12-10 20:29   ` Arturo Borrero Gonzalez
2014-12-11 13:12   ` leroy christophe
2014-12-12 10:08     ` leroy christophe
2014-12-12 10:16   ` bug : nft_redirect port byteorder issue leroy christophe
2014-12-12 10:49     ` Arturo Borrero Gonzalez
2014-12-12 11:07       ` leroy christophe
2014-12-12 11:55         ` Arturo Borrero Gonzalez
2014-12-12 12:55           ` leroy christophe
2014-12-12 15:25             ` Patrick McHardy
2014-12-12 16:20               ` leroy christophe
2014-12-12 16:40                 ` Patrick McHardy
2014-12-22 11:54     ` Pablo Neira Ayuso
2014-12-22 12:44       ` Patrick McHardy
2014-12-22 13:00         ` Pablo Neira Ayuso

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=54885B08.1010700@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=alex.guitton@c-s.fr \
    --cc=netfilter@vger.kernel.org \
    --cc=pablo@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.