LinuxQuestions.org
Visit Jeremy's Blog.
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 03-05-2011, 11:56 AM   #1
opheophe
LQ Newbie
 
Registered: Mar 2011
Posts: 8

Rep: Reputation: Disabled
Webservers behind nat


Hello,

I'm contemplating setting up two webservers behind a nat router, both on port 80, but how would I configure that in IPtables? I mean; I want outsiders to be able to connect to both of them.
 
Old 03-05-2011, 12:05 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well you'd just pick out 2 public IP's and do a dnat redirect

iptables -I INPUT -d 1.2.3.1 -i eth0 -m tcp --dport 80 -m state --state NEW -j DNAT --to-destination 192.168.1.1
iptables -I INPUT -d 1.2.3.2 -i eth0 -m tcp --dport 80 -m state --state NEW -j DNAT --to-destination 192.168.1.2

assuming that these IP's are being present on the nat router, and not routed through it, which seems logical if you're natting.
 
  


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
Two webservers behind a firewall manolopm Linux - Networking 5 02-07-2011 05:38 AM
Cluster Webservers InEeDhElPlInUx Linux - Server 1 08-22-2007 08:24 PM
multiple webservers one gateway? phonecian Linux - Networking 4 03-11-2005 11:10 AM
Webservers thekore Linux - Networking 2 06-13-2004 11:21 AM
port 80, firewalls, and webservers glevine Linux - Networking 8 06-03-2004 11:03 AM

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

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