# LAN DNS config

## anjames

I want to set up DNS on my LAN so that connected systems can be contacted via DNS names instead of IP's.

I have bind installed on the router system, and a wifi card in master mode. It's configured to give out an IP via dhcp to querying systems and hands them its own IP for DNS requests. My question is how to configure bind.

I have in /etc/bind/named.conf

```
zone "." IN {

  type hint;

  file "pri/local.zone";

}
```

I have the following zone file in /var/bind/pri/local.zone:

```
*pirateNet* 14400 IN A 192.168.0.1

*helios* 14400 IN A 192.168.0.2

*fusion* 14400 IN A 192.168.0.3

* 14400 IN A 192.168.0.1
```

The last line is supposed to redirect all unknown requests to 192.168.0.1 by default, so that every undefined request is directed to 192.168.0.1. 

Also, if I make a script to dynamically assign DNS names to connected systems which adds a line like

```
*hostname* 14400 IN A 192.168.0.???
```

where the script probes the hostname of the assigned ip, do I have to restart the bind server for this to take effect, or is it automagic?

This is a closed network which is not connected to the internet, so I want to learn about building the DNS structure. Are there any good HOWTO's out there? I have found a number of posts here and there, but no spectacular explanations. The bind administrator's guide is a bit clumsy, but if I have to I guess I can wade through that muck. I guess that I'm curious about what the 'zone "." IN {type hint; ....}' line does in named.conf and what the IN, A, and 14400 parts are about in the zone file. 

Does anyone know how good the O'Reilly book about DNS is?

----------

## Suer7reus

You should read this document: http://www.arda.homeunix.net/dnssetup.html.

It covers integrating DNS and DHCP to allow for dynamic updates.  It's not perfect, and since your network is not Internet-connected it won't apply perfectly (not that it would anyway), but I think it will prove insightful.  I used it as a guide while setting up my own dynamic-updating DNS/DHCP setup.

----------

## anjames

Another HOWTO page I found useful is at

The Name Service HOWTO

http://www.cryptnet.net/fdp/admin/nameservice.html

It felt a little more accessible at first glance than the link in the last post.

----------

## anjames

I also had good luck with a quick Googling of 'CNAME wildcard'.

From http://www.digitalpoint.com/lists/33272.html

 *Quote:*   

> >For a wildcard A record, you'd enter something like this:
> 
> >
> 
> >*.example.com. A 192.168.0.1
> ...

 

----------

## anjames

OK, so I gave it a good shot this evening... really. But I still can't get this darned thing working. ARRRRGH! (like a pirate)

Anyway, here's what I did. Let me know if you see a stumble here or there.

I have brought up net.wlan0 in master mode as follows:

```
Helios2 ~ # cat /etc/conf.d/net

config_wlan0="192.168.0.1"

mode_wlan0="master"

essid_wlan0="pirateNet"

channel_wlan0="9"

Helios2 ~ # /etc/init.d/net.wlan0 restart

 * Starting wlan0

 *   Configuring wireless network for wlan0

 *     wlan0 configured as ESSID "wifiNet"

 *     in master mode on channel 9 (WEP disabled)

 *   Bringing up wlan0

 *     192.168.0.1
```

I configured udhcpd as follows and brought it up:

```
Helios2 ~ # cat /etc/udhcpd.conf

interface       wlan0           #default: eth0

# The start and end of the IP lease block

start           192.168.0.10    #default: 192.168.0.20

end             192.168.0.254   #default: 192.168.0.254

# Options

opt     dns     192.168.0.1

opt     subnet  255.255.255.0

opt     router  192.168.0.1

opt     lease   86400           # 1 days of seconds

Helios2 ~ # /etc/init.d/udhcp restart

 * Starting udhcpd ...                                                                                                                                                                  [ ok ]
```

I have also configured and brought up Apache:

```
Helios2 ~ # /etc/init.d/udhcp restart

 * Starting udhcpd ...                                                                                                                                                                  [ ok ]
```

I'm missing something here... oh yeah, bind. I also configured and brought up bind like this:

