[GH-ISSUE #102] Unable to set own dns (pihole) server #90

Closed
opened 2026-03-02 07:11:39 +03:00 by kerem · 7 comments
Owner

Originally created by @axeII on GitHub (Nov 23, 2018).
Original GitHub issue: https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/102

I am running docker container ipsec-vpn-server latest version. I am also running pihole in other docker container.

What I am trying to achieve is to set dns server as the pihole. Both suppose to run on same machine but in different container.

I tried to setup config file vpn.env as:

...
VPN_DNS_SRV1=localhost
VPN_DNS_SRV2=1.1.1.1

But it's not working! I am still getting ads on devices when I am connected via VPN.
Any advice what could help or what's wrong? Thanks

Originally created by @axeII on GitHub (Nov 23, 2018). Original GitHub issue: https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/102 I am running docker container _ipsec-vpn-server_ latest version. I am also running _pihole_ in other docker container. What I am trying to achieve is to set dns server as the _pihole_. Both suppose to run on same machine but in different container. I tried to setup config file `vpn.env` as: ``` ... VPN_DNS_SRV1=localhost VPN_DNS_SRV2=1.1.1.1 ``` But it's not working! I am still getting ads on devices when I am connected via VPN. Any advice what could help or what's wrong? Thanks
kerem closed this issue 2026-03-02 07:11:39 +03:00
Author
Owner

@hwdsl2 commented on GitHub (Nov 23, 2018):

@L3rchal Hello! I am not familiar with pihole. Does it expose any port (e.g. UDP 53) on your Docker host? If it does, trying setting VPN_DNS_SRV1 to your Docker host’s public (or if behind NAT, private) IP. You’ll need to recreate the Docker container after modifying vpn.env.

If that doesn’t work try setting it to the private IP of the pihole Docker container.

<!-- gh-comment-id:441330142 --> @hwdsl2 commented on GitHub (Nov 23, 2018): @L3rchal Hello! I am not familiar with pihole. Does it expose any port (e.g. UDP 53) on your Docker host? If it does, trying setting `VPN_DNS_SRV1` to your Docker host’s public (or if behind NAT, private) IP. You’ll need to recreate the Docker container after modifying `vpn.env`. If that doesn’t work try setting it to the private IP of the pihole Docker container.
Author
Owner

@axeII commented on GitHub (Nov 26, 2018):

Ok solved. I solved issue by adding parameter --net=host. With this way I am able to cooperated with the other container running pihole. I also had to setup to private address to make this work.

On the other hand when running new container this way there is this line: WARNING: Published ports are discarded when using host network mode
...
Should this be my concern?

Anyway it's working now, feel free to close this.

<!-- gh-comment-id:441486397 --> @axeII commented on GitHub (Nov 26, 2018): Ok solved. I solved issue by adding parameter `--net=host`. With this way I am able to cooperated with the other container running pihole. I also had to setup to **private address** to make this work. On the other hand when running new container **this way** there is this line: `WARNING: Published ports are discarded when using host network mode` ... Should this be my concern? Anyway it's working now, feel free to close this.
Author
Owner

@hwdsl2 commented on GitHub (Nov 26, 2018):

@L3rchal Glad to hear you got it working! It looks like that the warning message is saying that although the Docker container exposes (publishes) UDP ports 500 and 4500 (in the Dockerfile), they are "discarded" because using --net=host already "exposes" all ports on the host to the Docker container.

<!-- gh-comment-id:441533878 --> @hwdsl2 commented on GitHub (Nov 26, 2018): @L3rchal Glad to hear you got it working! It looks like that the warning message is saying that although the Docker container exposes (publishes) UDP ports 500 and 4500 (in the Dockerfile), they are "discarded" because using `--net=host` already "exposes" all ports on the host to the Docker container.
Author
Owner

@hadalin commented on GitHub (Mar 12, 2019):

I also had issues with this. What worked for me was changing a setting via Pi-Hole web interface: Settings > DNS > Interface listening behavior > Listen on all interfaces.

<!-- gh-comment-id:472159994 --> @hadalin commented on GitHub (Mar 12, 2019): I also had issues with this. What worked for me was changing a setting via Pi-Hole web interface: `Settings` > `DNS` > `Interface listening behavior` > `Listen on all interfaces`.
Author
Owner

@michaeldavie commented on GitHub (Aug 9, 2019):

@axeII or @hadalin, would you be willing to share your configs for this setup? I'm trying to do the same thing, but I'm stuck. I see the queries reaching the Pi-Hole, but the responses don't seem to be making it back to the device connecting through the VPN. Thanks for your help.

<!-- gh-comment-id:519993668 --> @michaeldavie commented on GitHub (Aug 9, 2019): @axeII or @hadalin, would you be willing to share your configs for this setup? I'm trying to do the same thing, but I'm stuck. I see the queries reaching the Pi-Hole, but the responses don't seem to be making it back to the device connecting through the VPN. Thanks for your help.
Author
Owner

@axeII commented on GitHub (Aug 10, 2019):

@michaeldavie Hmm did you set vpn-dns ip to private ip address of your pihole machine instead of localhost? I remember that localhost wasn't working for me. Hence my config as my pihole machine ip is 10.0.0.120

VPN_IPSEC_PSK=your_ipsec_pre_shared_key
VPN_USER=your_vpn_username
VPN_PASSWORD=your_vpn_password
VPN_DNS_SRV1=10.0.0.120
VPN_DNS_SRV2=10.0.0.120
<!-- gh-comment-id:520147697 --> @axeII commented on GitHub (Aug 10, 2019): @michaeldavie Hmm did you set vpn-dns ip to private ip address of your pihole machine instead of `localhost`? I remember that `localhost` wasn't working for me. Hence my config as my pihole machine ip is `10.0.0.120` ```text VPN_IPSEC_PSK=your_ipsec_pre_shared_key VPN_USER=your_vpn_username VPN_PASSWORD=your_vpn_password VPN_DNS_SRV1=10.0.0.120 VPN_DNS_SRV2=10.0.0.120 ```
Author
Owner

@michaeldavie commented on GitHub (Aug 11, 2019):

Thanks. The DNS server setting is making it through to the client, and the queries are reaching the Pi-Hole, but the responses don't seem to be making it back. Did you have to make any changes to the iptables configuration to get this to work?

<!-- gh-comment-id:520190258 --> @michaeldavie commented on GitHub (Aug 11, 2019): Thanks. The DNS server setting is making it through to the client, and the queries are reaching the Pi-Hole, but the responses don't seem to be making it back. Did you have to make any changes to the `iptables` configuration to get this to work?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/docker-ipsec-vpn-server#90
No description provided.