Help with connection issue on local machine

What is the problem?

Unable to connect using CURL to port 5000 on anything besides "localhost" or "127.0.0.1", "connection REFUSED"

What did you already try to solve it?

Google, HAProxy searches.. :slight_smile: The answer is out there, but too complicated for me.

Have you tried running in safe mode?

No.

Did running in safe mode solve the problem?

Systeminfo Bundle

octoprint-systeminfo-20250712130352.zip (66.3 KB)

Attached

Additional information about your setup

Everything is working fine. That is, I can connect and print from an external host as normal.

SSH to the pi, and I am unable to connect to port 5000 using anything other than "localhost" or "127.0.01" and I am trying to understand what is blocking it.

What the heck?! Is my host file messed up?
I would expect ALL of these to work?
Just trying to understand where this is happening (and resolve it).

See example:
"Connection refused"

pi@printer2:~ $ nc -v printer2.local 5000
nc: connect to printer2.local (192.168.254.77) port 5000 (tcp) failed: Connection refused
pi@printer2:~ $ nc -v printer2 5000
nc: connect to printer2 (127.0.1.1) port 5000 (tcp) failed: Connection refused
pi@printer2:~ $ nc -v 192.168.254.77 5000
nc: connect to 192.168.254.77 port 5000 (tcp) failed: Connection refused
pi@printer2:~ $ nc -v 127.0.01 5000
Connection to 127.0.01 (127.0.0.1) 5000 port [tcp/*] succeeded!


HTTP/1.1 400 Bad Request


pi@printer2:~ $ nc -v localhost 5000
nc: connect to localhost (::1) port 5000 (tcp) failed: Connection refused
Connection to localhost (127.0.0.1) 5000 port [tcp/*] succeeded!


HTTP/1.1 400 Bad Request


pi@printer2:~ $

Some ping tests:

pi@printer2:~ $
pi@printer2:~ $ ping printer2.local
PING printer2.local (192.168.254.77) 56(84) bytes of data.
64 bytes from 192.168.254.77 (192.168.254.77): icmp_seq=1 ttl=64 time=0.089 ms
64 bytes from 192.168.254.77 (192.168.254.77): icmp_seq=2 ttl=64 time=0.103 ms
^C
--- printer2.local ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.089/0.096/0.103/0.007 ms
pi@printer2:~ $ ping printer2
PING printer2 (127.0.1.1) 56(84) bytes of data.
64 bytes from printer2 (127.0.1.1): icmp_seq=1 ttl=64 time=0.115 ms
64 bytes from printer2 (127.0.1.1): icmp_seq=2 ttl=64 time=0.110 ms
^C
--- printer2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1010ms
rtt min/avg/max/mdev = 0.110/0.112/0.115/0.002 ms
pi@printer2:~ $ ping localhost
PING localhost(localhost (::1)) 56 data bytes
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.130 ms
64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.116 ms
^C
--- localhost ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1006ms
rtt min/avg/max/mdev = 0.116/0.123/0.130/0.007 ms
pi@printer2:~ $

My host file:

pi@printer2:~ $ cat /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       printer2
pi@printer2:~ $

And my hostname:

pi@printer2:~ $ cat /etc/hostname
printer2
pi@printer2:~ $