```
Helios2 ~ # cat /etc/bind/named.conf

//acl "wifiNet" { 192.168.0.0/24; };

options {

        directory "/var/bind";

        listen-on-v6 { none; };

        listen-on { 127.0.0.1; };

        // to allow only specific hosts to use the DNS server:

        //allow-query {

        //      "wifiNet";

        //};

        //recursion no;

        //query-source address * port 53;

        pid-file "/var/run/named/named.pid";

};

//zone "." IN {

//      type hint;

//      file "named.ca";

//      file "pri/wifiNet.zone";

//};

zone "localhost" IN {

        type master;

        file "pri/localhost.zone";

        allow-update { none; };

        notify no;

};

zone "127.in-addr.arpa" IN {

        type master;

        file "pri/127.zone";

        allow-update { none; };

        notify no;

};

zone "wifiNet" IN {

        type master;

        file "pri/wifiNet.zone";

        allow-update { none; };

        notify no;

};

Helios2 ~ # cat /var/bind/pri/wifiNet.zone

wifiNet. IN A 192.168.0.1

*. CNAME wifiNet

Helios2 ~ # /etc/init.d/named start

 * Starting named ...                                                                                                                                                                   [ ok ]

```

So the idea here is the following: clients connecting to the wifiNet SSID will DHCP from this host and get an IP and route their DNS lookups to this server, which redirects every DNS query to wifiNet unless its been defined otherwise. I'm using my girlfriend's Powerbook as the client system, but it is based on unix so things are still linuxy. I type cat /etc/resolv.conf on the client system and get the following:

```
[missbeautiful:~] cat resolv.conf

nameserver 102.168.0.1
```

Typing ifconfig indicates that the client has 192.168.0.11 for its IP address. So the dhcp server gave out the first available IP address and the DNS server, as configured. GREAT! That much works at least.

To test the web server, I direct Safari to 192.168.0.1 and I get the default Apache webpage. Awesome. That's working too!

So now I'm thinking, is the DNS server working right? I fire up Safari and type in: www.google.com, which I believe should be redirected to wifiNet since I haven't defined it otherwise and I've set up the wildcard CNAME in wifiNet.zone to redirect all undefined domain names to wifiNet. At this point Safari hangs and doesn't resolve anything at all. Fiddlesticks. I wanted to see wifiNet appear in the address bar, and get the same webpage served out that I had from before, at least that's how I think I configured it. I've apparently erred somewhere. 

Here's the tcpdump for the session I've described above, in case it helps resolve any problems:

