From: "Chen Ding" Subject: NAT Forwarding Problem Date: Mon, 16 Sep 2002 13:22:40 -0500 Sender: netfilter-admin@lists.netfilter.org Message-ID: <001201c25dae$0d31dee0$6501a8c0@JCC> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000F_01C25D84.219563E0" Return-path: Errors-To: netfilter-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: To: netfilter@lists.netfilter.org This is a multi-part message in MIME format. ------=_NextPart_000_000F_01C25D84.219563E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi All, I have encountered a wiered (or maybe a stupid) problem with iptables = NAT forwarding.=20 -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------- Settings: -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------- I have four machines in the setting: Machine A: 192.168.1.81 RedHat 7.3 Machine B: 192.168.1.17 RedHat 7.3 Machine C: 192.168.1.101 Microsoft XP Machine D: An public IP address RedHat 7.3 On Machine A, I have just one Rule: iptables -t nat -A PREROUTING -d 192.168.1.81 -j DNAT = --to-destination 192.168.1.17 On Machine A, B, and D, ipchains were disabled, iptables were enabled. = Running rpm -q iptables gave me: iptables-1.2.5-3 On Machine B/D, no rules were set, defauled to accept all. -------------------------------------------------------------------------= -------------------------------------------------------------------------= --------- -------------------------------------------------------------------------= -------------------------------------------------------------------------= --------- Problems: -------------------------------------------------------------------------= -------------------------------------------------------------------------= --------- pings: 1. Machine C to ping 192.168.1.81: OK (should actually ping = 192.168.1.17) 2. Machine C to ping 192.168.1.17: OK=20 3. Machine A to pring 192.168.1.17: OK telnet:=20 1. Machine C to telnet 192.168.1.17: OK 2. Machine A to telnet 192.168.1.17: OK 3. Machine C to telnet 192.168.1.81: No response According to the rule, when Machine C telneting Machine A, Machine A = should forward packets to Machine B, resulting in telneting Machine B. = If use netstat, it did tell us that Machine A forwarded several packets. However, if I change the rule on Machine A to forward all packets to = Machine D, everything works just fine. Machine C can telnet Machine A, = which ends up telneting Machine D. -------------------------------------------------------------------------= -------------------------------------------------------------------------= --------- Having struggled for several days, I am desperate!!!!!!!!! Your help is = GREATLY appreciated! My questions are: 1. Is there anything wrong in my understanding of iptables? 2. Anything wrong in the setting? Thanks! Chen Ding ------=_NextPart_000_000F_01C25D84.219563E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi All,
 
I have encountered a wiered (or maybe a = stupid)=20 problem with iptables NAT forwarding.
 
----------------------------------------------------------------= -------------------------------------------------------------------------= -----------------
Settings:
----------------------------------------------------------------= -------------------------------------------------------------------------= -----------------
I have four machines in the = setting:
    Machine A: =    =20        =20 192.168.1.81         =    =20     RedHat 7.3
    Machine=20 B:            = ; 192.168.1.17   =20              RedHat=20 7.3
    Machine=20 C:            = ; 192.168.1.101         = ; =20     Microsoft XP
    Machine=20 D:            = ; An=20 public IP address      RedHat = 7.3
 
On Machine A, I have just one = Rule:
 
    iptables -t nat -A = PREROUTING -d=20 192.168.1.81 -j DNAT --to-destination 192.168.1.17
 
On Machine A, B, and D, ipchains were = disabled,=20 iptables were enabled. Running rpm -q iptables gave me:
 
       =20         iptables-1.2.5-3
 
On Machine B/D, no rules were set, = defauled to=20 accept all.
----------------------------------------------------------------= -------------------------------------------------------------------------= ------------------
 
 
----------------------------------------------------------------= -------------------------------------------------------------------------= ------------------
Problems:
----------------------------------------------------------------= -------------------------------------------------------------------------= ------------------
    pings:
    1. Machine C to = ping=20 192.168.1.81:         OK = (should=20 actually ping 192.168.1.17)
    2. Machine = C to ping=20 192.168.1.17:         OK=20
    3. Machine A to = pring=20 192.168.1.17:        OK
 
    telnet: =
    = 1. Machine C to=20 telnet = 192.168.1.17:       OK
    2. Machine A to = telnet=20 192.168.1.17:       OK
    3. Machine = C to telnet=20 192.168.1.81:       No = response
 
According to the rule, when Machine C = telneting=20 Machine A, Machine A should forward packets to Machine B, = resulting in=20 telneting Machine B. If use netstat, it did tell us that Machine A = forwarded=20 several packets.
 
However, if I change=20 the rule on Machine A to forward all packets to Machine D, everything = works just=20 fine. Machine C can telnet Machine A, which ends up telneting = Machine=20 D.
----------------------------------------------------------------= -------------------------------------------------------------------------= ------------------
 
 
 
Having struggled for several days, I am = desperate!!!!!!!!!  Your help is GREATLY appreciated!
 
My questions are:
    1. Is there anything = wrong in my=20 understanding of iptables?
    2. Anything wrong in = the=20 setting?
 
 
Thanks!
 
Chen Ding
 
 
------=_NextPart_000_000F_01C25D84.219563E0--