Cannot use pihole DNS through wireguard VPN

  • I have setup PiHole in docker using a macvlan. I also set up wireguard in docker (linuxser.io).


    I can connect to wireguard and ping almost every computer or phone in my home network but not pihole. Which of course means I also cannot use it for DNS.

    I also noticed that my server cannot ping PiHole.


    Any ideas? OK before I posted this I have searched a bit more and found this thread, post 13 in the thread with the solution. Is this a good why to solve the problem?




    home network: 192.168.16.0/24

    gateway: 192.168.16.1

    macvlan:

    Code
    "Subnet": "192.168.16.0/24",
    "IPRange": "192.168.16.0/25",
    "Gateway": "192.168.16.1"

    PiHole IP: 192.168.16.65/24

    Server IP: 192.168.16.64/24

    omv 6

    Plugins - omvExtras | LVM2 | Compose plugin | SFTP | ...

    System - x86 intel

    • Offizieller Beitrag

    I have setup PiHole in docker using a macvlan. I also set up wireguard in docker (linuxser.io).


    I can connect to wireguard and ping almost every computer or phone in my home network but not pihole. Which of course means I also cannot use it for DNS.

    I also noticed that my server cannot ping PiHole.


    Any ideas? OK before I posted this I have searched a bit more and found this thread, post 13 in the thread with the solution. Is this a good why to solve the problem?

    I like that solution for the interface created in the host because it uses netplan, I'll have to check that thread, I didn't remember it, thanks for the link.

    I recently posted this on the wiki, it helps you create the macvlan network from the plugin. Although the part of the bridge can be improved. https://wiki.omv-extras.org/do…_the_same_lan_as_the_host

    When I have time and desire I will look at this better.

  • I didn't now there was guide.

    When I have time and desire I will look at this better.

    Thanks!

    What do you advice me (of course without warranty) to use for now, your solution in the guide or the post I found?

    I assume your guide is the best way for now?

    omv 6

    Plugins - omvExtras | LVM2 | Compose plugin | SFTP | ...

    System - x86 intel

    • Offizieller Beitrag

    What do you advice me (of course without warranty) to use for now, your solution in the guide or the post I found?

    I assume your guide is the best way for now?

    I think it doesn't make any difference to create the vlan. The GUI is more convenient and faster. It seems to me that the two methods do the same thing. For the bridge in the host I think the link you posted is better, but I would have to look at it better, I just took a look at it.

  • I think it doesn't make any difference to create the vlan.

    I created the macvlan already using the webui. PiHole is already running. I am now just trying to solve the macvlan issue.

    For the bridge in the host I think the link you posted is better, but I would have to look at it better, I just took a look at it.

    I'll try the solution I found. If I encounter problems I let you know. I not I'll try to let you know as well.

    omv 6

    Plugins - omvExtras | LVM2 | Compose plugin | SFTP | ...

    System - x86 intel

    • Offizieller Beitrag

    I'll try the solution I found. If I encounter problems I let you know. I not I'll try to let you know as well.

    ok thanks

  • So I am getting some nice errors I do not understand...


    What I did:


    1. Create /etc/netplan/90-macvlan-docker-interface.yaml


    2. I installed networkd-dispatcher using the apt-tool plugin.

    (Services -> Apt Tool -> Packages -> Add new package -> networkd.dispatcher -> Tools -> Install)


    3. Create the script /etc/networkd-dispatcher/configured.d/90-macvlan-docker-interface.sh

    Code
    sudo cat /etc/networkd-dispatcher/configured.d/90-macvlan-docker-interface.sh 
    #! /bin/bash
    
    ip link add macvlaninterface link enp2s0 type macvlan mode bridge

    4. Make the script executable

    Code
    sudo chmod o+x,g+x,u+x /etc/networkd-dispatcher/configured.d/90-macvlan-docker-interface.sh

    5. Run sudo netplan try

    6. Run sudo netplan apply, no output

    7. Run sudo networkd-dispatcher -T

    omv 6

    Plugins - omvExtras | LVM2 | Compose plugin | SFTP | ...

    System - x86 intel

    • Offizieller Beitrag

    This should be studied in detail, but considering that the network configuration in OMV changed about a month or two ago, it is possible that the configuration of that thread no longer behaves in the same way.

  • Ok I got it working now!!!

    Really happy!


    7. Run sudo networkd-dispatcher -T

    The error (see below) means that the interface name is to long (max 15 characters).

    Code
    Error: Attribute failed policy validation.

    So I changed that and got some other errors in syslog but found solutions online (I should have noted everything)


    Important background to note:

    Server IP: 192.168.16.64/24

    Gateway: 192.168.16.1/24

    PiHole: 192.168.16.65/24


    But I got it working with the following:


    1. The following file.

    Important that it is the same IP as the host or it did not work for me. It was .66 but did not work, changed it to .64 and it worked.

    2. Installed networkd-dispatcher (already done but just to be complete)

    3. Create the script /etc/networkd-dispatcher/configured.d/90-macvlan-docker-interface.sh.

    I have the same script also under /etc/networkd-dispatcher/routable.d

    I have not tested which directory is the one the is needed.

    Code
    sudo cat /etc/networkd-dispatcher/configured.d/90-macvlan-docker-interface.sh #! /bin/bash
    
    ip link add macvlan_host link enp2s0 type macvlan mode bridge

    4. Make the script executable (also already done just to be complete)

    Code
    sudo chmod o+x,g+x,u+x /etc/networkd-dispatcher/configured.d/90-macvlan-docker-interface.sh

    5. Reboot

    That is I think the safest thing to do.


    Some errors I do remember:

    1.

    syslog

    Code
    Jul  9 22:30:48 **hostename** systemd-networkd[363]: macvlan_host: Could not set route: Nexthop has invalid gateway. Network is unreachable
    Jul  9 22:30:48 **hostename** systemd-networkd[363]: macvlan_host: Failed

    Problem was that in the yaml file the address was /32 instead of /24

    omv 6

    Plugins - omvExtras | LVM2 | Compose plugin | SFTP | ...

    System - x86 intel

  • Something totally different if that is ok to ask here.

    I noticed a lot of interfaces from docker that are not used anymore. Is there a possibility to remove them?

    To be clear, the docker networks are gone but the interfaces when doing "ip a" still exists.

    omv 6

    Plugins - omvExtras | LVM2 | Compose plugin | SFTP | ...

    System - x86 intel

  • Hello,

    I have the same problem described here.

    I connect correctly to the server from the outside (mobile phone) using VPN (Wireguard) but it does not filter through Pihole, even when configuring it with its DNS.


    I'm quite a newbie.


    1. Is there an easier way to set this up?

    2. Is it possible to create another network between the two containers (pihole and wireguard), so that they communicate with each other?


    It's a shame not to be able to block ads from outside!!


    Thank you all!!!!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!