[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: NAT iptables routing issue



I think you should be more explicit in your firewall rules.

I would suggest the following - 

FORWARD traffic
DNAT traffic from any/0 to EXT/IP:80 to B:80
SNAT traffic from lan to EXT/IP to A INT/IP
SNAT traffic from lan to any/0  from A EXT/IP

Ensure you allow established/related for both.

On Thu, 2004-07-08 at 13:13, Caveman wrote:
> Hi all,
> 
> I have a slight problem I am not sure how to get around.
> Firstly let me draw you a picture. I have computer 'A' which is directly 
> connected to the internet and is the ONLY computer to have a internet IP. 
> It routes (via nat ) traffic from clients on the lan to the internet etc.
> 
> Now on box 'B' I have a webserver running and I have forwarded (using 
> prerouting) port 80 to box 'B''s LOCAL IP. This works fine for people outside 
> my network (IE, the internet) but I cant access the webserve by using the 
> internet IP from the lan, its never been a big issue, but i have finally 
> decided that I need to work out how to fix this.
> 
> Any ideas ? The below code is my NAT and prerouting stuff i have setup. I know 
> that the postrouting rule i have now is whats causing the issue, but I am 
> unsure as to how I should get around this.
> 
> 
> Thanks.
> 
> Caveman
> 
> -----------------------------------
> #NOTE eth0 is connected to the internet, eth1 is lan.
> # flush any old rules
> $IPTABLES -F -t nat
> # turn on POSTROUTING
> $IPTABLES -A POSTROUTING -t nat -o eth0 -j MASQUERADE
> #forward port 80 from INTERNET IP connections to 192.168.0.2 port 80
> $IPTABLES -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to 
> 10.1.1.2:80
> ------------------------------------------------------------
> 
> 
> 



Reply to: