Re: iptables: can't set any ip address in rules

ulrich schwarz <[email protected]>
Newsgroups gmane.network.nocat
Message-ID <[email protected]>
Salim wrote:

> 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

hello salim,

if you omit the table name after the -t parameter, AFAIK the filter
table is assumed as default. in other words, the above statement gets
interpreted as follows:

iptables -t filter -A PREROUTING -d 1.1.1.1 -j DNAT --to-destination 2.2.2.2

unfortunately, there is no prerouting chain in the filter table, this
chain only exists in the nat and mangle tables.

i suppose the command you are looking for is:

iptables -t nat -A PREROUTING -d 1.1.1.1 -j DNAT --to-destination 2.2.2.2

i always loved this page for such issues, especially the diagram that
shows how packets travel through the chains and tables:

http://iptables-tutorial.frozentux.net/iptables-tutorial.html#TRAVERSINGOFTABLES

you can also try something simple like

iptables -t filter -A INPUT -d 192.168.1.1 -j DROP
iptables -L

to see if your iptables work.

[...]
> I am using Redhat Linux 2.4.25
> iptables v1.3.3
> MIPS embedded system.
> 
> I am confused. Any help will be greatly appreciated.
> 
> regards
> Salim

HTH, regards,

ulric
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.