```
Helios2 ~ # tcpdump -i wlan0

00:02:38.441588 IP (tos 0x0, ttl 255, id 45919, offset 0, flags [none], proto: UDP (17), length: 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:0d:93:ed:e2:e7 (oui Unknown), length: 300, xid:0x5590eaf4, flags: [none] (0x0000)

     Client Ethernet Address: 00:0d:93:ed:e2:e7 (oui Unknown) [|bootp]

00:02:38.453710 IP (tos 0x0, ttl  64, id 0, offset 0, flags [none], proto: UDP (17), length: 576) 192.168.0.1.bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length: 548, xid:0x5590eaf4, flags: [none] (0x0000)

     Client Ethernet Address: 00:0d:93:ed:e2:e7 (oui Unknown) [|bootp]

00:02:39.495076 IP (tos 0x0, ttl 255, id 45920, offset 0, flags [none], proto: UDP (17), length: 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:0d:93:ed:e2:e7 (oui Unknown), length: 300, xid:0x5590eaf4, secs:1, flags: [none] (0x0000)

     Client Ethernet Address: 00:0d:93:ed:e2:e7 (oui Unknown) [|bootp]

00:02:39.505742 IP (tos 0x0, ttl  64, id 0, offset 0, flags [none], proto: UDP (17), length: 576) 192.168.0.1.bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length: 548, xid:0x5590eaf4, flags: [none] (0x0000)

     Client Ethernet Address: 00:0d:93:ed:e2:e7 (oui Unknown) [|bootp]

00:02:39.617462 IP (tos 0x0, ttl 255, id 45921, offset 0, flags [none], proto: UDP (17), length: 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:0d:93:ed:e2:e7 (oui Unknown), length: 300, xid:0x5590eaf5, flags: [none] (0x0000)

     Client Ethernet Address: 00:0d:93:ed:e2:e7 (oui Unknown) [|bootp]

00:02:39.633773 IP (tos 0x0, ttl  64, id 0, offset 0, flags [none], proto: UDP (17), length: 576) 192.168.0.1.bootps > 192.168.0.11.bootpc: BOOTP/DHCP, Reply, length: 548, xid:0x5590eaf5, flags: [none] (0x0000)

     Your IP: 192.168.0.11

     Client Ethernet Address: 00:0d:93:ed:e2:e7 (oui Unknown) [|bootp]

00:02:40.647345 IP (tos 0x0, ttl 255, id 45922, offset 0, flags [none], proto: UDP (17), length: 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:0d:93:ed:e2:e7 (oui Unknown), length: 300, xid:0x5590eaf5, secs:1, flags: [none] (0x0000)

     Client Ethernet Address: 00:0d:93:ed:e2:e7 (oui Unknown) [|bootp]

00:02:40.657814 IP (tos 0x0, ttl  64, id 0, offset 0, flags [none], proto: UDP (17), length: 576) 192.168.0.1.bootps > 192.168.0.11.bootpc: BOOTP/DHCP, Reply, length: 548, xid:0x5590eaf5, flags: [none] (0x0000)

     Your IP: 192.168.0.11

     Client Ethernet Address: 00:0d:93:ed:e2:e7 (oui Unknown) [|bootp]

00:02:40.670584 arp who-has 192.168.0.11 tell 0.0.0.0

00:02:40.970790 arp who-has 192.168.0.11 tell 0.0.0.0

00:02:41.270992 arp who-has 192.168.0.11 tell 0.0.0.0

00:02:41.571232 arp who-has 192.168.0.11 tell 0.0.0.0

00:02:41.871526 arp who-has 192.168.0.11 tell 192.168.0.11

00:02:42.175082 arp who-has 192.168.0.11 tell 192.168.0.11

00:02:42.207337 arp who-has 192.168.0.1 tell 192.168.0.11

00:02:42.207356 arp reply 192.168.0.1 is-at 00:e0:98:f6:24:98 (oui Unknown)

00:02:42.210139 IP (tos 0x0, ttl  64, id 38855, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51531 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:42.210172 IP (tos 0xc0, ttl  64, id 53402, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 38855, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51531 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:42.612248 IP (tos 0x0, ttl  64, id 38995, offset 0, flags [none], proto: UDP (17), length: 71) 192.168.0.11.51532 > 192.168.0.1.domain: [udp sum ok]  55781+ PTR? 11.0.168.192.in-addr.arpa. (43)

00:02:42.612283 IP (tos 0xc0, ttl  64, id 53403, offset 0, flags [none], proto: ICMP (1), length: 99) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 79

   IP (tos 0x0, ttl  64, id 38995, offset 0, flags [none], proto: UDP (17), length: 71) 192.168.0.11.51532 > 192.168.0.1.domain:  55781+[|domain]

00:02:42.707786 IP (tos 0x0, ttl  64, id 38996, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51533 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:42.707822 IP (tos 0xc0, ttl  64, id 53404, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 38996, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51533 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:44.213260 IP (tos 0x0, ttl  64, id 39000, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51534 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:44.213300 IP (tos 0xc0, ttl  64, id 53405, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39000, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51534 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:44.713674 IP (tos 0x0, ttl  64, id 39002, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51535 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:44.713713 IP (tos 0xc0, ttl  64, id 53406, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39002, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51535 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:46.219046 IP (tos 0x0, ttl  64, id 39004, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51536 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:46.219084 IP (tos 0xc0, ttl  64, id 53407, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39004, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51536 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:46.719484 IP (tos 0x0, ttl  64, id 39006, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51537 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:46.719523 IP (tos 0xc0, ttl  64, id 53408, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39006, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51537 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:47.210220 arp who-has 192.168.0.11 tell 192.168.0.1

00:02:47.211983 arp reply 192.168.0.11 is-at 00:0d:93:ed:e2:e7 (oui Unknown)

00:02:47.612214 IP (tos 0x0, ttl  64, id 39007, offset 0, flags [none], proto: UDP (17), length: 71) 192.168.0.11.51532 > 192.168.0.1.domain: [udp sum ok]  55781+ PTR? 11.0.168.192.in-addr.arpa. (43)

00:02:47.612249 IP (tos 0xc0, ttl  64, id 53409, offset 0, flags [none], proto: ICMP (1), length: 99) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 79

   IP (tos 0x0, ttl  64, id 39007, offset 0, flags [none], proto: UDP (17), length: 71) 192.168.0.11.51532 > 192.168.0.1.domain:  55781+[|domain]

00:02:48.224522 IP (tos 0x0, ttl  64, id 39010, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51538 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:48.224560 IP (tos 0xc0, ttl  64, id 53410, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39010, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51538 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:48.725241 IP (tos 0x0, ttl  64, id 39012, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51539 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:48.725278 IP (tos 0xc0, ttl  64, id 53411, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39012, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51539 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:50.230707 IP (tos 0x0, ttl  64, id 39015, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51540 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:50.230745 IP (tos 0xc0, ttl  64, id 53412, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39015, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51540 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:50.731095 IP (tos 0x0, ttl  64, id 39018, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51541 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:50.731132 IP (tos 0xc0, ttl  64, id 53413, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39018, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51541 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:56.236564 IP (tos 0x0, ttl  64, id 39022, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51542 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:02:56.236601 IP (tos 0xc0, ttl  64, id 53414, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39022, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51542 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:01.744326 IP (tos 0x0, ttl  64, id 39024, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51543 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:01.744365 IP (tos 0xc0, ttl  64, id 53415, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39024, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51543 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:03.396447 IP (tos 0x0, ttl  64, id 39025, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.0.11.54719 > 192.168.0.1.http: S, cksum 0xe3ba (correct), 2984332296:2984332296(0) win 65535 <mss 1460,nop,wscale 0,nop,nop,timestamp 2578741314 0>

00:03:03.396497 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.0.1.http > 192.168.0.11.54719: S, cksum 0x10cd (correct), 1780436502:1780436502(0) ack 2984332297 win 5792 <mss 1460,nop,nop,timestamp 3081174 2578741314,nop,wscale 2>

00:03:03.398378 IP (tos 0x0, ttl  64, id 39026, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.0.11.54719 > 192.168.0.1.http: ., cksum 0x5333 (correct), 1:1(0) ack 1 win 65535 <nop,nop,timestamp 2578741314 3081174>

00:03:03.401839 IP (tos 0x0, ttl  64, id 39027, offset 0, flags [DF], proto: TCP (6), length: 288) 192.168.0.11.54719 > 192.168.0.1.http: P 1:237(236) ack 1 win 65535 <nop,nop,timestamp 2578741314 3081174>

00:03:03.401858 IP (tos 0x0, ttl  64, id 19905, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.0.1.http > 192.168.0.11.54719: ., cksum 0x4b92 (correct), 1:1(0) ack 237 win 1716 <nop,nop,timestamp 3081175 2578741314>

00:03:03.402381 IP (tos 0x0, ttl  64, id 19906, offset 0, flags [DF], proto: TCP (6), length: 919) 192.168.0.1.http > 192.168.0.11.54719: P 1:868(867) ack 237 win 1716 <nop,nop,timestamp 3081175 2578741314>

00:03:03.592697 IP (tos 0x0, ttl  64, id 39028, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.0.11.54719 > 192.168.0.1.http: ., cksum 0x4ee3 (correct), 237:237(0) ack 868 win 65535 <nop,nop,timestamp 2578741314 3081175>

00:03:07.249784 IP (tos 0x0, ttl  64, id 39029, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51544 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:07.249822 IP (tos 0xc0, ttl  64, id 53416, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39029, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51544 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:12.759048 IP (tos 0x0, ttl  64, id 39030, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51545 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:12.759084 IP (tos 0xc0, ttl  64, id 53417, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39030, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51545 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:18.400268 IP (tos 0x0, ttl  64, id 19907, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.0.1.http > 192.168.0.11.54719: F, cksum 0x3988 (correct), 868:868(0) ack 237 win 1716 <nop,nop,timestamp 3084925 2578741314>

00:03:18.402209 IP (tos 0x0, ttl  64, id 39086, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.0.11.54719 > 192.168.0.1.http: ., cksum 0x401e (correct), 237:237(0) ack 869 win 65535 <nop,nop,timestamp 2578741344 3084925>

00:03:23.262101 IP (tos 0x0, ttl  64, id 39155, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51550 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:23.262139 IP (tos 0xc0, ttl  64, id 53418, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39155, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51550 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:24.765389 IP (tos 0x0, ttl  64, id 39220, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51553 > 192.168.0.1.domain: [udp sum ok]  21116+ A? www.wifinet.com. (35)

00:03:24.765428 IP (tos 0xc0, ttl  64, id 53419, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39220, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51553 > 192.168.0.1.domain:  21116+[|domain]

00:03:29.764724 IP (tos 0x0, ttl  64, id 39221, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51553 > 192.168.0.1.domain: [udp sum ok]  21116+ A? www.wifinet.com. (35)

00:03:29.764761 IP (tos 0xc0, ttl  64, id 53420, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39221, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51553 > 192.168.0.1.domain:  21116+[|domain]

00:03:33.766135 IP (tos 0x0, ttl  64, id 39222, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51554 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:33.766174 IP (tos 0xc0, ttl  64, id 53421, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39222, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51554 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:34.765237 IP (tos 0x0, ttl  64, id 39223, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51553 > 192.168.0.1.domain: [udp sum ok]  21116+ A? www.wifinet.com. (35)

00:03:34.765274 IP (tos 0xc0, ttl  64, id 53422, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39223, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51553 > 192.168.0.1.domain:  21116+[|domain]

00:03:39.765283 IP (tos 0x0, ttl  64, id 39224, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51553 > 192.168.0.1.domain: [udp sum ok]  21116+ A? www.wifinet.com. (35)

00:03:39.765321 IP (tos 0xc0, ttl  64, id 53423, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39224, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51553 > 192.168.0.1.domain:  21116+[|domain]

00:03:44.271579 IP (tos 0x0, ttl  64, id 39225, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51555 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:44.271617 IP (tos 0xc0, ttl  64, id 53424, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port osu-nms unreachable, length 40

   IP (tos 0x0, ttl  64, id 39225, offset 0, flags [none], proto: UDP (17), length: 32) 192.168.0.11.51555 > 192.168.0.1.osu-nms: [udp sum ok] UDP, length 4

00:03:45.784383 IP (tos 0x0, ttl  64, id 39315, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51558 > 192.168.0.1.domain: [udp sum ok]  9554+ A? www.wifinet.com. (35)

00:03:45.784423 IP (tos 0xc0, ttl  64, id 53425, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39315, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51558 > 192.168.0.1.domain:  9554+[|domain]

00:03:50.784636 IP (tos 0x0, ttl  64, id 39317, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51558 > 192.168.0.1.domain: [udp sum ok]  9554+ A? www.wifinet.com. (35)

00:03:50.784673 IP (tos 0xc0, ttl  64, id 53426, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39317, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51558 > 192.168.0.1.domain:  9554+[|domain]

00:03:55.782508 arp who-has 192.168.0.11 tell 192.168.0.1

00:03:55.806624 arp reply 192.168.0.11 is-at 00:0d:93:ed:e2:e7 (oui Unknown)

00:03:55.806688 IP (tos 0x0, ttl  64, id 39318, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51558 > 192.168.0.1.domain: [udp sum ok]  9554+ A? www.wifinet.com. (35)

00:03:55.806717 IP (tos 0xc0, ttl  64, id 53427, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39318, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51558 > 192.168.0.1.domain:  9554+[|domain]

00:04:00.785106 IP (tos 0x0, ttl  64, id 39319, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51558 > 192.168.0.1.domain: [udp sum ok]  9554+ A? www.wifinet.com. (35)

00:04:00.785142 IP (tos 0xc0, ttl  64, id 53428, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39319, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51558 > 192.168.0.1.domain:  9554+[|domain]

00:04:03.426944 IP (tos 0x0, ttl  64, id 39320, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.0.11.54719 > 192.168.0.1.http: F, cksum 0x3fc3 (correct), 237:237(0) ack 869 win 65535 <nop,nop,timestamp 2578741434 3084925>

00:04:03.426991 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.0.1.http > 192.168.0.11.54719: ., cksum 0x0d17 (correct), 869:869(0) ack 238 win 1716 <nop,nop,timestamp 3096181 2578741434>

00:04:06.789015 IP (tos 0x0, ttl  64, id 39329, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51561 > 192.168.0.1.domain: [udp sum ok]  26911+ AAAA? www.wifinet.com. (35)

00:04:06.789054 IP (tos 0xc0, ttl  64, id 53429, offset 0, flags [none], proto: ICMP (1), length: 91) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 71

   IP (tos 0x0, ttl  64, id 39329, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51561 > 192.168.0.1.domain:  26911+[|domain]

00:04:11.789274 IP (tos 0x0, ttl  64, id 39330, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.0.11.51561 > 192.168.0.1.domain: [udp sum ok]  26911+ AAAA? www.wifinet.com. (35)

```

