Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Stuart Lamble" <stu@gateway10.homeip.net>
To: netfilter@lists.netfilter.org
Cc: 'Antony Stone' <Antony@Soft-Solutions.co.uk>
Subject: RE: DNAT not working
Date: Sat, 20 Mar 2004 19:47:07 +0200	[thread overview]
Message-ID: <000001c40ea3$5da32e90$0464a8c0@stu> (raw)
In-Reply-To: <200403182050.33327.Antony@Soft-Solutions.co.uk>

Hi Antony

Output from iptables -L -t nat
--------------------------------------------------------
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
DNAT       tcp  --  anywhere             xxx.xxx.xxx.xxx dpt:msg-icp
to:192.168.100.6:29 

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
MASQUERADE  all  --  192.168.100.0/28     anywhere           

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  
------------------------------------------------------------

Output of iptables -L
--------------------------------------------------------------
Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere           
ACCEPT     all  --  anywhere             anywhere           
ACCEPT     all  --  anywhere             anywhere           
ACCEPT     icmp --  anywhere             anywhere           
ACCEPT     tcp  --  anywhere             anywhere           tcp spt:smtp

ACCEPT     udp  --  anywhere             anywhere           udp
spt:domain 
ACCEPT     tcp  --  anywhere             anywhere           tcp spt:http

DROP       tcp  --  anywhere             anywhere           tcp dpt:ftp 
ACCEPT     tcp  --  anywhere             anywhere           tcp dpt:ssh 
ACCEPT     tcp  --  anywhere             anywhere           tcp dpt:smtp

ACCEPT     tcp  --  anywhere             anywhere           tcp
dpt:msg-icp 
ACCEPT     tcp  --  anywhere             anywhere           tcp
multiport ports msg-icp 
ACCEPT     tcp  --  anywhere             anywhere           tcp dpt:http

ACCEPT     tcp  --  anywhere             anywhere           tcp
dpt:https 
ACCEPT     tcp  --  anywhere             anywhere           tcp dpt:ndmp

ACCEPT     all  --  anywhere             anywhere           state
RELATED,ESTABLISHED 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere           tcp
multiport ports msg-icp 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

---------------------------------------------------------------

The port in question is 29, ssh modified for 29 as the gateway with the
dsl connected has ssh running on port 22, so makes sense to use another
port, else I would always get the gateway ssh responding.

Note that I am using webmin firewall to configure the iptables.

I do get the counters incrementing on the prerouting rule.
From the gateway machine I am able to ssh -p 29 192.168.100.6
The gateway machine has two network cards, internal eth 1 =
192.168.100.1 and external eth0 = $IP.
The virtual ppp0 comes up with the Public IP.

Thanks Stuart







-----Original Message-----
From: netfilter-admin@lists.netfilter.org
[mailto:netfilter-admin@lists.netfilter.org] On Behalf Of Antony Stone
Sent: Thursday, March 18, 2004 10:51 PM
To: netfilter@lists.netfilter.org
Subject: Re: DNAT not working


On Thursday 18 March 2004 8:26 pm, Stuart Lamble wrote:

> Hello netfilter lists

Hello Stuart.

> iptables -t nat -A PREROUTING -i ppp0 -p tcp -d $FW-EXT-IP --dport 22 
> -j DNAT --to 192.168.100.6:22
>
> Simply put I want to allow ssh from the internet to a server on my 
> LAN, 192.168.100.6 My FORWARD rule is default accept.

Ugh :(   I trust you are going to change that very soon :)

> I understand that a packet comes into the firewall on an interface and

> then gets PREROUTED as above the gets passed to FORWARD = accept then 
> to the destination???

Yes, that is the correct mechanism.

> Why is it not working? Do i need to do any special kernel, modprobe 
> things?

No, the above rule, combined with a (gulp) default ACCEPT policy on
FORWARD, 
should do what you want.

I suggest the following:

1. Post the remainder of your ruleset so we can see what else may be
having an 
effect.

2. Tell us how you are testing the rule.

3. Look at the output of "iptables -L -t nat -nvx" - do the packet &
byte 
counters show that any packets are matching the above rule?

4. Put a LOGging rule in your FORWARD chain so you can see what packets
appear 
to be going through the firewall (I suggest two rules, one for packets
to TCP 
port 22, one for packets from TCP port 22, or alternatively two rules
for 
packets to / from 192.168.100.6, so that you don't get so much logging
output 
that you can't see what's going on).

5. Tell us about anything else which *does* work through your firewall
(eg: 
can you browse the Internet from an internal client? can you send &
receive 
email? can you resolve hostnames?)

Hope something here helps,

Antony.

-- 
Anyone that's normal doesn't really achieve much.

 - Mark Blair, Australian rocket engineer

                                                     Please reply to the
list;
                                                           please don't
CC me.



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.631 / Virus Database: 404 - Release Date: 3/17/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.634 / Virus Database: 406 - Release Date: 3/18/2004
 



  reply	other threads:[~2004-03-20 17:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18 20:26 DNAT not working Stuart Lamble
2004-03-18 20:49 ` John A. Sullivan III
2004-03-18 21:58   ` Antony Stone
2004-03-18 20:50 ` Antony Stone
2004-03-20 17:47   ` Stuart Lamble [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-04-18 16:26 Payal Rathod
2007-04-18 17:34 ` Martijn Lievaart
2007-04-19  3:31   ` Payal Rathod
2007-04-19 11:15     ` Gáspár Lajos
2007-04-19 17:18       ` Payal Rathod
2006-12-22 15:03 Balazs Fulop
2006-12-22 20:38 ` Grant Taylor
2006-12-22 21:14   ` Pascal Hambourg
2006-12-26 20:54     ` Balazs Fulop
2004-07-12 15:12 DNAT Not working Nicolas Ross
2004-07-12 15:59 ` Antony Stone
2004-07-12 16:13   ` Nicolas Ross
2004-07-12 16:33     ` Antony Stone
     [not found] <20031224052809.18657.42710.Mailman@netfilter-sponsored-by.noris.net>
2003-12-24 10:24 ` DNAT NOT WORKING madhav bhasin
2003-12-24 10:33   ` Antony Stone
2003-12-25 18:31   ` Thomas Scheffczyk

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='000001c40ea3$5da32e90$0464a8c0@stu' \
    --to=stu@gateway10.homeip.net \
    --cc=Antony@Soft-Solutions.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox