LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-02-2009, 09:50 AM   #1
KellyT
LQ Newbie
 
Registered: May 2007
Location: Thirsk, North Yorkshire, UK
Distribution: Ubuntu
Posts: 13

Rep: Reputation: 0
Setting up a local DNS server


Hi,

Further to my previous post, I've been setting up a local web development server using Ubuntu Server 9.10. Thanks to another contributor to this forum, it's now all working.

I've installed all of the module necessary (I think) to enable it to act as a DNS server. What I would like to do now is set up a DNS zone inside my network, so that I can go to http://servername instead of http://localhost

I would also like to set it up so that I can have http://servername/www.sitename.com/ and have www.sitename.com as the site root. I've previously achieved something similar using Vhosts on my old setup (which used XAMPP on my local machine). I presumed I could use DNS instead once I'd set up my local webserver.

Please bear with me if I'm not referring to things correctly - I'm a web developer who is only just learning about web server management.

Thanks,

Kelly
 
Old 11-02-2009, 12:31 PM   #2
melk600
LQ Newbie
 
Registered: Nov 2003
Location: Ashland, OH
Distribution: Mandriva
Posts: 16

Rep: Reputation: 1
It won't help you learn all the ins and outs of DNS setup, but I would recommend using dnsmasq. It will do what your asking here probably by installing it in its default form and you might not have to edit anything. At least you definitely won't have to edit much.

Mike E.
 
Old 11-02-2009, 05:34 PM   #3
zomane
Member
 
Registered: Sep 2005
Location: Austria
Distribution: Debian, CentOS, OpenBSD, FreeBSD
Posts: 52

Rep: Reputation: 16
If its for local network needs and didn't using real domain name(actually with real domain is almost the same) you can setup BIND like this (I'm DNS newbie so you must also read docs created from professionals ) . This is just sample setup :

/etc/named.conf
Code:
logging {
        channel all {
                    file "/var/log/named.log" versions 4 size 20m;
                    severity debug 5;
                    print-time yes ;
                    print-severity yes;
                    print-category yes;
                    };
        category default   {
                    all;        
                    };
                
        };

options {
        directory "/var/cache/bind";
        recursion yes;
        allow-query { any; };   
};
// required zone for recursive queries
zone "." {
        type hint;
        file "/etc/bind/root.servers";
};
// required local host domain
zone "localhost" in{
        type master;
        file "/etc/bind/localhost.master";
        allow-update{none;};
};
// localhost reverse map
zone "0.0.127.in-addr.arpa" in{
        type master;
        file "/etc/bind/localhost.rev";
        allow-update{none;};
};
//your domain here
zone "site.com" {
        type master;
        file "/etc/bind/site.com";
};
//your domain reverse zone - PTR
zone "0.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/0.168.192.in-addr.arpa";
};
This are zone files I put here only that for localhost, but you can get the the idea how to create you domain zones:
/etc/bind/localhost.master
Code:
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
@       IN      A       127.0.0.1
@       IN      AAAA    ::1
/etc/bind/localhost.rev

Code:
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
1.0.0   IN      PTR     localhost.
If you are using your bind for recursive queries you will need root.servers - you can find it via google its public.

Or as melk600 said you can use dnsmasq it has simpler setup
Setup is something like this-per host :
Code:
dhcp-host=4C:00:10:52:0B:87,192.168.168.96
address=/site.com/192.168.168.96
In few words first line says give to 4C:00:10:52:0B:87(MAC address ) this ip 192.168.168.96
Second line says :
For this IP 192.168.168.96 name is site.com

Also you have global options like
Code:
#your resolv.conf - where are described ISP nameservers
resolv-file=/root/loadbal_routing/resolv.conf.ext
#interface to listen for queries
interface=eth0
#dont listen here
except-interface=lo
# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
no-hosts
#dhcp pool range
dhcp-range=192.168.168.1,192.168.168.190,255.255.255.0,12h
#where to store leases
dhcp-leasefile=/var/state/dnsmasq/dnsmasq.leases
#if you want logging
log-queries
You can setup multiple names to respond from one IP in BIND zone cofiguration
like this:
Code:
@       IN      A       192.168.168.1
but on this IP also responds
www              IN      CNAME  site.com.
ftp              IN      CNAME  site.com.
git              IN      CNAME  site.com.
So www.site.com, ftp.site.com and git.site.com will have same ip address 192.168.168.1

Last edited by zomane; 11-02-2009 at 11:37 PM.
 
Old 11-03-2009, 03:43 AM   #4
abakalidis
LQ Newbie
 
Registered: Jun 2006
Location: Komotini, Greece
Distribution: Fedora 11 (CentOS 5.x)
Posts: 13

Rep: Reputation: 1
Hi, apart from the CNAME entries in your DNS configuration, I would also recommend that you set up Virtual Hosting on your apache server. This is going to make your life much easier, especially if you need to work with many different projects at the same time.

You can find extensive information about it your local apache documentation. (Redhat based distros contains the httpd-manual package that installs the HTML version of the apache docs available at URL http://your_server/manual.

Athanassios
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Local DNS server lukesc Linux - Server 3 08-07-2009 11:08 AM
DJB DNS - help setting up, local network andy holland Linux - Server 0 05-15-2008 06:42 AM
Local DNS server Quantum0726 Linux - Networking 3 08-19-2005 02:47 AM
Setting up local DNS domain name Corxscrew Linux - Newbie 1 01-20-2005 07:49 AM
need help setting up local DNS rnorton Linux - Networking 7 03-21-2002 08:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration