Click to See Complete Forum and Search --> : DNS with virtual Host, i'm a bit stuck


sfahey
09-24-2002, 08:57 AM
Hello group !

Hope all you lot round the world are OK, and having a cool day !!!

I have been trying to configur DNS for virtual Host
I think i'm getting someware now !!
I have included quite a lot in this post, so if there is anything more you need just ask

i am runing my server with SuSe Linux 7.2 pro, its IP is 192.168.0.1
also i have a windows box which i use to develop on its IP is 192.168.0.2
the boxes are joined via a HUB

in my SuSe control center my DNS is set to this

Host name = 'linux' domain name = 'local'
under this are the settings 'name server list' and 'domain search list'

the first 'name server list' entry is 127.0.0.1, next 2 it, and under the heading 'domain search list'
is the word 'local'

the second entre in the 'name server list' is 192.168.0.1
there is NO entry next to this in the 'domain search list'

Thats it for my DNS settings,

NOW !!

the object of this is, so i do NOT have to type http://192.168.0.1/sfahey.com/
from my win box, i just want to type http://sfahey.com

with me ? good :)

--------------------------------------------------------------------------------------------------------

this is what i have done so far with the help of my help-files and an apache server book !

part of /ect/httpd/httpd.conf

port 80
NameVirtualHost 127.0.0.1
nameVirtualHost 192.168.0.1

<VirtualHost 127.0.0.1 192.168.0.1>
ServerAdmin root@linux.local
DocumentRoot /usr/local/httpd/htdocs/
ServerName localhost
# ErrorLog var/log/httpd/iws_log
# CustomLog var/log/httpd/iws_log
</VirtualHost>

<VirtualHost 127.0.0.1 192.168.0.1>
ServerAdmin root@linux.local
DocumentRoot /usr/local/httpd/htdocs/iws.com
ServerName iws.com
# ErrorLog var/log/httpd/iws_log
# CustomLog var/log/httpd/iws_log
</VirtualHost>

<VirtualHost 127.0.0.1 192.168.0.1>
ServerAdmin root@linux.local
DocumentRoot /usr/local/httpd/htdocs/sfahey.com
ServerName sfahey.com
Options +ExecCGI +Indexes
# ErrorLog var/log/httpd/sfahey_log
# CustomLog var/log/httpd/sfahey_log
</VirtualHost>

<VirtualHost 127.0.0.1 192.168.0.1>
ServerAdmin root@linux.local
DocumentRoot /usr/local/httpd/htdocs/myphp.com
ServerName myphp.com
# ErrorLog var/log/httpd/myphp_log
# CustomLog var/log/httpd/myphp_log
</VirtualHost>
-------------------------------------------------------------------------------------------------------
thanks to 'Supa' Penguin' that worked :)
-------------------------------------------------------------------------------------------------------

now my book tells me that, for DNS with v-hosting i need a zone-file
so i have made a zone file for one of my domains, sfahey.com
this entry is in /var/named/sfahey.zone

this is my zone file

@ IN SOA sfahey.com hostmaster.sfahey.com.(
20011201001 ; Serial YYYYMMDDXXX
7200 ; refresh
3600 ; (1 hour) retry
172800 ; (20 days) expire
3600) ; (1 hr) minimum ttl

; Name Servers
IN NS ns1.sfahey.com

; CNAME for name-based virtual hosting
sfahey.com IN CNAME sfahey.com

----------------------------------------------------------------------------------------------------------

the book also says to add the following to /etc/named.conf to enable the newdomain

this is my entre

/etc/named.conf

i have included the whole file for you 2 look at

