LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 03-20-2006, 06:36 PM   #1
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Rep: Reputation: 30
How to make two servers respond to a single ip?


Well, i have ONE external static ip and two computers connected to a router.
Computer 1 have ip 192.168.0.1
Computer 2 have ip 192.168.0.2

Both have apache installed. On modem i made a nat on port 80 to 192.168.0.1. But now, i would like that everytime that someone try to access /webmail on my server it passes to 192.168.0.2.
How can i do this?

Another thing. Is it possible to make those two computers respond as the same server? I mean, some kind of balance, because the first computer sometimes have to throw something into swap (when there are lots of php running). So things get a little slow.

I read something about changing something in the dns server like

www1 IN A first_server_ip
www2 IN A second_server_ip

But how could i do this if i only have one external static ip?
 
Old 03-21-2006, 05:02 AM   #2
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
is it possible?
can somebody answer it to me?
 
Old 03-21-2006, 05:45 AM   #3
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 59
To accomplish sending users off to the other machine, you can try using redirection, based on (internal) IP address (or use 2 hostnames, so you can be sure to reach the right machine). See also http://httpd.apache.org/docs/trunk/urlmapping.html.

For the second question, you need load balancing. I'm not very experienced in that. Maybe Apache's flood tool can help you. However, combining this with the redirection may require additional configuration, such as URL rewriting.

Maybe mod_rewrite, as explained on the same webpage, can help you too.
 
Old 03-21-2006, 02:37 PM   #4
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
i read the thing on the link you posted but i still can't figure out how am i going to do this.

I know that there is a way to do this, because i thing that heavy-traffic sites like linuxquestions.org aren't running on a single machine.
 
Old 03-21-2006, 05:32 PM   #5
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,022

Rep: Reputation: 45
A few things:

A directory on your server is not any indication of a unique "site"...
http://www.google.com/gmail is the gmail directory on the www.google.com site
http://gmail.google.com is a seperate sub-domain in the google.com domain
(these two URLs happen to take you to the same destination, but that is due to the way they were set up and not an inherent fact of URLs.)

Quote:
I read something about changing something in the dns server like
www1 IN A first_server_ip
www2 IN A second_server_ip
But how could i do this if i only have one external static ip?
What you read about is probably what is called Round Robin DNS and it's actually:
Code:
www IN A first_server_ip
www IN A second_server_ip
Either way, this can't be done with only one "public" IP address.

The ways I can think of to solve your dilema include:
-Set up redirection of port 80 to one webserver and another port to the other webserver.
-Set up an alias on one webserver that points to the other one (that's in the link timmeke posted) so that something like www.thisdomain.com/thatdirectory aliases to the other server
-Set up two domain names that resolve to the same IP and get your external facing firewall to do host based routing (I've never done this, I just understand the concept and I'd bet something could be added to iptables/netfilter to get it to do this)
-Buy a hardware based load balancing solution ($$$).
 
Old 03-21-2006, 08:25 PM   #6
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Darin
-Buy a hardware based load balancing solution ($$$).
What kind of hardware are you talking about?
 
Old 03-22-2006, 02:30 AM   #7
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 59
Professional, heavy duty sites often use specific hardware for load balancing.
ie they have multiple machines attached to a specific piece of hardware that sends the
requests to one of the machines, distributing the load in the process.

A quick Google search turned up:
http://searchnetworking.techtarget.c...005407,00.html
 
Old 03-22-2006, 09:40 AM   #8
jeanpd001
LQ Newbie
 
Registered: Aug 2004
Distribution: Redhat/Suse/Enterprise versions
Posts: 7

Rep: Reputation: 0
Or you could go for something like a High Availability type solution. These solutions typically provide load balancing of IP addresses. I think there are modules that work specifically for Apache.

Have a look at the heartbeat product. Go to www linux-ha org (put the dots where they need to be)

There might be some tools to help you.
 
Old 03-22-2006, 10:09 AM   #9
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,022

Rep: Reputation: 45
Quote:
Originally Posted by stormrider_may
What kind of hardware are you talking about?
Something like
http://www.juniper.net/products/integrated/ns_5000.html
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Single IP, multible web servers tangle Linux - Networking 10 01-11-2006 11:03 AM
Multiple RADIUS servers on a single machine skiros Linux - Software 3 11-02-2005 06:48 AM
need help to make card active & respond to the wireless network southamptonfc Linux - Newbie 6 12-09-2004 11:40 PM
How 2 make Gnome windows single-open? jhecht Linux - Software 3 08-08-2004 11:21 AM
Booting/running 300 servers from single image jjrowan Linux - Networking 2 01-02-2004 11:21 AM


All times are GMT -5. The time now is 01:28 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration