This is a discussion on Port Forwarding with iptables (sorry for first half post, sent by mistake) within the Linux Networking forums, part of the Linux Forums category; Hi there, I want to enable port forwarding (or NAT?) on my linux machine so that any packets on a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi there,
I want to enable port forwarding (or NAT?) on my linux machine so that any packets on a specified port from my ppp device are automatically forwarded to a particluar machine. I have tried the following but it doesnt work. Can someone tell me what I need to do? Do I also need to add rules to the INPUT/OUTPUT list? iptables -A PREROUTING -t nat -p tcp --dport 1111 -j DNAT --to 10.0.0.200:1111 Thanks Allan |
|
|||
|
In article <bii5i8$7vu$1@news.freedom2surf.net>, Allan Bruce wrote:
> I have tried the following but it doesnt work. Can someone tell me what I > need to do? Do I also need to add rules to the INPUT/OUTPUT list? Close, but not quite. INPUT is for packets destined for the firewall machine itself, and your DNAT rule changed the destination. FORWARD is the chain you need: iptables -I FORWARD -p tcp --dport 1111 -j ACCEPT > iptables -A PREROUTING -t nat -p tcp --dport 1111 -j DNAT --to \ > 10.0.0.200:1111 I used -I to ensure it works no matter what. The order of rules is important. You might not want to put it first in your rules, and it's probably best to put it in a user chain rather than directly in FORWARD. -- /dev/rob0 - preferred_email=i$((28*28+28))@softhome.net or put "not-spam" or "/dev/rob0" in Subject header to reply |