options {

# The directory statement defines the name server's
# working directory

directory "/var/named";

# The forwarders record contains a list of servers to
# which queries should be forwarded. Enable this line and
# modify the IP-address to your provider's name server.
# Up to three servers may be listed.

#forwarders { 10.11.12.13; 10.11.12.14; };

# Enable the next entry to prefer usage of the name
# server declared in the forwarders section.

#forward first;

# The listen-on record contains a list of local network
# interfaces to listen on. Optionally the port can be
# specified. Default is to listen on all interfaces found
# on your system. The default port is 53.

listen-on port 53 { 127.0.0.1; 192.168.0.1};

# The next statement may be needed if a firewall stands
# between the local server and the internet.

#query-source address * port 53;

# The allow-query record contains a list of networks or
# IP-addresses to accept and deny queries from. The
# default is to allow queries from all hosts.

#allow-query { 127.0.0.1; };

# The cleaning-interval statement defines the time interval
# in minutes for periodic cleaning. Default is 60 minutes.
# By default, all actions are logged to /var/log/messages.

cleaning-interval 120;

# Name server statistics will be logged to /var/log/messages
# every <statistics-interval> minutes. Default is 60 minutes.
# A value of 0 disables this feature.

statistics-interval 0;

# If notify is set to yes (default), notify messages are
# sent to other name servers when the the zone data is
# changed. Instead of setting a global 'notify' statement
# in the 'options' section, a separate 'notify' can be
# added to each zone definition.

notify no;
};

# The following three zone definitions don't need any modification.
# The first one defines localhost while the second defines the
# reverse lookup for localhost. The last zone "." is the
# definition of the root name servers.

zone "localhost" in {
type master;
file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
type master;
file "127.0.0.zone";
};

zone "." in {
type hint;
file "root.hint";
};

# You can insert further zone records for your own domains below.

zone "sfahey.com" IN {
type master;
file "sfahey.zone";
allow-update { none;};
};


--------------------------------------------------------------------------------------------------------
/etc/resolv.conf

not sure about this

domain local
nameserver 127.0.0.1
nameserver 192.168.0.1
search local

--------------------------------------------------------------------------------------------------------

last part of /var/log/messages

Sep 24 12:28:48 linux named[875]: starting (/etc/named.conf). named 8.2.3-REL Fri May 11 16:00:24 GMT 2001
^Iroot@ivy:/usr/src/packages/BUILD/bind8-8.2.3/bin/named
Sep 24 12:28:48 linux named[875]: /etc/named.conf:40: syntax error near '}'
Sep 24 12:28:48 linux named[875]: master zone "localhost" (IN) loaded (serial 42)
Sep 24 12:28:48 linux named[875]: master zone "0.0.127.in-addr.arpa" (IN) loaded (serial 42)
Sep 24 12:28:48 linux named[875]: hint zone "" (IN) loaded (serial 0)
Sep 24 12:28:48 linux named[875]: Zone "sfahey.com" (file sfahey.zone): No default TTL ($TTL <value>) set, using SOA minimum instead
Sep 24 12:28:48 linux named[875]: mail name "hostmaster.sfahey.com.(.sfahey.com" (owner "sfahey.com") IN (primary) is invalid - rejecting
Sep 24 12:28:48 linux named[875]: sfahey.zone:1: database naming error
Sep 24 12:28:48 linux named[875]: sfahey.zone:1: Database error near (bad name "hostmaster.sfahey.com.(.sfahey.com")
Sep 24 12:28:48 linux named[875]: sfahey.zone: Line 2: TTL > 2147483647; converted to 0
Sep 24 12:28:48 linux named[875]: sfahey.zone:2: Database error near ()
Sep 24 12:28:48 linux named[875]: sfahey.zone:3: Database error near ()
Sep 24 12:28:48 linux named[875]: sfahey.zone:4: Database error near ()
Sep 24 12:28:48 linux named[875]: sfahey.zone:5: Database error near ()
Sep 24 12:28:48 linux named[875]: sfahey.zone: Line 6: Unknown type: 3600).
Sep 24 12:28:48 linux named[875]: sfahey.zone:6: Database error near (3600))
Sep 24 12:28:48 linux named[875]: Zone "sfahey.com" (file sfahey.zone): no SOA RR found
Sep 24 12:28:48 linux named[875]: master zone "sfahey.com" (IN) rejected due to errors (serial 0)
Sep 24 12:28:48 linux named[875]: listening on [127.0.0.1].53 (lo)
Sep 24 12:28:48 linux named[875]: listening on [192.168.0.1].53 (eth0)
Sep 24 12:28:48 linux named[875]: Forwarding source address is [0.0.0.0].32768
Sep 24 12:28:48 linux named[875]: hint zone "" (IN) loaded (serial 0)
Sep 24 12:28:48 linux named[876]: group = named
Sep 24 12:28:48 linux named[876]: user = named
Sep 24 12:28:48 linux named[876]: Ready to answer queries.
Sep 24 12:28:48 linux named[876]: sysquery: sendto([198.41.0.10].53): Network is unreachable
Sep 24 12:39:24 linux named[876]: ns_forw: sendto([198.41.0.10].53): Network is unreachable
Sep 24 12:54:24 linux named[876]: ns_forw: sendto([198.41.0.10].53): Network is unreachable
Sep 24 12:59:00 linux /USR/SBIN/CRON[1125]: (root) CMD ( rm -f /var/spool/cron/lastrun/cron.hourly)
Sep 24 13:09:24 linux named[876]: ns_forw: sendto([198.41.0.10].53): Network is unreachable

