Bind9 DNS resolves full domain to localhost

I have set up a Bind9 DNS server on my development VM which is running Debian Wheezy. My addresses resolve from my host machine (Win7) to my dev VM, and I can ping from there. Internally on the VM, I can ping my names (www, share, my_name, etc.) and it resolves to the correct ip (11.11.11.11). But when I ping my full FDQN (www.app.dev), it resolves to localhost. This is not true for my_name.app.dev, only the CNAME entries in my db.app.dev file in my /etc/bind/ folder. So if I ping www, resolves to 11.11.11.11, www.app.dev resolves to 127.0.0.1. Pinging www.app.dev or just www from outside the DNS VM resolves fine. Is this expected behavior or am I missing something?

Here are the files I think you want. I added resolv.conf in case there's something wrong there.

/etc/bind/zones/db.app.dev

$TTL    604800
@   IN  SOA app.dev. root.app.dev. (
                 15     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;

app.dev.   IN NS my_name.app.dev.
app.dev.   IN A 11.11.11.11
;@  IN  A   127.0.0.1
;@  IN  AAAA    ::1
my_name     IN A 11.11.11.11
gateway     IN A 11.11.11.2
vmhost      IN A 11.11.11.1
www         IN CNAME app.dev.
stream      IN CNAME app.dev.

/etc/bind/named.conf.local

include "/etc/bind/zones.rfc1918";

zone "app.dev" {
    type master;
    file "/etc/bind/zones/db.app.dev";
};

zone "11.11.11.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/db.11";
};

/etc/resolv.conf

domain app.dev
search app.dev
nameserver 11.11.11.11

Here is the hosts file /etc/hosts

127.0.0.1                       localhost
11.11.11.11 my_name.app.dev     my_name

# The following lines are desirable for IPv6 capable hosts
#::1     localhost ip6-localhost ip6-loopback
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters

dig provided: dig www.app.dev any #=>

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> www.app.dev any
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51223
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;www.app.dev.           IN  ANY

;; ANSWER SECTION:
www.app.dev.        604800  IN  CNAME   app.dev.


;; AUTHORITY SECTION:
app.dev.        604800  IN  NS  my_name.app.dev.

;; ADDITIONAL SECTION:
my_name.app.dev.        604800  IN  A   11.11.11.11

;; Query time: 2 msec
;; SERVER: 11.11.11.11#53(11.11.11.11)
;; WHEN: Wed Aug 13 12:48:15 2014
;; MSG SIZE  rcvd: 78

here is the ping: ping www.app.dev

PING www.app.dev (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.032 ms
64 bytes from localhost (127.0.0.1): icmp_req=3 ttl=64 time=0.038 ms
^C
--- www.app.dev ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.032/0.035/0.038/0.002 ms

Solution 1:

if you have www setup as your machine hostname in your hosts file (/etc/hosts), it will resolve there first from the local machine (hosts is checked before the resolvers you have setup). Check your hosts file...