Networking Forums

Networking Forums > Computer Networking > Linux Networking > Port Forwarding with iptables (sorry for first half post, sent by mistake)

Reply
Thread Tools Display Modes

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

 
 
Allan Bruce
Guest
Posts: n/a

 
      08-27-2003, 11:46 AM
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
 
 
 
 
/dev/rob0
Guest
Posts: n/a

 
      08-27-2003, 12:29 PM
In article <bii5i8$7vu$(E-Mail Removed)>, 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
 
Allan Bruce
Guest
Posts: n/a

 
      08-27-2003, 01:02 PM
> iptables -I FORWARD -p tcp --dport 1111 -j ACCEPT

Thanks, that has it working now )
Allan


 
Reply With Quote
 
 
 
Reply

Thread Tools
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Port forwarding with iptables ??? Joe Attardi Linux Networking 4 05-10-2004 11:45 PM
iptables port forwarding anonymous Linux Networking 1 01-22-2004 09:25 AM
iptables port forwarding Jason Lee Linux Networking 4 10-13-2003 12:53 AM
port forwarding with iptables Allan Bruce Linux Networking 9 09-24-2003 04:31 PM
Port Forwarding with iptables Allan Bruce Linux Networking 0 08-27-2003 11:44 AM



1 2 3 4 5 6 7 8 9 10 11