-----------------------------------------------------------------------------------------------------------
so you lot, this is where i am stuck, i need some help here, what is this message log telling me ?

big stuck

can anybody help

sorry this is a bit long, but i figure that its best to include a lot, rather than you thinking
we need more nfo.

------------------------------------------------------------------------------------------------------------

thank you from the UK

have a nice day !!

Shaun

Supa' Penguin
09-24-2002, 10:07 AM
Good morning,
I'll post a sample that u might have to play with( I haven't tested it just wrote it kinda quick) :(

You should really make a FQDN as this is kinda wierd to write.

Well back to the daily grind.

YOU WILL HAVE TO REMOVE THE SPACES AND USE TABS!

Have fun and let me know.
J.

/etc/named.conf

options {

# The directory statement defines the name server's
# working directory

directory "/var/named";

# The forwarders record contains a list of servers to
# which queries should be forwarded. Enable this line and
# modify the IP-address to your provider's name server.
# Up to three servers may be listed.

#forwarders { 10.11.12.13; 10.11.12.14; };

# Enable the next entry to prefer usage of the name
# server declared in the forwarders section.

#forward first;

# The listen-on record contains a list of local network
# interfaces to listen on. Optionally the port can be
# specified. Default is to listen on all interfaces found
# on your system. The default port is 53.

listen-on port 53 { 127.0.0.1; 192.168.0.1};

# The next statement may be needed if a firewall stands
# between the local server and the internet.

#query-source address * port 53;

# The allow-query record contains a list of networks or
# IP-addresses to accept and deny queries from. The
# default is to allow queries from all hosts.

#allow-query { 127.0.0.1; };

# The cleaning-interval statement defines the time interval
# in minutes for periodic cleaning. Default is 60 minutes.
# By default, all actions are logged to /var/log/messages.

cleaning-interval 120;

# Name server statistics will be logged to /var/log/messages
# every <statistics-interval> minutes. Default is 60 minutes.
# A value of 0 disables this feature.

statistics-interval 0;

# If notify is set to yes (default), notify messages are
# sent to other name servers when the the zone data is
# changed. Instead of setting a global 'notify' statement
# in the 'options' section, a separate 'notify' can be
# added to each zone definition.

notify no;
};

# The following three zone definitions don't need any modification.
# The first one defines localhost while the second defines the
# reverse lookup for localhost. The last zone "." is the
# definition of the root name servers.

zone "localhost" in {
type master;
file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
type master;
file "127.0.0.zone";
};

zone "." in {
type hint;
file "root.hint";
};

# You can insert further zone records for your own domains below.

zone "local" IN {
type master;
file "local.zone";
allow-update { none;};
};

zone "0.168.192.in-addr.arpa" {
type master;
file "local.rr.zone";
};


__________________________________________________ _________

Save as /var/named/local.zone replacing your other zone statement and note the change in name in both the named.conf and file name.


; Zone file for local.zone

$TTL 3D
@ IN SOA linux.local hostmaster.linux.local. (
199802151 ; serial, todays date + todays serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS @ ; Inet Address of name server
# MX 10 mail ; Primary Mail Exchanger

localhost A 127.0.0.1
@ A 192.168.0.1
winbox A 192.168.0.2
sfahey.com. CNAME @
iws.com. CNAME @
myphp.com. CNAME @


__________________________________________________ _________

Save as /var/named/local.rr.zone

$TTL 3D
@ IN SOA linux.local hostmaster.linux.local. (
199802151 ; Serial, todays date + todays serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL
NS @

1 PTR @
2 PTR winbox

sfahey
09-24-2002, 12:28 PM
HI Supa' Penguin

First of all, thank you for taking the time to respond. It’s so refreshing to get an educated response, not just 1liners :)

On and off I’ve been using SuSe for about 9mts now, and enjoying the challenge of trying to set it up…I have got most things working at a basic level, but now wish to get my two PC network acting like the real thing. Long road ahead then :)

In you last posting you said

“Your name server list should list your domain names. When u created the domain in bind what did u call it? linux.local?”

Have I missed something here? Haven’t done that
just had a quick look in the book, hmm not sure
how do you do that then ! ???

I’m just going to have some food, because its 5pm in the UK. and then, try your new suggestions on zone files ect..


Catch ya l8er

shaun

Supa' Penguin
09-24-2002, 12:57 PM
Sorry I was lookin it over and noticed a few typos :(

now u type winbox instead of winbox.local to ping 192.168.0.2
and sfahey.com, iws.com or myphp.com or linux.local to ping/surf your linuxbox. :)

Sorry for the typos again i'm kinda in a rush.

Don't forget the tabs as bind will fail without them :( This sucks 4 posting confs :( :(

Enjoy and let me know!

J.
:)

