You are not logged in.

#1 2023-05-11 16:45:18

skiboy209
Member
Registered: 2023-05-11
Posts: 2

entries added to /etc/hosts are not resolving properly

Hello I have edited the /etc/hosts as below

```
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1    localhost
::1    localhost
127.0.1.1 archlinux.host.local

127.0.0.1    foo.private
```

I am able to ping so it is somewhat working. However I am unable to access foo.private in any browser including chrome, firefox, and lynx

Ping output
```
PING foo.private (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.012 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.037 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.024 ms
^C
--- foo.private ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2086ms
rtt min/avg/max/mdev = 0.012/0.024/0.037/0.010 ms
```

I am unsure of what to try now to resolve the issue. I am using KDE plasma with NetworkManager. I do not have netctl dhcpcd or installed. No firewall is currently active.

When running a sveltekit app on **EDIT** port 5173 not 5174 **END EDIT** and trying to access from chrome here is the error
This site can’t be reachedfoo.private refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

Last edited by skiboy209 (2023-05-11 17:59:12)

Offline

#2 2023-05-11 17:44:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,471
Website

Re: entries added to /etc/hosts are not resolving properly

How about with curl?  And what exact uri are you putting into your browsers?  Are you including the port number (e.g., "foo.private:5174")?  Can you access your server from those browsers by using the IP address?

Nevermind all that - it is the lack of port number that is the problem.  You are getting ERR_CONNECTION_REFUSED which means the browser did successfully resolve the name to an IP, but that IP address refused the connection (almost certainly because it was on an http/https port rather than 5174).

Last edited by Trilby (2023-05-11 17:47:23)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-05-11 17:51:40

skiboy209
Member
Registered: 2023-05-11
Posts: 2

Re: entries added to /etc/hosts are not resolving properly

The exact uri is
```
http://private.foo:5173
```

Here is the output of curl http://private.foo:5173
```
curl: (7) Failed to connect to private.foo port 5173 after 0 ms: Couldn't connect to server
```

Here is the output of curl http://localhost:5173. There is a server error in the svelte app right now so that error is expected.
```
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Internal Error</title>
  </head>
  <body>
    <h1>Sorry we encountered an error</h1>
    <p>Status: 500</p>
    <p>Message: Internal Error</p>
  </body>
</html>%
```

Here is the output of curl 127.0.0.1:5173
```
curl: (7) Failed to connect to 127.0.0.1 port 5173 after 0 ms: Couldn't connect to server
```

Last edited by skiboy209 (2023-05-11 18:09:06)

Offline

#4 2023-05-11 19:50:32

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,337

Re: entries added to /etc/hosts are not resolving properly

The bbs predates markdown, please use [code][/code] tags. Edit your post in this regard.
The fix the subject, the problem isn't related to the resolver, the service isn't responding - you'll get the same error for "curl localhost:123"

This is probably down to the configuration of the service, but still

nmap -p5173 localhost
nmap -p5173 127.0.0.1
nmap -p5173 private.foo

For a cross test

nc -l -p 1234

and in a 2nd terminal

echo foo | nc private.foo 1234 # you'll have to
echo foo | nc 127.0.0.1 1234 # ctrl+c and
echo foo | nc localhost 1234 # restart the listening process everytime

Offline

Board footer

Powered by FluxBB