LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-18-2011, 04:29 AM   #1
sailE
LQ Newbie
 
Registered: Dec 2011
Posts: 3

Rep: Reputation: Disabled
Linux DNS Server for Development


Hi everyone,

I am relatively new to Linux server setup, and I wish to use it to enhance my web development practice.

How do I set up a dns server that resolves my test sites to itself?
( the dns server is also my development machine, and i want the test sites to be pointed to itself )

I was able to set up a dns server 2 weeks ago, which performed this, but somehow, i was not doing it right, since i cannot browse anything outside of what the dns server resolves ( i.e. google, etc )

note : i only have a wimax internet connection ( dynamic ip )

thanks

(edited arbitrary line breaks)

Last edited by sailE; 12-18-2011 at 06:51 AM.
 
Old 12-18-2011, 06:05 AM   #2
Doc CPU
Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 999

Rep: Reputation: 294Reputation: 294Reputation: 294
Hi there,

Quote:
Originally Posted by sailE View Post
How do I set up a dns server that resolves my test sites to itself? ( the dns server is also my development machine, and i want the test sites to be pointed to itself )
do I understand you right: You want to resolve certain domains or host names to your local system for testing web sites, and it's all running on the same machine?
Then you don't even need a DNS server. Just add the host names you need to your /etc/hosts file, and point them to 127.0.0.1 (localhost). Create a Virtual Host in your Apache configuration for each host name, and you're done.

Beware that if you're "redirecting" existing host names outside your localhost, you can't access their public counterpart any more until you remove the /etc/hosts entry. So it's a good idea not to use the real host name for testing, but a slightly changed one. For example, if I wanted to test something that is intended to run under linuxquestions.org, I would set up a local test environment using the bogus host name linuxquestions.local.

Quote:
Originally Posted by sailE View Post
I was able to set up a dns server 2 weeks ago, which performed this, but somehow, i was not doing it right, since i cannot browse anything outside of what the dns server resolves ( i.e. google, etc )
Sounds like you forgot to configure this DNS server to forward queries to your "public" DNS if it doesn't resolve them on its own (DNS relaying). But I think the /etc/hosts method is better for you anyway.

ADDED: If you do want to use a local DNS, I recommend dnsmasq. It's a combination of a DHCP and a relaying DNS server, but you can disable either of these features. It's very easy to configure and extremely lightweight.

By the way: Please don't don't insert line breaks in your posting at arbitrary positions. Just let the text flow as it wants to.

[X] Doc CPU

Last edited by Doc CPU; 12-18-2011 at 06:09 AM.
 
1 members found this post helpful.
Old 12-18-2011, 06:13 AM   #3
akuthia
Member
 
Registered: Oct 2007
Location: triad, nc, usa
Distribution: Ubuntu
Posts: 222

Rep: Reputation: 29
Im guessing they may have copied the text from another source like a text editor.
 
Old 12-18-2011, 06:47 AM   #4
sailE
LQ Newbie
 
Registered: Dec 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
@Doc CPU

/etc/hosts generally works for common projects.

but i also want the dns server to facilitate mail, so i can internally ( within the dev machine ) run some test involving mail as well. and probably more important is i want to make this particular setup to work. ultimately, i want to run a few virtual machines for testing, so they can just look at the dns server and i won't have to explicitly make hosts file declaration for each os/platform.

you're right about the dns relaying, i knew i'm missing something but i don't know what it's called.

thanks for recommending dnsmasq, i came across it in my searches, but i was not sure that it provides everything that i want, given that i feel i'm probably a few steps from completing the setup with bind.

Last edited by sailE; 12-18-2011 at 09:01 AM.
 
Old 12-26-2011, 02:13 AM   #5
RobertEachus
Member
 
Registered: Dec 2011
Posts: 32

Rep: Reputation: 8
Lightbulb

Quote:
Originally Posted by sailE View Post
i knew i'm missing something but i don't know what it's called.
Quote:
Originally Posted by sailE View Post
i feel i'm probably a few steps from completing the setup with bind.
There are two options here; (Maybe more but lets start with two.)

1) Turning recursion on if it isn't already. If a firewall is blocking you from reaching port 53 over the internet this won't work. Allow-recursion any is the default so you really just need to make sure that it isn't there as allow-recursion none. Also bind will not be able to look up anything with out the hints file. You can download a copy of from: http://www.internic.net/zones/named.root

Code:
options {
  allow-recursion {any;};
};

zone "." {
  type hint;
  file "/etc/named/named.root";
};

zone "localhost" in{
  type master;
  file "/etc/named/master.localhost";
  allow-update{none;};
};

zone "0.0.127.in-addr.arpa" in{
  type master;
  file "/etc/named/localhost.rev";
  allow-update{none;};
};

2) Set up global DNS forwarding and then exclude your test domain from being forwarded. The downside here is that you have to put the DNS servers you are forwarding to inside named.conf.


Code:
options {
  forwarders { 1.1.1.1; 2.2.2.2; };
};


zone "testdomain.com" in{
  type master;
  file "/etc/named/testdomain.com";
  allow-update{none;};
  forwarders {};
};
Note: I left everything else in the options section out to make it clearer what to change and where. You should have more than just one line inside of your options section.

If your still having problems with this please reply back with the problems your having and a copy of your named.conf file.

Last edited by RobertEachus; 12-26-2011 at 02:17 AM. Reason: Corrected for Linux FS
 
Old 12-29-2011, 05:41 AM   #6
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,902

Rep: Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775
Quote:
Originally Posted by sailE View Post
thanks for recommending dnsmasq, i came across it in my searches, but i was not sure that it provides everything that i want, given that i feel i'm probably a few steps from completing the setup with bind.
Quote:
ADDED: If you do want to use a local DNS, I recommend dnsmasq. It's a combination of a DHCP and a relaying DNS server, but you can disable either of these features. It's very easy to configure and extremely lightweight.
I'm going to agree with Doc CPU, here; dnsmasq is at the easy end of the 'difficulty to set up' scale, Bind is at the other end (but it does get extra versatility in exchange). But, really, there aren't many things that most people would want to do that you can't do with Dnsmasq.

If you are really determined to use Bind (it may, for example, look better on your CV...), then you really ought to read some tutorials first. The Ablitz & Liu book (O'Reilly, in whatever edition it is up to now) is always worth a read, particularly the early part where it explains the principles. It may not be worth buying, so a copy that you can borrow from a library might be a good thing to track down. Alternatively, a quicker way to get going, but a less good way to learn, is O'Reilly's (Cricket Liu, I think) Bind Cookbook.

Alternatively, there are perfectly good tutorials on-line. Try Linux Home Networking or YoLinux or a search on 'tutorial', 'Dns' and 'linux' will work. In fact, for most Linux subjects, a search on 'Linux' , 'tutorial' and some more specific term(s) works well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to get Windows Clients to be served DNS from a Linux BIND-DNS Server texmansru47 Linux - Networking 12 07-10-2008 07:06 PM
LXer: Find out DNS Server Version With DNS Server Fingeprinting Tool LXer Syndicated Linux News 0 12-21-2007 04:50 PM
Linux Web Development Server, What Distro? Gear_freak2000 Linux - General 3 07-07-2004 03:06 AM


All times are GMT -5. The time now is 06:00 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration