Pihole -c : connection refused

The issue I am facing:

root@pihole:~# sudo cat /var/run/pihole-FTL.port
4711
root@pihole:~# sudo pihole -c
/opt/pihole/chronometer.sh: connect: Connection refused
/opt/pihole/chronometer.sh: line 19: /dev/tcp/127.0.0.1/4711: Connection refused
/opt/pihole/chronometer.sh: connect: Connection refused
/opt/pihole/chronometer.sh: line 19: /dev/tcp/127.0.0.1/4711: Connection refused
/opt/pihole/chronometer.sh: connect: Connection refused
/opt/pihole/chronometer.sh: line 19: /dev/tcp/127.0.0.1/4711: Connection refused

Details about my system:

Aruba VPS, pihole listening only on tun0, serving dns query only via Openvpn.

What I have changed since installing Pi-hole:

I don't remember. But I'am using OpenVPN

If it's not listening on localhost then there's no way to connect to it.

2 Likes
pi@ph5:~ $ ip -br address show lo
lo               UNKNOWN        127.0.0.1/8 ::1/128

pi@ph5:~ $ sudo netstat -nltup | grep 'Proto\|pihole'
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      1910/pihole-FTL
tcp        0      0 127.0.0.1:4711          0.0.0.0:*               LISTEN      1910/pihole-FTL
tcp6       0      0 :::53                   :::*                    LISTEN      1910/pihole-FTL
tcp6       0      0 ::1:4711                :::*                    LISTEN      1910/pihole-FTL
udp        0      0 0.0.0.0:53              0.0.0.0:*                           1910/pihole-FTL
udp6       0      0 :::53                   :::*                                1910/pihole-FTL

pi@ph5:~ $ nc localhost 4711 <<< $'>stats >quit'
domains_being_blocked 286469
dns_queries_today 6658
ads_blocked_today 601
ads_percentage_today 9.026734
[..]
1 Like

Please, translate for me...

I understand from developer's reply that i cannot use the pihole -c command in my configuration.

But your reply told me I can still extract infos.... but I am not understanding ... does it mean that is there another way to use pihole -c in my config ?

There is this binary/daemon named pihole-FTL thats listening on port 4711 TCP for API calls (see netstat output).
But its only listening on the localhost IP 127.0.0.1 that resides on the loopback interface named "lo".
API calls can be made on this socket (IP+port) to query this pihole-FTL daemon (see your posting asking about API docs).
The pihole -c command does something similar.

For you to check if you have a lo interface with IP 127.0.0.1 (ip command);
if pihole-FTL is listening on this 127.0.0.1 IP and port 4711 (netstat command);
and if you can query it (nc command).

Ps. the binding between the name localhost and the 127.0.0.1 IP address is configured in below file:

pi@ph5:~ $ cat /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
[..]

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.