I just setup Unbound DNS on my home server (read: old laptop screaming for dear life next to my router). Everything is working well, I can access it and use it as my DNS server on my desktop which is connected to the same network as my server.

The issue is with trying to get my phone to use Unbound while connected to the same laptop through Wireguard. If I’m connected to the Wi-Fi and disconnected from Wireguard, I can nslookup on my phone using the Unbound server, but as soon as I’m connected through Wireguard it can’t access the DNS server.

I suspect it has something to do with the fact that I run Wireguard through Docker but Unbound is setup directly on the host machine, and the container isolation is what’s causing my issues. However, I tried adding

extra_hosts:
    - "host.docker.internal:host-gateway"

to my docker-compose.yml for Wireguard, and tried accessing the DNS using the host IP inside the docker interface, but it didn’t work.

Does anyone have any leads or tips on how to properly configure this? Thanks in advance!

  • just_another_person@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    1 day ago

    I’m…totally lost here. You’re trying to use two different VPNs on your local network? If you want your Unbound device to be a VPN exit node for your network, why wouldn’t you just setup routes to make it your default gateway?

    Using two different VPM tunnels like this is going to just cause routing issues all over the place if you’re already unfamiliar with how to setup the routing to begin with.

    Maybe explain what your intended use is here to help us understand what you’re trying to accomplish.

    • Evkob (they/them)@lemmy.caOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      1 day ago

      I think you misunderstood part of my post, because there’s only one VPN tunnel, from the WG client on my phone to the WG server on my laptop.

      I want my phone to use the Unbound DNS server, which is hosted locally on the same laptop that runs my Wireguard server.

      EDIT: Note, I don’t want to setup the DNS router-side via DCHP because I want to use Unbound to block a bunch of stuff that my roommates use, like Facebook.

      • just_another_person@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        1 day ago

        Ah, okay. If this is Android, just setup your Unbound host IP under ‘Private DNS’ on your phone then.

        Note: this will cause issues once you leave your home network unless your WH tunnel is available from outside. Set the secondary DNS to Mullvad or another secure DNS provider if that’s the case and you shouldn’t have issues once leaving the house.

        Depending on your router, you can also just set a static DHCP reservation for your phone only that sets these DNS servers for you without affecting all other DHCP devices.

        • Evkob (they/them)@lemmy.caOP
          link
          fedilink
          English
          arrow-up
          0
          ·
          edit-2
          24 hours ago

          Android doesn’t let me add an IP address under private DNS, it needs to be a domain (like dns.quad9.net rather than 9.9.9.9).

          I tried adding a quick DuckDNS domain to my reverse proxy towards port 53, where Unbound is listening. It works, as in I can nslookup using the DuckDNS domain on my desktop (or on my phone when not connected to Wireguard) but if I try to set that domain as my private DNS on Android it says it can’t connect, whether or not I’m on my VPN.

          • just_another_person@lemmy.world
            link
            fedilink
            English
            arrow-up
            0
            ·
            24 hours ago

            Okay, let me just clarify some stuff here because your language has been confusing.

            You’re using a “VPN”, but on a local network. When you say “VPN”, people assume mean you’re using a client to a remote location. That’s super confusing.

            For what you’re trying to do you don’t even need WG unless you mean to use your DNS server from elsewhere.

            Please clarify these two things, but I think you’re just complicating a simple setup for an ad blocking DNS server somehow, right?

            • Evkob (they/them)@lemmy.caOP
              link
              fedilink
              English
              arrow-up
              0
              ·
              23 hours ago

              The reason for the VPN is to have access to my Unbound DNS on my phone from anywhere, not only my local network. If I just wanted to configure the DNS on my local network, I’d set up static IP for my network in Android’s settings and input the DNS server manually. This works fine when I set it up, but like I said I want to use Unbound on my phone anywhere via Wireguard.

              I’m not sure what’s the second thing you want me to clarify! Sorry for the confusion, I appreciate you trying to help out :)

                • Evkob (they/them)@lemmy.caOP
                  link
                  fedilink
                  English
                  arrow-up
                  0
                  ·
                  22 hours ago

                  I could do that, but I want to avoid opening ports on my router’s firewall apart from the one necessary for Wireguard. I can access all my other stuff through Wireguard, but I can’t wrap my head around why it seemingly can’t access Unbound on the local host.

  • NameTaken@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 day ago

    When connected through wireguard can you access anything on the local network?

    Also sometimes if you’re on an LAN trying to vpn into itself you get weird network issues. Does this issue also happen when you’re on another network and vpning back?

    Also there’s a lot of great videos on YouTube to set this up things like Lawrence systems and network Chuck.

    Not exactly sure what the issue is here but gave you the up vote for visability and hopefully someone smarter then me will know.

    • Evkob (they/them)@lemmy.caOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 day ago

      When connected through wireguard can you access anything on the local network?

      Everything works as expected with Wireguard otherwise, I can ssh into my server or my desktop, and access the other things hosted on my server (although these are all through Docker, which is why I suspect container isolation to be an issue).

      Does this issue also happen when you’re on another network and vpning back?

      Yup, same issues whether I’m on the local network, the WiFi at work, or on LTE.

      • rymdlord@feddit.nu
        link
        fedilink
        English
        arrow-up
        0
        ·
        20 hours ago

        If I don’t remember wrong Android will always use your DNS config over the WG provided one so make sure to leave it blank. As for the routing I have a alternative solution that could maybe work using this app in combination with the WG tunnel. But when it comes to your current setup I suggest you try the following.

        1. Make sure that the IP and port of your DNS are accessible from your Phone you can use Termux if you want to ping and do a nc to do this.
        2. Make sure that the network that your WG connects to has its default DNS setup to be your unbound.
        3. Consider getting a Router that can run OpenWRT and then learn about vlans to create two networks(also 2 wifis) one for your roomates and one for you. Also you could setup WG on the OpenWRT router itself!

        If you really want to solve this problem you might want to read up on routing and networking in general! I suggest you start with Wikipedia! That’s atleast where I started! :D

        I wish you good luck on you self hosting experience!