DNS & WEBSERVER

Rick Stevens rstevens at vitalstream.com
Wed Dec 15 01:26:59 UTC 2004


tariq samsudeen wrote:
> hi gurus,
> i have few doubts, first let me explain my configuration:
> 
> # im doing everything on a single machine.
> # my domain name is tariq.com (i set the domain name using domainname
> command, my domain name is reset everytime i restart the computer, hw
> do i make it persistent)

Bad idea.  "domainname" sets your NIS domain name, not your host domain
name.  The correct command to use is "hostname".

> # my host name is ns1 (i set using hostname ns1)...even this get reset
> after restart....i hv added it even in hosts file. hw do i mke it
> persistent

Edit the "/etc/sysconfig/network" file.  Change the "HOSTNAME=" line
to include your full host name, e.g.

	HOSTNAME=ns1.tariq.com

DO NOT use "domainname" unless you're running NIS/YP/YP+ (and if you
don't know what those are, you ain't running them! ;-))   By putting
this data in the /etc/sysconfig/network file, the system will set it up
each time you boot.

> my host file
> 127.0.0.1 ns1 localhost.localdomain localhost
> # i hv configured dns which is wrking fine...
> my named.conf file is
> 
> zone "tariq.com" {
>     type master;
>     notify no;
>     allow-query { any; };
>     file "tariq.com.zone";
> };

That's OK.

> my zone file luks like...
> @       IN      SOA     ns1.tariq.com. hostmaster.tariq.com. 

That's it?  Uh, why bother with DNS at all?  Your SOA record is 
incomplete and you don't even have an A record in your zone.  I'd be
surprised that named is running at all.

If you're only going to be playing on the single machine, scrap your
DNS stuff and change your /etc/hosts file as follows:

	127.0.0.1	localhost.localdomain	localhost
	127.0.0.1	ns1.tariq.com		ns1

Thus, you can do the whole thing in your /etc/hosts file.

> now i cud access the default website in mozilla using
> http://ns1.tariq.com....wht changes shud i mke to access the default
> website using www.tariq.com or someother name.....

If you use /etc/hosts, add lines like:

	127.0.0.1	www.tariq.com		www

and so on for each hostname or FQDN (hostname.domain.tld) you want to
use.  If you want to use DNS, then get your zone file's SOA record
fixed and start adding A records.  Here's a proper zone file:

	@	IN	SOA	ns1.tariq.com. hostmaster.tariq.com (
				1
				10800
				3600
				604800
				86400 )

		IN	NS	ns1.tariq.com

		IN	A	127.0.0.1
	ns1	IN	A	127.0.0.1
	www	IN	A	127.0.0.1
	node	IN	A	127.0.0.1

Note the stuff I added to the SOA record.  In order, they are the serial
number, refresh period, retry period, expiration, and time to live.

The remainder of the lines define the name server and three host names
(ns1, www, and node)--all pointing at the loopback address of 127.0.0.1.
Also, if all you did was "http://tariq.com", the first "IN A" line would
cover that.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-        Artificial Intelligence usually beats real stupidity.       -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list