I'm not really too hot with tcpdump, so I don't really understand all the packets above. It looks like the Powerbook asked for and received an IP, but who is 0.0.0.0???  Then there's some pinging going on between me and the router, I didn't do this so maybe it's an automatic Powerbook thing or my router keeping tabs on its people.

What about this:

```
ICMP 192.168.0.1 udp port osu-nms unreachable
```

does that mean that something is borked?

I swear I only typed wifiNet, so why does it say www.wifiNet.com? Is that Safari trying to have a good idea?

Is there a grand HOWTO explaining how all this works?

Thanks ahead of time!

----------

## hollyo

And, is the BIND working then? Check BIND logs it should tell you if there are any errors in zones.

BIND9 is really tight considering logical errors so you might see thinks like, out of zone data ignoring record.

Im not sure if wildcard *. like that will work, do you have it out of documentation?

Try things like nslookup or dig and resolve for A record you have defined to see first if it really works, or try zone transfer.

dig @nameserver zone. axfr

----------

## giulianoz

not a real answer but have you tried mydns ? for me it's easier to configure/mantain (sql based, there's a web gui called mydnsadmin too)  :Smile: 

giuliano

----------

## anjames

Ahh, the logs! I should have known better. So there's at least one error in the config:

```
tail /var/log/syslog:

Sep 29 16:27:14 Helios2 named[10280]: starting BIND 9.3.2-P1 -u named -n 1

Sep 29 16:27:14 Helios2 named[10280]: loading configuration from '/etc/bind/named.conf'

Sep 29 16:27:14 Helios2 named[10280]: listening on IPv4 interface lo, 127.0.0.1#53

Sep 29 16:27:14 Helios2 named[10280]: command channel listening on 127.0.0.1#953

Sep 29 16:27:14 Helios2 named[10280]: command channel listening on ::1#953

Sep 29 16:27:14 Helios2 named[10280]: zone 127.in-addr.arpa/IN: loaded serial 2002081601

Sep 29 16:27:14 Helios2 named[10280]: zone localhost/IN: loaded serial 2002081601

Sep 29 16:27:14 Helios2 named[10280]: pri/wifiNet.zone:1: wifiNet*.wifiNet: bad owner name (check-names)

Sep 29 16:27:14 Helios2 named[10280]: zone wifiNet/IN: loading master file pri/wifiNet.zone: bad owner name (check-names)

Sep 29 16:27:14 Helios2 named[10280]: running
```

