I think i have a stupid question but i couldn’t find answer to it so far :( When i want to reach a service that i host on my own server at home from the local network at home, is using a public domain effective way to do it or should i always use server’s IP when configuring something inside LAN? Is my traffic routed through the internet somehow when using domain even in LAN or does my router know to not do this?

  • TCB13@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    7 months ago

    is using a public domain effective way to do it or should i always use server’s IP when configuring something inside LAN? Is my traffic routed through the internet somehow when using domain even in LAN or does my router know to not do this?

    It depends.

    If you control your router (not ISP provided) you can just go into the router settings and tell it to always resolve your public domain to the local machine IP. This will make it so any computer on the network running a DNS query will get a local IP for that domain instead of the public one. Quick and easy fix.

    If you don’t control it / don’t apply the fix above, most likely your traffic is not routed through the internet because routers are usually configured for hairpinning / NAT loopback and they’ll simply forward the traffic internally.

    You can test what’s going on by using the traceroute (or tracert on Windows) to find where the traffic is going. It will give you a line for each host your traffic has to go through in order to reach the destination. If you need help reading the output, just post it public IPs redacted.