LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 07-06-2004, 08:15 PM   #1
Dataforce
Member
 
Registered: Nov 2003
Distribution: Redhat 9
Posts: 38

Rep: Reputation: 15
IPTables Dual Port Forwarding


This is my network layout:

Code:
[internet]--DSL--[router]--eth1--[Redhat Box]--eth0--[Switch]
                                                       | | |
                                                       | | `-[WIN2k3]
                                                       | `---[WINXP]
                                                       `-----[Others]
The WIN2K3 server is running Terminal Services on port 3389 and IP 192.168.0.6

The WINXP Machine is my desktop IP 192.168.0.2

The Router has an IP of 192.168.1.1 on the LAN Side, and My Public IP on the other side (For the purposes of this Post I will call it 82.255.255.255)

eth1 on The Redhat box has the IP 192.168.1.2 - and an alias of 82.255.255.255 (as eth1:0)

eth0 has an IP of 192.168.0.5



I have used the following IPTables rules to setup port forwarding from the Internet to the WIN2K3 box and It worked:

Code:
iptables -F POSTROUTING -t nat
iptables -A POSTROUTING -t nat -d 192.168.0.0/16 -j ACCEPT
iptables -A POSTROUTING -t nat -d 127.0.0.0/8 -j ACCEPT
iptables -A POSTROUTING -t nat -j SNAT --to-source 192.168.1.2

iptables -A POSTROUTING -t nat -p tcp --dport 3389 -j SNAT --to-source 192.168.1.2
iptables -A PREROUTING -t nat -i eth1 -p tcp --dport 3389 -j DNAT --to 192.168.0.6:3389
This works fine, and allows me to Connect to the box from outside my home.
However, normally I would connect to the box from inside the network using 192.168.0.6 - BUT, I would like to set it up so that I can connect to it using 82.255.255.255 (WAN IP)

I was wondering What I would need todo to the above IPTables code to allow what I want.

I know what I want may seem strange, and alot of you will think "Why not jsut use 192.168.0.6?"

But there is some additional services on the win2k3 box which use clients with a hard coded IP (My external IP) and thus can't be changed to internal IP. These Clients work fine from outside the network, but not from inside (due to the port forwarding not working from inside)

Any help would be greatful.

-DF

Last edited by Dataforce; 07-06-2004 at 09:27 PM.
 
  


Reply



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
iptables port forwarding geoff3425 Slackware 13 12-20-2011 10:50 AM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
Port Forwarding and IpTables nathanieljb Linux - Networking 1 03-17-2005 01:28 AM
IPTables port forwarding.. NeoTech Linux - Networking 2 01-03-2005 11:27 AM
IPTABLES #Port Forwarding goldenmag Linux - Security 4 11-21-2003 07:10 AM

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

All times are GMT -5. The time now is 05:46 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