Hello!
I am playing with a few IoT devices and everything works except one little thing. I have the following setup:
- jetson nano 2g (hostname: jetsonnano2g) with IP 10.7.1.67
- raspberry pi 1 (hostname: rpi4b8g1) with IP 10.7.1.61
- raspberry pi 2 (hostname: rpi4b8g2) with IP 10.7.1.62
Pihole is installed on the jetson nano and works great except when I try to ping/nslookup/dig the hostname.
My router has only one DNS server and it is the pihole IP.
All my IoT devices have entries for each other in /etc/hosts.
If I get the /etc/hosts from the pihole docker using this command
docker exec pihole cat /etc/hosts
I see all my entries
10.7.1.61 rpi4b8g1
10.7.1.62 rpi4b8g2
10.7.1.67 jetsonnano2g
From my local computer, I can ping, nslookup both raspberry pi using their hostname but not the hostname where pihole is running.
[8:59:10 - gillouche@arch:~]$ ping -c 1 rpi4b8g1
PING rpi4b8g1 (10.7.1.61) 56(84) bytes of data.
64 bytes from rpi4b8g1 (10.7.1.61): icmp_seq=1 ttl=64 time=0.155 ms
[8:59:15 - gillouche@arch:~]$ ping -c 1 rpi4b8g2
PING rpi4b8g2 (10.7.1.62) 56(84) bytes of data.
64 bytes from rpi4b8g2 (10.7.1.62): icmp_seq=1 ttl=64 time=0.155 ms
[8:59:18 - gillouche@arch:~]$ ping -c 1 jetsonnano2g
ping: jetsonnano2g: Name or service not known
[8:59:27 - gillouche@arch:~]$ ping -c 1 pi.hole
PING pi.hole (10.7.1.67) 56(84) bytes of data.
64 bytes from pi.hole (10.7.1.67): icmp_seq=1 ttl=64 time=2.82 ms
[9:00:51 - gillouche@arch:~]$ nslookup rpi4b8g2
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: rpi4b8g2
Address: 10.7.1.62
** server can't find rpi4b8g2: SERVFAIL
[9:00:56 - gillouche@arch:~]$ nslookup jetsonnano2g
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find jetsonnano2g: NXDOMAIN
If I do dig by targeting the pihole server, I get the correct result.
[9:01:11 - gillouche@arch:~]$ dig jetsonnano2g @10.7.1.67
; <<>> DiG 9.18.2 <<>> jetsonnano2g @10.7.1.67
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48176
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;jetsonnano2g. IN A
;; ANSWER SECTION:
jetsonnano2g. 0 IN A 10.7.1.67
;; Query time: 3 msec
;; SERVER: 10.7.1.67#53(10.7.1.67) (UDP)
;; WHEN: Fri May 06 09:02:09 CEST 2022
;; MSG SIZE rcvd: 57
[9:02:09 - gillouche@arch:~]$ dig jetsonnano2g
; <<>> DiG 9.18.2 <<>> jetsonnano2g
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 10893
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;jetsonnano2g. IN A
;; Query time: 3713 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Fri May 06 09:06:00 CEST 2022
;; MSG SIZE rcvd: 41
Here is the ansible tasks that I used
- name: Set FTLCONF_REPLY_ADDR (single mode)
set_fact:
ftlconf_reply_addr4: "{{ ansible_host }}"
execution_mode: "single node setup"
- name: Start/Update pihole container
docker_container:
name: "{{ pihole_container_name }}"
image: "{{ pihole_image }}"
pull: yes
restart_policy: unless-stopped
env:
TZ: "{{ timezone }}"
FTLCONF_REPLY_ADDR4: "{{ ftlconf_reply_addr4 }}"
WEBPASSWORD: "{{ pihole_webpassword }}"
PIHOLE_DNS_: "{{ pihole_dns }}"
DNSMASQ_LISTENING: "local"
dns_servers:
- 127.0.0.1
- "{{ static_dns }}"
network_mode: host
volumes:
- "/home/{{ ansible_user }}/pihole/pihole/:/etc/pihole/"
- "/home/{{ ansible_user }}/pihole/dnsmasq.d/:/etc/dnsmasq.d/"
log_driver: json-file
log_options:
max-size: "10m"
max-file: "5"
Would you have any idea on how to fix this? Configuration problem on my side?
Thanks a lot.
Expected Behaviour:
The hostname where pihole is running should be reachable with ping/nslookup/dig and not only pi.hole.
Actual Behaviour:
The hostname where pihole is running is not reachable.