I guess the naming was wrong. The localhost zones have the following in them:

```
Helios2 pri # cat /var/bind/pri/localhost.zone

$TTL 1W

@       IN      SOA     ns.localhost. root.localhost.  (

                                      2002081601 ; Serial

                                      28800      ; Refresh

                                      14400      ; Retry

                                      604800     ; Expire - 1 week

                                      86400 )    ; Minimum

                IN      NS      127.0.0.1

localhost.      IN      A       127.0.0.1
```

so if I copy this file, rename it to wifiNet.zone, and change localhost everywhere to wifiNet what happens? Well at least there are no errors when I restart named:

```
Sep 29 17:28:10 Helios2 named[13588]: shutting down

Sep 29 17:28:10 Helios2 named[13588]: stopping command channel on 127.0.0.1#953

Sep 29 17:28:10 Helios2 named[13588]: stopping command channel on ::1#953

Sep 29 17:28:10 Helios2 named[13588]: no longer listening on 127.0.0.1#53

Sep 29 17:28:10 Helios2 named[13588]: exiting

Sep 29 17:28:10 Helios2 named[13882]: starting BIND 9.3.2-P1 -u named -n 1

Sep 29 17:28:10 Helios2 named[13882]: loading configuration from '/etc/bind/named.conf'

Sep 29 17:28:10 Helios2 named[13882]: listening on IPv4 interface lo, 127.0.0.1#53

Sep 29 17:28:10 Helios2 named[13882]: command channel listening on 127.0.0.1#953

Sep 29 17:28:10 Helios2 named[13882]: command channel listening on ::1#953

Sep 29 17:28:10 Helios2 named[13882]: zone 127.in-addr.arpa/IN: loaded serial 2002081601

Sep 29 17:28:10 Helios2 named[13882]: zone localhost/IN: loaded serial 2002081601

Sep 29 17:28:10 Helios2 named[13882]: zone wifiNet/IN: loaded serial 2002081601

Sep 29 17:28:10 Helios2 named[13882]: running
```