/etc/named.conf

options {

# The directory statement defines the name server's
# working directory

directory "/var/named";

# The forwarders record contains a list of servers to
# which queries should be forwarded. Enable this line and
# modify the IP-address to your provider's name server.
# Up to three servers may be listed.

#forwarders { 10.11.12.13; 10.11.12.14; };

# Enable the next entry to prefer usage of the name
# server declared in the forwarders section.

#forward first;

# The listen-on record contains a list of local network
# interfaces to listen on. Optionally the port can be
# specified. Default is to listen on all interfaces found
# on your system. The default port is 53.

listen-on port 53 { 127.0.0.1; 192.168.0.1};

# The next statement may be needed if a firewall stands
# between the local server and the internet.

#query-source address * port 53;

# The allow-query record contains a list of networks or
# IP-addresses to accept and deny queries from. The
# default is to allow queries from all hosts.

#allow-query { 127.0.0.1; };

# The cleaning-interval statement defines the time interval
# in minutes for periodic cleaning. Default is 60 minutes.
# By default, all actions are logged to /var/log/messages.

cleaning-interval 120;

# Name server statistics will be logged to /var/log/messages
# every <statistics-interval> minutes. Default is 60 minutes.
# A value of 0 disables this feature.

statistics-interval 0;

# If notify is set to yes (default), notify messages are
# sent to other name servers when the the zone data is
# changed. Instead of setting a global 'notify' statement
# in the 'options' section, a separate 'notify' can be
# added to each zone definition.

notify no;
};

# The following three zone definitions don't need any modification.
# The first one defines localhost while the second defines the
# reverse lookup for localhost. The last zone "." is the
# definition of the root name servers.

zone "localhost" in {
type master;
file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
type master;
file "127.0.0.zone";
};

zone "." in {
type hint;
file "root.hint";
};

# You can insert further zone records for your own domains below.

zone "linux.local" IN {
type master;
file "local.zone";
allow-update { none;};
};

zone "0.168.192.in-addr.arpa" {
type master;
file "local.rr.zone";
};


__________________________________________________
_________

Save as /var/named/local.zone replacing your other zone statement and note the change in name in both the named.conf and file name.


; Zone file for local.zone

