LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Port Forwarding Help (https://www.linuxquestions.org/questions/linux-networking-3/port-forwarding-help-163254/)

d0ugb 03-28-2004 12:13 AM

Port Forwarding Help
 
Okay, i have asked this questions before and gotten a few answers but for some reason i can never get this to work, and im sure its just something very small and stupid im leaving out but if someone could let me know what to do i would really be grateful.

I have a linux box running suse 9.1 pro, im using a basic firewall to route the internet around my home, i run a webcam server on one of my pc's on port 8080. This program posts the video in a webserver type environment when ever u access the server, i would like people to be able to access it by opening up thier web browser and typing whatever.com:8080. This is what my firewall consists of...

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -j ACCEPT

Now in previous posts i have gotten these two options as a solution, but it doesnt seem to work. BTW, im using dhcpd as a dhcp server, however my windows box with the webcam serevr is running a static ip. Here is the advice i recieved in a previous post
-------------------
iptables -A FORWARD -p tcp -i ethX -d your.int.ip.addy --dport 8080 -j ACCEPT

iptables -t nat -A PREROUTING -p tcp -i ethX --dport 1256 -j DNAT --to-destination your.int.ip.addy:8080

Replace ethX with your external/public device and your.int.ip.addy with the address of your windows box.
--------------------

If anyone can see what im doing wrong it would be very helpful.

maze_fire 09-15-2004 12:27 PM

i ran across your post, even though it was posted a few months ago, if you haven't found a solution, here's what worked for me... i have the basic port forwarding iptables arguments as follows (btw, eth0 is internet nic);

iptables -F -t nat

iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward


now for port forwarding i am using;

iptables -t nat -A PREROUTING -p TCP --dport 5901 -j DNAT --to-destination 10.0.0.100:5901


ofcourse, change the type of protocol you're using to either tcp or udp, the port number to be forwarded and the ip address local to your lan:local port number.... i am using rh9 box as router/dhcp server (no squid) and everything works perfect for me...hopefully this will help you out...


All times are GMT -5. The time now is 05:27 PM.