Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm setting up DNS using bind9 on one of my Ubuntu (12.10) boxes under my home network because my router doesn't support DD-WRT or its own DNS.

I set up a zone for "mydomain.net" with an A record for test.mydomain.net and have it pointing to 192.168.1.6 (the statically-assigned ip of the machine in question).

I want to be able to access (via HTTP/browser, mainly) this machine by just using http://test/, without having to type in the mydomain.net portion.

I have everything else correctly configured, because I can successfully access test.mydomain.net and get the correct Apache response, but I cannot find any particular setting that would allow me to access just http://test/.

Here is my named.conf.local file

zone "mydomain.net" {
        type master;
        file "/etc/bind/db.mydomain.net";
};

zone "1.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.192";
};

and my db.mydomain.net zone file

; BIND data file for local
;
$TTL    604800
@       IN      SOA     mydomain.net. tomprogramming.gmail.com. (
                     2013052603         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
        IN      A       192.168.1.6
;
@       IN      NS      ns.mydomain.net.
@       IN      A       192.168.1.6
@       IN      AAAA    ::1
ns      IN      A       192.168.1.6
test    IN      A       192.168.1.6
share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

To refer to a host using short hostnames rather than fully qualified domain names, you simply configure the resolver on your client to search a default domain. On Unix/Linux clients, you do that by putting

search mydomain.net

in your /etc/resolv.conf file.

Note that resolv.conf is frequently automatically managed by DHCP or by your operating system's network configuration (/etc/network/interfaces or NetworkManager). If that is the case, any changes you make to /etc/resolv.conf may be overwritten.

share|improve this answer
    
well, this certainly worked. However, the main purpose for this is to get the machine accessible for my ipad/iphone. My Windows machines definitely worked due to netbios (though Ive disabled that to test this). I guess I would have to figure out what @Cha0s said in having the DHCP from my router push the domain down to the machines that I can't manually set a search domain for –  Thomas Jones May 26 '13 at 17:47
    
iOS lets you override the Search Domains for your Wi-Fi interface, even when you use DHCP. That's the quick solution. The "right" solution might be to get a proper access point that lets you set DHCP options. –  200_success May 27 '13 at 0:38
    
Wow. So it does. Somehow I had missed that setting completely. You're right though, that the "right" answer is to get a proper access point. That way I don't have to do any particular manual setup for future machines. –  Thomas Jones May 27 '13 at 6:22
add comment

This is actually an issue with your DHCP setup.

You need to configure dd-wrt's DHCP Server to push the mydomain.net domain to the clients.

That way when you try to access http://test/ the dns lookup that the client does is for test.mydomain.net.

If you have clients with static IPs then you need to configure the search domain to mydomain.net in their dns client settings.

share|improve this answer
    
My router serves as my DHCP (though I might end up changing that to my DNS machine as well, if I have to), and doesnt support DD-WRT (its rather old, but does everything that I need it to until now). Not sure if I can push down the domain –  Thomas Jones May 26 '13 at 17:49
    
My mistake, I thought your router was running dd-wrt. Which router do you have? If you setup DHCP on your pc, for ISC DHCP Server the options you are looking for are option domain-name and option domain-search linux.die.net/man/5/dhcp-options –  Cha0s May 26 '13 at 18:04
    
its a netgear wgr614v9. There's only a checkbox in the config for "use router as DHCP" –  Thomas Jones May 26 '13 at 18:20
    
You can set the domain on the 'Basic ISP Settings' page according to the documentation: documentation.netgear.com/wgr614v9/enu/202-10308-01/… –  Cha0s May 26 '13 at 18:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.