hosts file

Ron Goulard foz at techville.org
Sun May 9 07:45:34 UTC 2004


On Fri, 2004-05-07 at 11:40, Jay Daniels wrote:
> I purchased a domain and setup a roundrobin service to host my DSN.
> 
> Since X would not start because the dns has not propagated yet, I put
> my FQDN in /etc/hosts
> 
> # cat /etc/hosts
> # Do not remove the following line, or various programs
> # that require network functionality will fail.
> 127.0.0.1               localhost.localdomain localhost
> 192.168.2.1             darkforce.darkforceteam.net darkforce
> 192.168.2.12            darkstar.darkforceteam.net darkstar
> 
> 
> 
> Something tells me that perhaps I have something incorrect?  I have
> two interface and am masquerading as darkforce.darkforceteam.net with
> a static ip on eth0.  The eth1 is my localnet.
> 
> Should I have pointed my FQDN to my static ip or the 192.168...?
> 
> As it is, everything works even though my ip doesn't resolve yet.  But
> is this correct?

Looks ok to me if it's a desktop box.  The only thing that I would
caution about is that if this is a laptop and you take it someplace
other than your internal net, it won't resolve those addresses properly.


> There was a tool in RH 9 to set the hostname, I cannot find this tool
> in Fedora??? so I edited /etc/sysconfig/network and /etc/hosts by
> hand.

I've always done it by hand like that, then set it at the CLI.  Upon the
next reboot, it's all taken care of.

> I want to be able to access this host by name http://darkforce/ from
> the localnet even if the network is down.

Yup.  Should be fine unless the internal net is down.  But then, there's
other probs anyway :)

> I am also clueless as to what to put in redhat-config-httpd?  I want
> the default to be www. but my machine is named darkforce.domain...
> How do I add ssh.domain.net ftp.domain.net etc to my hosts file?

Since you're doing NAT, set the external interface to forward port 80
(and 443 if you like) to the machine that is doing the web serving.

I'm not sure if you want to have machines called ssh and ftp, or you
want to forward those services to certain internal machines.

I'll continue here based on the assumption that you have only one
external IP (for example a home broadband connection - your firewall)
and wish to run all these services (web, ssh, ftp) through that one IP
to internal machines (or even elsewhere on the net if you like).

Easiest would be to forward traffic for ftp, web, ssh, mail, whatever
ports, from the ext iface to the internal machine(s) you want the
services run on (iptables is your friend here) and simply set CNAME
aliases in dns for those services, pointing to your external IP.

For ssh, don't do anything in dns.  I would just forward the port to the
machine you want, this way you could type for example: 

ssh user at www.domain.net.

I don't know how much traffic you figure on getting/sending, but I do
remember reading somewhere that NAT will max out at about 3-4M
bytes/second (2 nic's on a 66Mhz pci bus) or something close to that. 
It may be wrong, it's just something which I read.

> Searched google but everybodies hosts file seems to be setup
> differently.
> 
> What else do I need to do to get apache working and add virtual host
> like testsite.mydomain.net?

Read through /etc/httpd/conf/httpd.conf.  There's a fairly well
documented section in there for virtual hosts.  

Set the servername directive in httpd.conf to www.domain.net and that
should be it, though if you're using vhosts, you may need to leave
that.  It's been a long time since I've done vhosts, so I'm really not
clear there anymore.

Ron





More information about the fedora-list mailing list