LinuxQuestions.org
Help answer threads with 0 replies.
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-02-2004, 11:00 PM   #1
wanaka
LQ Newbie
 
Registered: Jun 2004
Posts: 3

Rep: Reputation: 0
IPTABLES port forward


Hi,

I am new to iptables. I need to forward all the https port 443 to port
7502. How should I do this in iptables? Is there anyway I can edit the configuration file so that after next reboot the policy is there. I am using redhat linux AS 3.0.
 
Old 09-03-2004, 02:28 AM   #2
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
Is this for your local traffic?

iptables -t nat -A PREROUTING -i <internal NIC> -p tcp --dport 443 -j REDIRECT --to-port 7502

if it is external traffic going to another system

iptables -t nat -A PREROUTING -i <external nic> -p tcp --dport 443 -j DNAT --to-destination <ipaddress>:5702
 
Old 09-03-2004, 09:04 AM   #3
phatboyz
Member
 
Registered: Feb 2004
Location: Mooresville NC
Distribution: CentOS 4,Free BSD,
Posts: 358

Rep: Reputation: 30
That will work or you could try http://www.iptables-script.dk/
 
Old 09-28-2004, 08:07 PM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally posted by ppuru
if it is external traffic going to another system
Code:
iptables -t nat -A PREROUTING -i <external nic> -p tcp --dport 443 \
-j DNAT --to-destination <ipaddress>:7502
yup, but don't forget the accompanying FORWARD rule needed to make that work:
Code:
iptables -A FORWARD -p tcp -d <ipaddress> --dport 7502 -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
IPTABLES port Forward abhijeetudas Linux - Networking 1 12-02-2005 05:00 AM
iptables forward one port on same IP baetmaen Linux - Networking 2 01-27-2005 09:47 AM
IPtables Forward 1 Port to another on the same IP KevinB Linux - Networking 2 01-13-2005 11:56 PM
How to port forward with IPTABLES... Scrag Linux - Security 6 12-13-2004 05:57 AM
Port Forward with iptables nymig94 Linux - Networking 5 12-02-2001 10:22 PM

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

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