Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Salim" <salim.si@askey.com.tw>
To: Rob Sterenborg <rob@sterenborg.info>, netfilter@lists.netfilter.org
Subject: Re: iptables: can't set any ip address in rules
Date: Mon, 5 Sep 2005 14:53:13 +0800	[thread overview]
Message-ID: <009701c5b1e6$8dfe12c0$205f030a@askeyrd3> (raw)
In-Reply-To: 62340.193.173.147.3.1125901998.squirrel@193.173.147.3

> Hello all,
>     I am not able to set any rule that contsin ip address in the iptables.
> For example I give this command
>
>>iptables -t -A PREROUTING -d 1.1.1.1 -j DNAT --to-destination 2.2.2.2
           ^^^^^^^^^^^^^^^^
-t nat -A PREROUTING

You forgot "nat" after -t. Is that a typo or is this the actual rule you
are using ?

[Salim] sorry, that was a typo. the actual rule includes -t nat

> then, I issue the command >iptables -t nat -L.
>
> the result is
>
> Chain POSTROUTING (policy ACCEPT)
> target           DNAT
> prot              all
> opt                --
> source          anywhere
> destination    0.0.0.0   to:0.0.0.0

You just added a PREROUTING rule, and now you're checking if a POSTROUTING
rule is correct...
Furthermore : POSTROUTING doesn't have DNAT (it has SNAT) so the result of
"iptables -t nat -L" are probably not copy-and-pasted.

[Salim] again, it was another typo. it is PREROUTING chain. my linux is in
another machine, so I couldn't copy and paste. I typed in manually.

> I gave the command with verbose
>>iptables -v -t -A PREROUTING -d 1.1.1.1 -j DNAT --to-destination 2.2.2.2
>
> it showed
> DNAT all opt -- in * out * 0.0.0.0/0 -> 0.0.0.0 to:0.0.0.0

Again : -t nat

...
> I am confused. Any help will be greatly appreciated.

Don't know if it will solve your problem but :
- use "-t nat", not just "-t"
- check the chain you're adding a rule to (if it's PREROUTING, check
PREROUTING, not POSTROUTING)


Gr,
Rob






  reply	other threads:[~2005-09-05  6:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-05  6:01 iptables: can't set any ip address in rules Salim
2005-09-05  6:33 ` Rob Sterenborg
2005-09-05  6:53   ` Salim [this message]
2005-09-07  7:36 ` Salim
2005-09-07  8:42   ` Sascha Reissner
2005-09-07  8:46     ` Rob Sterenborg
2005-09-07  8:43   ` Sascha Reissner
2005-09-07  9:10     ` Salim

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='009701c5b1e6$8dfe12c0$205f030a@askeyrd3' \
    --to=salim.si@askey.com.tw \
    --cc=netfilter@lists.netfilter.org \
    --cc=rob@sterenborg.info \
    /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