Schroedinger's DNS?? Can't resolve host when adding http.. help!

This makes no freakin sense to me, and it's driving me bonkers. Censored for work purposes obv.

Hosts file:

1.1.1.1 site.com

$ping site.com

PING site.com (1.1.1.1)

^C

$ping http://site.com

ping: unknown host http://site.com

What?? Ping, You JUST RESOLVED site.com, why can't you resolve it now??

Why does the addition of the protocol break DNS resolution?

It's CentOS 6.10, quite old..

/etc/nsswitch has:

hosts: files dns

Any pointers would be much appreciated.

-12 points · 5 comments · view on lemmy.world

5 Comments

createkarma@discuss.tchncs.de · 46 pts · 2y (1 reply)

http://site.com isn't a valid host name, DNS won't resolve it. DNS does not understand protocol, it's taking your whole query as the hostname

luthis@lemmy.nz · 14 pts · 2y

Ah thanks, that's my problem, it's me.

linearchaos@lemmy.world · 13 pts · 2y

ping site.com

Not http://site.com

scratchandgame@lemmy.ml · -3 pts · 2y

You should deal with problem yourself rather than asking like this. Or forget ping.

fucking anyone disliking, that guy doesn't even have knowledge what a hostname and a protocol is. They should learn it themselves. Don't need to ask.

Rustmilian@lemmy.world · -11 pts · 2y (3 replies)
[ removed ]
Rustmilian@lemmy.world · 4 pts · 2y (2 replies)
[ removed ]
holgersson@lemm.ee · 2 pts · 2y (1 reply)

It might just be local network traffic or a dev env. Not to mention that https is just unnecessary overhead for some usecases, especially when only GETting data.

Rustmilian@lemmy.world · 5 pts · 2y
[ removed ]