Localise queries

Hi,

  I have unbound setup in my openwrt router, defining
it with the minimal config to define dns related stuff in unbound.conf,
that is, in /etc/config/unbound I just define the following lines:

config unbound 'ub_main'
        option manual_conf '1'

  In unbound.conf I define a local domain like:

        local-zone: router.mydomain.com. static
        domain-insecure: router.mydomain.com
        private-domain: router.mydomain.com

  And some local data to point to the router:

local-data: "router.mydomain.com. IN A 192.168.1.1 192.168.2.1 192.168.3.1
fd01:5f3b:820e::1"
local-data: "gw.router.mydomain.com A 192.168.1.1 192.168.2.1 192.168.3.1
fd01:5f3b:820e::1"

  When I connect to the wifi(192.168.2.0/24), and I ping
gw.router.mydomain.com, the answer is showing 192.168.1.1, instead of
192.168.2.1. Somehow, I fail to find the option to produce this behaviour,
can anybody help?

  Thanks!

  José Pekkarinen.

local-data: "router.mydomain.com. IN A 192.168.1.1 192.168.2.1 192.168.3.1
fd01:5f3b:820e::1"
local-data: "gw.router.mydomain.com A 192.168.1.1 192.168.2.1 192.168.3.1
fd01:5f3b:820e::1"

this looks like invalid to me, (but may be wrong)
I would write this as:

local-data: "router.mydomain.com. IN A 192.168.1.1"
local-data: "router.mydomain.com. IN A 192.168.2.1"
local-data: "router.mydomain.com. IN A 192.168.3.1"
local-data: "router.mydomain.com. IN AAAA fd01:5f3b:820e::1"
local-data: "gw.router.mydomain.com. IN A 192.168.1.1"
local-data: "gw.router.mydomain.com. IN A 192.168.2.1"
local-data: "gw.router.mydomain.com. IN A 192.168.3.1"
local-data: "gw.router.mydomain.com. IN AAAA fd01:5f3b:820e::1"

Using the dig (or nslookup) command you can check if the expected answers are given.

  When I connect to the wifi(192.168.2.0/24), and I ping
gw.router.mydomain.com, the answer is showing 192.168.1.1, instead of
192.168.2.1.

"ping gw.router.mydomain.com" instruct your OS to

1. resolve the name to a list of IPv4 and IPv6 addresses
2. chose one of them and send ICMP echo requests

Your OS choosed 192.168.1.1 ...

Andreas

local-data: “router.mydomain.com. IN A 192.168.1.1 192.168.2.1 192.168.3.1
fd01:5f3b:820e::1”
local-data: “gw.router.mydomain.com A 192.168.1.1 192.168.2.1 192.168.3.1
fd01:5f3b:820e::1”

this looks like invalid to me, (but may be wrong)
I would write this as:

local-data: “router.mydomain.com. IN A 192.168.1.1”
local-data: “router.mydomain.com. IN A 192.168.2.1”
local-data: “router.mydomain.com. IN A 192.168.3.1”
local-data: “router.mydomain.com. IN AAAA fd01:5f3b:820e::1”
local-data: “gw.router.mydomain.com. IN A 192.168.1.1”
local-data: “gw.router.mydomain.com. IN A 192.168.2.1”
local-data: “gw.router.mydomain.com. IN A 192.168.3.1”
local-data: “gw.router.mydomain.com. IN AAAA fd01:5f3b:820e::1”

Hi,

Thanks for the answer, you are totally right with this,

I just missed that ipv6 entries are AAAA instead of A, so whenI tested this approach unbound didn’t start at all. After doing
this config change it starts nicely and returns the right ip over
ping and dig:

ping gw.router.mydomain.com

PING gw.router.mydomain.com (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1 (192.168.2.1): icmp_seq=1 ttl=64 time=1.98 ms
64 bytes from 192.168.2.1 (192.168.2.1): icmp_seq=2 ttl=64 time=4.44 ms