$TTL 3D
@ IN SOA linux.local hostmaster.linux.local. (
199802151 ; serial, todays date + todays serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS @ ; Inet Address of name server
# MX 10 mail ; Primary Mail Exchanger

@ A 192.168.0.1
winbox. A 192.168.0.2
sfahey.com. CNAME @
iws.com. CNAME @
myphp.com. CNAME @


__________________________________________________
_________

Save as /var/named/local.rr.zone

$TTL 3D
@ IN SOA linux.local hostmaster.linux.local. (
199802151 ; Serial, todays date + todays serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL
NS @

1 PTR @
2 PTR winbox.

sfahey
09-24-2002, 04:54 PM
Hi m8 how things?
I have had a hectic day today! :(

I tried what you suggested and this was the out come

sfahey.com myphp.com and iws.com are all fine from the linux box

But a request from the win box gives this


/var/log/messages

Sep 24 20:49:23 linux named[770]: starting (/etc/named.conf). named 8.2.3-REL Fri May 11 16:00:24 GMT 2001 ^Iroot@ivy:/usr/src/packages/BUILD/bind8-8.2.3/bin/named
Sep 24 20:49:24 linux named[770]: /etc/named.conf:40: syntax error near '}'
Sep 24 20:49:24 linux named[770]: master zone "localhost" (IN) loaded (serial 42)
Sep 24 20:49:24 linux named[770]: master zone "0.0.127.in-addr.arpa" (IN) loaded (serial 42)
Sep 24 20:49:24 linux named[770]: hint zone "" (IN) loaded (serial 0)
Sep 24 20:49:24 linux named[770]: local.zone: Line 24: Unknown type: @.
Sep 24 20:49:24 linux named[770]: local.zone:24: Database error near (@)
Sep 24 20:49:24 linux named[770]: owner name "#.linux.local" IN (primary) is invalid - rejecting
Sep 24 20:49:24 linux named[770]: local.zone:25: owner name error
Sep 24 20:49:24 linux named[770]: local.zone:25: Database error near (MX)
Sep 24 20:49:24 linux named[770]: local.zone:29: data "sfahey.com" outside zone "linux.local" (ignored)
Sep 24 20:49:24 linux named[770]: local.zone:30: data "iws.com" outside zone "linux.local" (ignored)
Sep 24 20:49:24 linux named[770]: local.zone:31: data "myphp.com" outside zone "linux.local" (ignored)
Sep 24 20:49:24 linux named[770]: Zone "linux.local" (file local.zone): no NS RRs found at zone top
Sep 24 20:49:24 linux named[770]: master zone "linux.local" (IN) rejected due to errors (serial 199802151)
Sep 24 20:49:24 linux named[770]: local.rr.zone: Line 8: Unknown type: @.
Sep 24 20:49:24 linux named[770]: local.rr.zone:8: Database error near (@)
Sep 24 20:49:24 linux named[770]: Zone "0.168.192.in-addr.arpa" (file local.rr.zone): no NS RRs found at zone top
Sep 24 20:49:24 linux named[770]: master zone "0.168.192.in-addr.arpa" (IN) rejected due to errors (serial 199802151)
Sep 24 20:49:24 linux named[770]: listening on [127.0.0.1].53 (lo)
Sep 24 20:49:24 linux named[770]: listening on [192.168.0.1].53 (eth0)
Sep 24 20:49:24 linux named[770]: Forwarding source address is [0.0.0.0].32768
Sep 24 20:49:24 linux named[770]: hint zone "" (IN) loaded (serial 0)
Sep 24 20:49:24 linux named[771]: group = named
Sep 24 20:49:24 linux named[771]: user = named
Sep 24 20:49:24 linux named[771]: Ready to answer queries.
Sep 24 20:49:24 linux named[771]: sysquery: sendto([202.12.27.33].53): Network is unreachable



You put this on our other thread,
“When u created the domain in bind what did u call it? linux.local?”

I haven’t done that !!
Dose this have anything to do with it ? if so what do I do ?…had a quick look in the book, but not much help :(

Going to bed now :) been a long day

Talk to ya 2mora