TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:6694] virtual IPs



> Quoting Tim Wilson (wilson@chemsun.chem.umn.edu):
> > Hey *,
> > 
> > I'm trying to set up my Web serve with virtual IPs for hosting multiple
> > schools' Web sites. I know that the 'ifconfig' command is used for
> > configuring network interfaces (although the exact syntax is rather
> > complicated). I need to know where I would put the commands for starting
> > up the interfaces. Would the series of ifconfig commands go in
> > /etc/rc.d/rc.local? Somewhere else? BTW, this is a RH6 system.

It isn't actually that difficult.  I did it in a matter of a couple
hours to learn how to set up Apache, reading docs and compiling the
kernel to do IP Aliasing.  The ifconfig is simple...

	# ifconfig eth0 xxx.xxx.xxx.xxx netmask aaa.aaa.aaa.aaa
	# ifconfig eth0:0 yyy.yyy.yyy.yyy netmask aaa.aaa.aaa.aaa
	# ifconfig eth0:1 zzz.zzz.zzz.zzz netmask aaa.aaa.aaa.aaa

routing is also simple...

	# route add -host yyy.yyy.yyy.yyy eth0:0

You add these in the same script that initializes your network card
when you boot.  In debian, the script is called /etc/init.d/network.
I'm not sure what it is in RH, but I'm pretty sure you can find out
where by doing a grep for ifconfig...

	# grep ifconfig /etc/rc?.d/*

Find out which link file it is and follow it to its source.  If you
don't find it in the rc?.d directories, check your rc.boot or similar
rc directory.

On Wed, 23 Jun 1999, Bob Tanner wrote:
> Do you need multiple ips? I'd recommend using virtual hosts under apache, you
> use only 1 IP and let apache handle the virtualness.
> 
> I do not know how many hosts you want to offer, but there is a little in the
> kernel on open file descriptors, which I ran into before I went with apache
> virtual hosting.
> 
> http://www.apache.org/docs/vhosts/index.html

It depends on your need.  If you need to do virtual domain name
serving, you may be forced to use IP Aliasing.  But as Bob said, you
can do Name based virtual hosting instead of IP based virtual hosting.
Or you can use a combination of both.  Apache is very flexible...  If
you've installed apache from packages, you've probably also installed
the Apache manuals with it.  Check out your manual pages on your
local Apache Server...  http://<hostname>/doc/apache/manual

Either way you look at it, you'll have to maintain a DNS entry for
each web site you host.  They can be any number of A or records
pointing to the same IP with different names, or they can be different
IP's that are aliased to your interface (eth0, eth0:0, eth0:n).

There is an advantage to having different IP's that I'd like to point
out.  DNS reverse lookup.  It's a lot cleaner when you have one IP per
web site.  I know DNS understands multiple A records for one namespace
(multiple www.site.com records...just try an nslookup www.yahoo.com or
any other well known mirrored web site).  I'm not sure if DNS
understands how to resolve names when they're bound to one IP.  Does
it give you a list of possible names to match?  I.e.  www.site1.com,
www.site2.com, www.site3.net, etc...?

^chewie

http://nerp.net/~chewie  <<--- Check it out!  I'm selling my truck!