What happens is it still doesn't work:

```
17:32:50.374259 IP (tos 0x0, ttl  64, id 57280, offset 0, flags [none], proto: UDP (17), length: 53) 192.168.0.11.52014 > 192.168.0.1.domain: [udp sum ok]  29136+ A? wifinet. (25)

17:32:50.374309 IP (tos 0xc0, ttl  64, id 31444, offset 0, flags [none], proto: ICMP (1), length: 81) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 61

        IP (tos 0x0, ttl  64, id 57280, offset 0, flags [none], proto: UDP (17), length: 53) 192.168.0.11.52014 > 192.168.0.1.domain: [udp sum ok]  29136+ A? wifinet. (25)

17:32:55.374174 IP (tos 0x0, ttl  64, id 57281, offset 0, flags [none], proto: UDP (17), length: 53) 192.168.0.11.52014 > 192.168.0.1.domain: [udp sum ok]  29136+ A? wifinet. (25)

17:32:55.374209 IP (tos 0xc0, ttl  64, id 31445, offset 0, flags [none], proto: ICMP (1), length: 81) 192.168.0.1 > 192.168.0.11: ICMP 192.168.0.1 udp port domain unreachable, length 61

        IP (tos 0x0, ttl  64, id 57281, offset 0, flags [none], proto: UDP (17), length: 53) 192.168.0.11.52014 > 192.168.0.1.domain: [udp sum ok]  29136+ A? wifinet. (25)
```

