Bluehost.com Web Hosting $6.95

Port Forwarding with iptables (sorry for first half post, sent by mistake)

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 ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-27-2003
Allan Bruce
 
Posts: n/a
Default Port Forwarding with iptables (sorry for first half post, sent by mistake)

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


Reply With Quote
  #2 (permalink)  
Old 08-27-2003
/dev/rob0
 
Posts: n/a
Default Re: Port Forwarding with iptables (sorry for first half post, sent by mistake)

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
Reply With Quote
  #3 (permalink)  
Old 08-27-2003
Allan Bruce
 
Posts: n/a
Default Re: Port Forwarding with iptables (sorry for first half post, sent by mistake)

> iptables -I FORWARD -p tcp --dport 1111 -j ACCEPT

Thanks, that has it working now :o)
Allan


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:52 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0