Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-07-2012, 11:46 PM   #1
LQ Newbie
Registered: Oct 2006
Location: Kerala, India
Distribution: RedHat, Fedora, Cent OS
Posts: 23

Rep: Reputation: 0
Can someone help me to creat a IPTables rule

i need all http traffic comes to redirect to port.

can some one help me to sort this issue. i am not goot in NAT configuration. (Local Server) Connected with VPN username password - Remote server (Client http request)******-*******

Whenever (10.100.109/110.0 / 32 network trying to connect to get responds from
Old 02-08-2012, 04:56 AM   #2
Registered: Sep 2011
Location: Houston, TX
Distribution: openSuSE, Fedora, CentOS, Debian,, and others
Posts: 84

Rep: Reputation: Disabled
Well had you done any Google searches you would have come up with many different examples, but hey you go:

iptables -A PREROUTING -t nat -i ethX -p tcp --dport 80 -j DNAT --to
iptables -A INPUT -p tcp -m state --state NEW --dport 80 -i eth1 -j ACCEPT
of course change ethX to the NIC that is going to be accepting and forwarding

Then to make it a little more secure you could specify the source network so the only go to the forwarded port:
iptables -A PREROUTING -t nat -i eth1 -p tcp --source --dport 80 -j DNAT --to
some sites with some good examples:

Google can be your friend as there have been many before you that have wanted to do exactly what you are trying to do.
Old 02-08-2012, 08:45 PM   #3
LQ Guru
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 13,829
Blog Entries: 24

Rep: Reputation: 3685Reputation: 3685Reputation: 3685Reputation: 3685Reputation: 3685Reputation: 3685Reputation: 3685Reputation: 3685Reputation: 3685Reputation: 3685Reputation: 3685
Here's a link to the firewall script that one of the members of my LUG posted. Perhaps it will help.


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: rule with RETURN target just after a rule with ACCEPT target Nerox Linux - Networking 6 09-04-2011 03:33 PM
[SOLVED] IPtables rule szboardstretcher Linux - Security 7 02-24-2011 07:30 PM
Iptables rule psix Linux - Security 3 11-08-2010 01:50 AM
iptables rule DJ29Joesph Linux - Security 4 11-04-2008 12:55 AM
help with iptables rule!! vishamr2000 Linux - Security 6 11-09-2005 05:34 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration