Linux Netfilter discussions
 help / color / mirror / Atom feed
* Quick Routing question
@ 2003-03-04 20:10 David Ruggles
  2003-03-04 20:47 ` Maciej Soltysiak
  2003-03-05  0:07 ` Arnt Karlsen
  0 siblings, 2 replies; 9+ messages in thread
From: David Ruggles @ 2003-03-04 20:10 UTC (permalink / raw)
  To: netfilter

I'm trying to learn netfilter so I've got a very simple setup.

I've got a Linux box with three interfaces. (I'm not using eth0 currently)
I've got two networks (eth2: 172.22.0.0 & eth1: 10.0.0.0)
I entered the following on the Linux box:
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to 10.9.0.254 (eth1's IP
address)

I've got a machine on each network: machine A is on 172.22.0.0 and machine B
is on 10.0.0.0
I'm trying to ping from A to B.
I can ping all the interfaces on the router but I can't ping B

I would expect to see the POSTROUTING chain counter increment for each ping
packet, but it doesn't. (It will increment if I ping from the Linux box to
B)

Any suggestions?

Thanks,
David Ruggles

CCNA MCSE (NT) CNA A+
Network Engineer, Safe Data, Inc
910-285-7200    david@safedatausa.com
0100011101101111011001000110110001101111011101100110010101110011011110010110
111101110101



^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Quick Routing Question
@ 2003-03-04 21:19 ImpulseFG
  0 siblings, 0 replies; 9+ messages in thread
From: ImpulseFG @ 2003-03-04 21:19 UTC (permalink / raw)
  To: netfilter

Hi,
   I think I've had this problem. When you try to ping a computer on 10.9.0.254/255.255.225.0 from 172.22.0.0 it sends the requests through the Routing box which changes the sorce IP to 10.9.0.254 and then sends the packet on to the destination computer on the 10.9.0.254/255.255.255.0 network. This packet reaches the computer and then is sent back to 10.9.0.254 and stops. It never goes all the way back to the 172.22.0.0 computer because the computer on 10.9.0.254 thinks the ping came from 10.9.0.254 because of the SNAT translation. 

To fix this problem you will have to do another nat function. DNAT. Someting like $iptables -t nat -A PREROUTING -d 10.9.0.254 -j DNAT --to 172.22.0.0-172.22.0.255 

or you could use -i eth2 instead of -d , I think.

This should get the packet back to the originating computer but then all packets will be routed you won't be able to ping the router form off the network because all the pings will be routed to the network behind it. So it would be better to put a -p scp/udp line in the above command. 

I hope this helps.

                                    -Impulse

__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-03-05 21:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-04 20:10 Quick Routing question David Ruggles
2003-03-04 20:47 ` Maciej Soltysiak
2003-03-05  0:07 ` Arnt Karlsen
2003-03-05 14:30   ` David Ruggles
2003-03-05 16:37     ` Arnt Karlsen
2003-03-05 18:14       ` David Ruggles
2003-03-05 21:02         ` David Ruggles
2003-03-05 21:36           ` A netfilter question David Ruggles
  -- strict thread matches above, loose matches on Subject: below --
2003-03-04 21:19 Quick Routing Question ImpulseFG

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox