LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-12-2007, 02:02 PM   #1
andrewfeberwee
Member
 
Registered: Feb 2007
Posts: 30

Rep: Reputation: 15
Unhappy Iptables forwarding problem


I have almost no experience at iptables, any help would be really appreciated

I have the following setup

2 RH Enterprise Linux 3 servers
2 routers
setup as follows

Internet ---> ExtHW Router --> DMZ LX Server --> IntHW Router --> Office LX Server

and I want to log in directly to my office server using ssh. I have tried to set up iptables to port forward from the DMZ Server to the gateway on the IntHW router but am not getting anywhwere. I can ssh to the DMZ server from outside the site and from there I can ssh to the Office server no probs do I don't think it is a port problem. When I try forwarding as follows

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 22 -j DNAT --to 192.168.xxx.xxr:22

iptables -A FORWARD -p tcp -m state --state NEW --dport 22 -i eth0 -j ACCEPT

with the above executed on the DMS server and 192.168.xxx.xxr being the internal gateway. I just hang on trying to log into the extermal router.

This is my first try at forwarding so maybe I'm just not getting it. I don't really want to port forward from the external router to the internal one as a can limit the source in the iptable entry on the DMZ to one valid external account.

This stuff drives me crazy
 
Old 02-12-2007, 04:47 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 62
I am confused as to what you need and your setup.
Is the Internal and External router a linux machine or a store bought router?
Is the DMZ acting as a router? Based on schematic I am seeing.

Brian
 
Old 02-12-2007, 11:12 PM   #3
andrewfeberwee
Member
 
Registered: Feb 2007
Posts: 30

Original Poster
Rep: Reputation: 15
The initial problem has been solved. The routers are hardware routers, the external one is a netcomm, this internal one is a linksys. The DMZ sever sits between the two and servse the website and does mail forwarding, dns and some other stuff. The Internal server is the office file server.

iptables -A FORWARD -j ACCEPT -p tcp --syn --dport 22
iptables -t nat -A PREROUTING -i eth0 -p tcp --syn --dport 22 -j DNAT --to 192.168.xxx.xxr:22

on the DMZ server where 192.168.xxx.xxr is the internal router gateway solves the problem, now I have a new problem where I am rsyncing through the port but after about five minutes, rsync fails with a "connection reset by peer" message and then won't let me onto the port for about another five minutes or so

Cheers
 
Old 02-13-2007, 04:24 PM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 62
Glad to see you have the first part working. No idea on the rsync problem. Never really used it much.

Brian
 
  


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
Iptables Forwarding Problem -OpenWRT stlpcsolutions Linux - Networking 1 11-30-2006 02:23 PM
iptables with port forwarding problem ... please help me rubenscript Linux - Networking 1 04-26-2006 04:51 PM
iptables problem.....port forwarding..... shahg_shahg Linux - Networking 1 03-22-2006 05:17 AM
IPTables port forwarding problem deadlydemon Linux - Security 2 04-25-2005 04:43 PM
Iptables Forwarding Problem bullstrong Linux - Networking 2 09-01-2003 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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