LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-29-2008, 04:13 AM   #1
milind19
LQ Newbie
 
Registered: Feb 2008
Location: India
Posts: 1

Rep: Reputation: 0
Question port forwarding to internal network at another location thru lease line


First I would like to thank everyone here.

I have two office connected with lease line network.
Main office LAN is 192.168.1.0/24

My Application Server ip is 192.168.1.47 & port is 443.

Lease line router LAN ip is 192.168.1.251 & WAN ip is 10.10.20.1
-----------------------------------------------------------
Both the offices are connected with lease line circuit.
-----------------------------------------------------------
Lease line router LAN ip is 192.168.30.251 & WAN ip is 10.10.20.2

Branch office LAN is 192.168.30.0/24.

I have a Linux firewall installed at Branch office
Linux Firewall LAN ip is 192.168.30.2 & WAN ip is xxx.xxx.xxx.xxx

To connect this firewall to main branch, route is added.
i.e. route add -net 192.168.1.47 netmask 255.255.255.255 gw 192.168.30.251

I wants to do the port forwarding from Linux firewall WAN to Main office application server (port 443) installed at main office.

my firewall script is as follows. Firewall can successfully telnet the port of application server. First of all i dont know this is possible or not, if yes then how?

iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx --dport 443 -j DNAT --to 192.168.1.47:443
iptables -A FORWARD -p tcp -i eth0 -d 192.168.1.47 --dport 443 -j ACCEPT

Thanks in advance.

Last edited by milind19; 03-06-2008 at 03:28 AM.
 
Old 02-29-2008, 09:53 AM   #2
issinho
Member
 
Registered: Jun 2005
Location: Bosie, ID
Distribution: Fedora Core 4, Kurumin,BackTrack, Slackware 10.2, IPCop
Posts: 105

Rep: Reputation: 15
This might work

Okay. when I looked at your IPTABLES config, I thought everything looked fine. I did a quick search, however, and noticed a couple of discrepencies that might be affecting your networking question:

Port Forwarding using Iptables
Since I have been using 2.4 kernel, I use iptables for firewall and NAT. So these are the Iptable rules required for port forwarding xxx.xxx.xxx.xxx:8888 to 192.168.0.2:80 .

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx
--dport 8888 -j DNAT --to 192.168.0.2:80
/sbin/iptables -A FORWARD -p tcp -i eth0 -d 192.168.0.2 --dport 80 -j ACCEPT


This was taken from http://www.hackorama.com/network/portfwd.shtml

These are commands that can be issued directly from the commandline. You might need to specify which eth card the rule applies to. The xxx.xxx.xxx.xxx is the WAN side, by the way.

Hope this helps in some way. If I'm a little off, I'm sure someone will come along and correct me.
 
  


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
Port Forwarding to RHEL Internal Webserver thiruknv Linux - Networking 1 01-29-2007 05:14 PM
External port forwarding to an internal host antken Linux - Networking 3 12-17-2006 10:43 AM
Port Forwarding not working for Internal requests angelgw Linux - Networking 2 06-29-2003 01:42 AM
IPTABLES port forwarding to internal network ivanros Linux - Networking 2 12-28-2002 11:19 PM
Port forwarding to internal machine zamzara Linux - Networking 8 12-01-2002 01:21 AM


All times are GMT -5. The time now is 12:26 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration