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 pretty sure I'm doing something stupid, but let's ask anyway.

I'm trying to create "hostnames" on my LAN machines (eg. when you ping "chris", Chris' machine - IP 12.34.56.78 - respond to that). I'm doing this through a Debian (lenny) server with bind9, and using this server as the LAN's primary DNS server.

Problem: I can ping whatever.chris from other machines, but not chris. What am I doing wrong?

I followed these instructions to setup bind9: http://www.cahilig.net/2008/07/05/how-setup-lan-dns-server-using-bind9-under-debian-etch-and-ubuntu-804

Files:

/etc/hostname

chris

/etc/hosts

127.0.0.1 localhost
192.168.1.3 chris.chris chris

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

/etc/resolv.conf

Didn't touch this one, as resolvconf overwrites it

/etc/bind/name.conf.local

zone "chris" {
        type master;
        file "db.chris";
};

zone "1.168.192.in-addr.arpa" {
        type master;
        file "db.192.168.1";
};

/var/cache/bind/db.chris

$TTL 604800
@ IN SOA main.chris. admin.chris. (
                2012051610      ;serial
                04800           ;refresh
                86400           ;retry
                60              ;expire
                604800          ;negative cache TTL
                )
@      IN      NS       main.chris.
@      IN      A        192.168.1.3
www    IN      A        192.168.1.3
main   IN      A        192.168.1.3

/var/cache/bind/db.192.168.1

$TTL 604800
@ IN SOA main.chris. admin.chris. (
                2012051606      ;serial
                604800          ;refresh
                86400           ;retry
                60              ;expire
                604800          ;negative cache TTL
                )
@       IN      NS      main.chris.
1       IN      PTR     chris.

/etc/bind/named.conf.options

options {
        directory "/var/cache/bind";

        forwarders {
                192.168.1.1;
        };

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
};
share|improve this question

3 Answers 3

I'd recommend you put all these in one zone, lets call it "local", then add hosts to local like chris.local, john.local. Then you want each of these machines to end up with search local in their /etc/resolv.conf, This will make it so that when they ping chris it automatically will try to find an ip address for chris.local if chris isn't found.

Typically you would have your dhcp server send them this search directive, but it can also be configured using resolvconf

share|improve this answer
    
I changed that on /etc/network/interfaces, adding dns-nameservers 192.168.1.3 and dns-search chris to it and restarting /etc/init.d/networking, but it didn't work. :( –  dmmd May 16 '12 at 0:39

Ensure that the permissions on your zone file is correct. I believe it needs to be chmod 644, or was it 744. Once you have made the changes did you do: "/etc/init.d/named restart" Also, for any hints on additional issues check your /var/log/messages for any pointers.

Your zone file should look like this.

http://pastebin.com/cB9SCJH0

share|improve this answer
    
I tried that but no luck. I'm still able to ping 'whatever.chris', but not 'chris' itself. Also, the log didn't give me anything useful. –  dmmd May 16 '12 at 0:33

If you want to do dns lookups by shortname (i.e. not just by fully-qualified domain names), then you are in the realm of /etc/resolv.conf and the 'search' parameter.

search chris

man 5 resolv.conf for details

share|improve this answer

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.