[svlug] Re: virtual domain names inside the LAN

Drew Bertola drew at drewb.com
Wed Aug 28 00:59:41 PDT 2002


On Tue, Aug 27, 2002 at 03:36:51PM -0700, Daevid Vincent wrote:
> After re-reading this, I am still a bit confused. I get what your
> saying, I just don't get why it works like that.
> 
> It seems to me that if people outside my LAN get routed to the right IP
> (12.228.95.58) and then Apache handles it from there, how come it isn't
> the case that when Lynx on my Linux box (192.168.0.254) makes the
> request, it goes out to the DNS server, doesn't it get returned the same
> IP 12.228.95.58 as everyone else, and therefore shouldn't it go to
> 12.228.95.58 and then Apache handles it again like any other request?
> How and/or Why is the internal request being sent to 192.168.0.1 instead
> of 12.228.95.58? I know I re-iterated what you said to some degree, but
> the key phrase I guess is this, when lynx goes to 12.228.95.58 why
> doesn't Apache handle it again like any other incoming request"
> 
> And I looked at 'man hosts' and see:
> 
> EXAMPLE
>         127.0.0.1       localhost
>         192.168.1.10    foo.mydomain.org  foo
>         192.168.1.13    bar.mydomain.org  bar
>         216.234.231.5   master.debian.org      master
>         205.230.163.103 www.opensource.org
> 
> So should mine look like:
> 
> 127.0.0.1		daevid localhost.localdomain localhost
> daevid.com
> 192.168.0.254	www.marq.org ftp.marq.org marq.org marq
> 192.168.0.254	www.VRExhibits.com ftp.VRExhibits.com VRExhibits.com
> VRExhibits
> 192.168.0.254	www.frizbcd.com ftp.frizbcd.com frizbcd.com frizbcd
> ...
> 
> Can I stack the same IP like that or does it have to be on one long
> line?

Why not try and find out.  It's an instant change: once you edit and
save, the effect is immediate.  You can always edit it back.

The answer, though, is yes, you can put them on several lines like so:

192.168.1.5	foo.drew.net
192.168.1.5	bar.drew.net
192.168.1.5	dev.drew.net
192.168.1.5	nut.drew.net
192.168.1.5	nad.drew.net

I do this on my workstation when I'm developing a site.  So, if I'm
developing, say, agilent.jpager.com, I'd likely have in my /etc/hosts
file:

192.168.1.5	agilent.drew.net

NOW!  In apache's httpd.conf file, I have to make sure I've set up the
virtual server section correctly:

 .
 .
 .

# NOTE: I want my dev apache sites to come up when I'm working locally
# on my Laptop or other local boxes, so I can't use 127.0.0.1.  I'll
# use my local 192.168.1.0 IP (though this has to match entries in the
# /etc/hosts file for all fake domains on all boxes trying to access
# this server.
NameVirtualHost 192.168.1.5

<VirtualHost 192.168.1.5>
  ServerName agilent.drew.net
  DocumentRoot /home/agilent/jpager/site-doc/
  # Don't need more for this dev-site.
</VirtualHost>

 .
 . (other VirtualHosts)
 .

Clear?

Drew


> And do I need to have all four permutations of each domain (www. ftp.
> .com name)?

Yup.

> Should the IP be 127.0.0.1 or 192.168.0.254 for all the virtual domains?

See above "NOTE"

-- 
+---------------------- T h e C o o p . n e t ----------------------+
| Drew Bertola         Hosting - Colocation      Tel:  408-738-8337 |
| TheCoop.net      Programming - Administration  Mob:  408-887-0426 |
| drew at thecoop.net    Open Source Specialists    http://thecoop.net |
+-------------------------------------------------------------------+





More information about the svlug mailing list