All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Mojtaba <mespio@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Issue related to conntrack while insert new rule with conntrack command in linux
Date: Fri, 26 Apr 2019 00:45:12 +0200	[thread overview]
Message-ID: <20190425224512.dz2fuwqrrq5hd2x6@salvia> (raw)
In-Reply-To: <CABVi_EwUrvJtE_iXodFXXVn5uqaVjh9fx1qFFqz5fCaLZiE28w@mail.gmail.com>

On Thu, Apr 25, 2019 at 07:38:20PM +0430, Mojtaba wrote:
> Hello all
> I read man conntrack document guide. That is great.
> I have a issue while i am working on it. For example i just want to insert
> new rule in conntrack table like this:
> conntrack -I -p udp -s 192.168.122.242 -d 192.168.122.103 --sport 5070
> --dport 5005 -r 192.168.122.1 -q 192.168.122.103 --reply-port-src 1111
> --reply-port-dst 2222 --timeout 30
> 
> it successfully inserted but doesn’t work and traffic will be go to INPUT chain.
> if i insert these two rules in iptables, the same above rules will be inserted
> in conntrack table automatically and works correctly.(the traffic will
> be traversed to 192.168.122.1 host)
> iptables -t nat -A PREROUTING -i eth0 -p udp -s 192.168.122.242
> --dport 5005 -j DNAT --to 192.168.122.1:1111
> 
> iptables -t nat -A POSTROUTING -p udp --dport 1111 -j SNAT --to
> 192.168.122.103:2222

Have a look at --dst-nat option, eg.

conntrack -I -p udp -s 192.168.122.242 -d 192.168.122.103 --sport 5070 --dport 5005 --dst-nat 192.168.122.1 --timeout 30

  reply	other threads:[~2019-04-25 22:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25 14:59 Issue related to conntrack while insert new rule with conntrack command in linux Mojtaba
2019-04-25 15:08 ` Mojtaba
2019-04-25 22:45   ` Pablo Neira Ayuso [this message]
2019-04-26 10:22     ` Mojtaba
2019-04-26 19:23     ` Mojtaba
2019-04-26 19:37       ` Pablo Neira Ayuso
2019-04-26 19:50         ` Mojtaba
2019-04-27  9:01           ` Mojtaba
2019-04-27  9:43             ` Pablo Neira Ayuso
2019-04-27 11:30               ` Mojtaba
2019-04-28  6:29                 ` Mojtaba
2019-04-28  8:02                   ` Mojtaba
  -- strict thread matches above, loose matches on Subject: below --
2019-04-25  9:22 Mojtaba Esfandiari

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=20190425224512.dz2fuwqrrq5hd2x6@salvia \
    --to=pablo@netfilter.org \
    --cc=mespio@gmail.com \
    --cc=netfilter-devel@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 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.