LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-29-2003, 03:04 PM   #1
gfyspf
LQ Newbie
 
Registered: Jul 2003
Posts: 17

Rep: Reputation: 0
iptables...


I have a linux box acting as a firewall and I have another linux box behind the firewall configured to listen on port 321 for ssh. I want to port forward anything sent to my firewall port 321 to my second box.

I tried adding a nat but this isn't working:

-A PREROUTING -i eth0 -p tcp -m tcp --dport 321 -j REDIRECT --to 10.10.10.91 --to-port 321



my iptables are below:

*nat
:PREROUTING ACCEPT [10927:1731596]
:POSTROUTING ACCEPT [10700:849160]
:OUTPUT ACCEPT [12553:962696]
# Portforward all port 321 traffic to miller
# Masq all outbound traffic.
-A PREROUTING -i eth0 -p tcp -m tcp --dport 321 -j REDIRECT --to 10.10.10.91 --to-port 321
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Sun Mar 2 18:35:09 2003
# Generated by iptables-save v1.2.6a on Sun Mar 2 18:35:09 2003
*filter
:INPUT DROP [6085:1463148]
:FORWARD DROP [409532:126404563]
:OUTPUT ACCEPT [29412:2464787]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 22 -m limit -j LOG
-A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
COMMIT
 
Old 09-29-2003, 03:34 PM   #2
gfyspf
LQ Newbie
 
Registered: Jul 2003
Posts: 17

Original Poster
Rep: Reputation: 0
I figured out what what was wrong... I need to allow forwarding of that port:

-A FORWARD -i eth0 -p tcp -m tcp --dport 321 -j ACCEPT

then my preroute should have been:

-A PREROUTING -i eth0 -p tcp --dport 321 -j DNAT --to 10.10.10.91
 
  


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
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:52 PM.

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