When I do a local dig for wifinet I get what looks like a valid reply:

```
Helios2 log # dig wifinet

; <<>> DiG 9.3.2 <<>> wifinet

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31427

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:

;wifinet.                       IN      A

;; ANSWER SECTION:

wifinet.                604800  IN      A       192.168.0.1

;; AUTHORITY SECTION:

wifinet.                604800  IN      NS      192.168.0.1.wifinet.

;; Query time: 370 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Fri Sep 29 17:42:38 2006

;; MSG SIZE  rcvd: 67
```

resolv.conf says that 127.0.0.1 is my current DNS server (after bringing down the interface I'm using to write this post anyway!). I can ping wifinet from this machine too, and when I put wifinet into the address bar of my favorite browser, the expected webpage comes up. 

But at least two things are broken still: 

When I put in something else (eg www.google.com) it says 'host cannot be contacted' instead of redirecting me to wifinet, so my wildcard is broken I guess.

Probably there's something that keeps the idea of 127.0.0.1 and localhost, well... "local". I guess I copied this behaviour when I copied the localhost.zone. So I need to change that so wifinet is not only local, but can be looked up by remote DNS query also.

If you know how to fix either of these, please let me know!

----------

## anjames

WOOHOO! I fixed one problem. Apparently one must have the master interface's IP in the listen-on section of named.conf

```
listen-on { 127.0.0.1; 192.168.0.1; };
```

So now I can do lookups on the remote host, but when I type ping wifinet, it responds with unknown host. 

ARGH!!! So close, yet so far. Oh the despair! But there is still hope...

----------

