LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-02-2004, 09:58 AM   #1
philipina
Member
 
Registered: May 2003
Posts: 77

Rep: Reputation: 15
Unhappy Port forwarding with iptables is not working?!!


Hello,

I have a problem with iptables port forwarding.
I read a lot of documents and questions about that.
I also checked everything about that in the forum but it's nerver work.
I would like to forward all data from 10.1.1.53:1240 to 10.1.1.240:9000.

I'm using redhat 9.

I added some rules with a script :

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d 10.1.1.53 --dport 1240 -j DNAT --to 10.1.1.240:9000
/sbin/iptables -A FORWARD -p tcp -i eth0 -d 10.1.1.240 --dport 9000 -j ACCEPT

and I modified the file /etc/sysctl.conf --> # Controls IP packet forwarding
net.ipv4.ip_forward = 1

After restarting the network and iptables I have the following status.

[root@localhost init.d]# ./iptables status
Table: nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- anywhere 10.1.1.53 tcp dpt:1240 to:10.1.1.240:9000

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Table: filter
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere 10.1.1.240 tcp dpt:9000

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

But the IP forwarding is not working.
I also tried a lot of different configurations.
Where is the problem?
I'm going to become crazy!!!

Thanks a lot in advance for your help.

Alain.
 
Old 04-03-2004, 03:18 PM   #2
evil1
LQ Newbie
 
Registered: Apr 2004
Posts: 5

Rep: Reputation: 0
use
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d 10.1.1.53 --dport 1240 -j DNAT --to 10.1.1.53:9000
/sbin/iptables -A FORWARD -p tcp -i eth0 -d 10.1.1.53 --dport 9000 -j ACCEPT
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
iptables on router: simple port forwarding not working hamish Linux - Networking 1 10-27-2005 06:06 AM
IPtables port-forwarding not working. Ratclaws Linux - Networking 3 04-12-2005 08:14 AM
iptables port forwarding not working! friendklay Linux - Networking 1 03-23-2005 06:37 AM
Iptables -- Port Forwarding slack_baby Linux - Networking 3 06-03-2004 02:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration