Hi everyone! Can someone please walk me through changing dns on Fedora 38. I have pihole setup on my home server, but Fedora won’t use for the life of me. (It does work on my phone). Explain it like I’m 5, cos I’m losing my mind haha

  • tal@lemmy.today
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago

    How are you testing that it works?

    Firefox and maybe some other browsers default to DNS-over-HTTP. Unless Fedora has disabled that, you won’t see requests from them on a DNS server. Use the ping command or something instead. If you see those queries, but none from the browser, that’s probably the problem.

    If you want Firefox to issue queries to your DNS server, you’re probably gonna have to disable DNS-over-HTTP in the browser.

    I don’t know what the default config for Fedora is, but it’s perfectly acceptable for a system to use a local caching DNS server, and they might set one up by default. If so, trying to resolve a name will only resolve it once until the TTL on the response expires. Try to resolve a new name each time.

    I don’t know what the Fedora-specific config looks like, or whether systemd has changed anything, but the three files that you historically need to care about on a Linux system for name configuration are /etc/resolv.conf (which normally lists the IP address of the nameserver), /etc/hosts, which lets you manually have host-IP mappings, and /etc/nsswitch.conf (which normally you don’t need to fiddle with, but determines how non-DNS methods are used to resolve names). If your DNS server’s IP address is listed in resolv.conf, you’re probably good. If your system automatically regenerates those, it’s convention to have a comment at the top of the file indicating what regenerated it, so you know where to look.

    Lastly, there’s a command called dig. If you run dig +trace hostname.to.look.up, it’ll show you the series of queries that are being issued to different nameservers. It’s probably the single best tool to get visibility into DNS. It can’t show you everything. It won’t deal with nsswitch.conf stuff, where a name resolution attempt might be resolved before it gets to DNS. It doesn’t replicate the web browser’s name resolution process, so DNS-over-HTTP won’t show up, and it doesn’t expose Firefox’s internal DNS cache (which, yes, it has and will cause it to not actually attempt to resolve the same name repeatedly normally). But it’s the first thing I’d look at if I wanted to try to understand what was happening during DNS resolution if I were seeing unexpected behavior. You get to see what queries are going to what DNS servers and what the response is, and it cuts caches out of the picture. If you get things working with dig, then I’d go and check other software like Firefox.

  • MiddledAgedGuy@beehaw.org
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    It could also be browser specific. I’m not sure how you determined it’s not using the pihole dns server. For example, Firefox has the option to resolve dns over https.

    • Footnote2669@lemmy.zipOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Im the Pihole GUI I see which IPs are making requests. It picks up my phone but no requests from the pc

  • KᑌᔕᕼIᗩ@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Assuming you get your IP address from a DHCP server such as your router, you should change what DNS server is set there and then restart any devices you are trying to use with the PiHole.

    You can just restart the network service on your Fedora PC or reboot it.

  • oranki@sopuli.xyz
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    1 year ago
    • Open the GUI network settings
    • Set DNS to the IP of the PiHole, make sure the “automatic” switch is off.
    • Do the above for each active interface (ethernet, wlan) and for both IPv4 and IPv6
    • Save/apply settings
    • Turn the interface(s) off, then back on
    • resolvectl flush-caches just in case

    Look at resolvectl dns to check there’s no DHCP-acquired DNS servers set anymore

    If you use a VPN, those often set their own DNS servers too, remember to check it as well.

    • Footnote2669@lemmy.zipOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Thanks, I did that and so far so good. I did most of this before but it was reverting back to some other dns address and not working -_- now it works, so far

      • Molecular0079@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        If its reverting, you may have a fallback DNS configured somewhere, or your browser is using DNS over HTTPS, which sometimes will bypass whatever DNS server you’ve configured.

  • HumanPerson@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    1 year ago

    You should be able to change the nameserver value in /etc/resolv.conf. You may need a restart for it to take effect but that should work.

    • Molecular0079@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Probably not best to do this because chances are he’s using NetworkManager which will override /etc/resolv.conf. Better to set it on the connection profile itself.