I was reminded by Yesterday's post on DNS (Domain Name Service) [1] that I was playing around with SRV (Service) records, and oh yes, here's a few I set up some time ago:
>
```
_http._tcp IN SRV 1 1 8888 lucy
IN SRV 2 10 8888 marvin
IN SRV 2 20 8888 bunny-desktop
IN SRV 2 30 8888 saltmine
```
So, let's see what I get when I query _http._tcp.roswell.area51. (the “home domain” I use around here):
>
```
rcode = 0.000000,
ra = true,
aa = true,
query = false,
ad = false,
rd = true,
cd = false,
tc = false,
id = 1234.000000,
question =
{
class = "IN",
name = "_http._tcp.roswell.area51.",
type = "SRV",
},
```
Okay, so far, this is expected—some DNS flags, and the “question” we asked. Continuing …
>
```
answers =
{
[1] =
{
port = 8888.000000,
type = "SRV",
name = "_http._tcp.roswell.area51.",
weight = 30.000000,
target = "saltmine.roswell.area51.",
class = "IN",
ttl = 86400.000000,
priority = 2.000000,
},
[2] =
{
port = 8888.000000,
type = "SRV",
name = "_http._tcp.roswell.area51.",
weight = 1.000000,
target = "lucy.roswell.area51.",
class = "IN",
ttl = 86400.000000,
priority = 1.000000,
},
[3] =
{
port = 8888.000000,
type = "SRV",
name = "_http._tcp.roswell.area51.",
weight = 10.000000,
target = "marvin.roswell.area51.",
class = "IN",
ttl = 86400.000000,
priority = 2.000000,
},
[4] =
{
port = 8888.000000,
type = "SRV",
name = "_http._tcp.roswell.area51.",
weight = 20.000000,
target = "bunny-desktop.roswell.area51.",
class = "IN",
ttl = 86400.000000,
priority = 2.000000,
},
},
```
Okay, these are the answers we were looking for, but wait? What's this?
>
```
additional =
{
[1] =
{
type = "A",
name = "lucy.roswell.area51.",
address = "192.168.1.10",
class = "IN",
ttl = 86400.000000,
},
[2] =
{
type = "AAAA",
name = "lucy.roswell.area51.",
address = "fc00::1",
class = "IN",
ttl = 86400.000000,
},
[3] =
{
type = "A",
name = "marvin.roswell.area51.",
address = "192.168.1.13",
class = "IN",
ttl = 86400.000000,
},
[4] =
{
type = "AAAA",
name = "marvin.roswell.area51.",
address = "fc00::3",
class = "IN",
ttl = 86400.000000,
},
[5] =
{
type = "A",
name = "bunny-desktop.roswell.area51.",
address = "192.168.1.16",
class = "IN",
ttl = 86400.000000,
},
[6] =
{
type = "AAAA",
name = "bunny-desktop.roswell.area51.",
address = "fc00::2",
class = "IN",
ttl = 86400.000000,
},
[7] =
{
type = "A",
name = "saltmine.roswell.area51.",
address = "192.168.1.18",
class = "IN",
ttl = 86400.000000,
},
[8] =
{
type = "AAAA",
name = "saltmine.roswell.area51.",
address = "fc00::4",
class = "IN",
ttl = 86400.000000,
},
},
```
Yes, even though I run that braindead DNS implementation that only accepts single questions [2], it also preemptively sent back the appropriate IP (Internet Protocol) addresses!
Will wonders never cease. There's probably no need for multiple DNS queries to handle SRV lookups.