this post was submitted on 17 Sep 2023
732 points (97.7% liked)

Programmer Humor

32497 readers
495 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] PR_freak@programming.dev 16 points 1 year ago (3 children)

Noob question. Would that request travel over the internet or is it resolved locally?

[–] AnActOfCreation@programming.dev 14 points 1 year ago

If the router supports hairpinning, the IP request can be resolved locally.

The domain name lookup would be a different issue and could potentially need to be resolved externally, but the router's DNS cache should be able to answer eventually.

[–] Illecors@lemmy.cafe 12 points 1 year ago (1 children)

Depends. If the zone responsible for whatever resolves to that IP is hosted locally - then DNS request would stay local.

If the service behind that IP is running locally - then all traffic would stay local. Network stack would be smart enough to not run circles to find itself.

[–] Natanael@slrpnk.net 2 points 1 year ago (2 children)

Yeah, the router ought to know that public IP belongs to a device in its own network unless you're doing stuff like running your own router behind an ISP provided router and just forwarding ports instead of maintaining IP assignment / routing tables

[–] MDKAOD@lemmy.ml 1 points 1 year ago

Tell that to my opnsense box that refuses to NAT mirror.

[–] dot20@lemmy.world 1 points 1 year ago

I think OP is referring to NAT hairpinning though.

[–] ArtVandelay@lemmy.world -3 points 1 year ago (1 children)

That's a WAN IP, so it would be resolved by external DNS then routed back

[–] PR_freak@programming.dev 12 points 1 year ago (2 children)

Why are you mentioning dns? This is an ip request, no need to contact a dns server

[–] AnActOfCreation@programming.dev 3 points 1 year ago (1 children)

Because the title mentions having a domain, I guess.

[–] ArtVandelay@lemmy.world 4 points 1 year ago

Yes, that was the train of thought I was on.

[–] DmMacniel@feddit.de 2 points 1 year ago

Yeah no need for DNS but an ARP lookup would be in order.