LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Iptables -- Port Forwarding (https://www.linuxquestions.org/questions/linux-networking-3/iptables-port-forwarding-188830/)

slack_baby 06-02-2004 09:29 AM

Iptables -- Port Forwarding
 
i am using Slackware with IPTABLES latest version ..i have a webserver(192.168.0.3) inside my lan and i am forwarding my external traffic(say 213.130.x.x static IP) at 80 to my internal webserver at the same port

i use the following rule for it

$IPT -A FORWARD -p tcp -i ppp0 -d 192.168.0.3 --dport 80 -j ACCEPT
$IPT -t nat -A PREROUTING -p tcp -i ppp0 -d 213.130.x.x --dport 80 -j DNAT --to 192.168.0.3


its working perfectly and forwarding all traffic 2 my internal IP of other internet users

but the problem is that i cant browse my website on internal server (192.168.0.3) from any other computer on LAN

can u guys tell me where am i doing wrong

Regards

SlackBaby

maxut 06-02-2004 09:50 AM

your web server and local are located in 192.168.0.0/24 network?
if it is so i think it wont work.

if your webserver and local network are in different networks, i think u can do that with followings:
iptables -t nat -A PREROUTING -s local_net/subnet -d 213.130.x.x -p tcp --dport 80 -j DNAT --to 192.168.0.3
iptables -t nat -A POSTROUTING -s 192.168.0.3 -d local_net/subnet -p tcp --sport 80 -j SNAT --to linux_local_net_interface_ip

slack_baby 06-02-2004 10:14 AM

thankx maxut
i will try it

bagira 06-03-2004 02:29 PM

Can you reach your webserver by using the ip address, not the URL? Ensure, taht the URL is resolvable via DNS.
/bagira


All times are GMT -5. The time now is 08:31 PM.