I am able to access the internet via pihole's dns sinkhole on my local lan and when connected via openvpn.
Actual Behaviour:
I am able to use pihole normally on my lan and connect to the vpn, however when connected via openvpn, I can't access the internet or other devices on my network, only the raspberry pi running pihole and openvpn via ssh and the web panel.
I followed the official pihole and openvpn setup guide. Pihole is set to listen on all interfaces and permit all origins and port UDP 1194 is forwarded to 192.168.1.2. It probably isn't relevant, but the ethernet interface pihole is listening on is called enxb827eb887102 instead of eth0.
I didn't initially realise what ip tables were, I assumed they were just something you setup if your server wasn't behind a nat network because in the official documentation, there is a firewall section which says that issuing these certain commands needed to be done if your server wasn't behind a nat network. I didn't realise that they were still there, just automatically configured if behind a nat network. I also assumed this because in the other thread I linked to, the guy had the file /etc/pihole/rules.v4 which I didn't have and rules.v4 was part of the firewall documentation I talked about earlier, so I thought he must be running his server in the cloud and therefore thought that his solution didn't apply to me.
However, I'm still confused as to how I will actually be able to get it working.
Thank you so much, this fixed it instantly, I also did a reboot to make sure that the injecting of the last line worked and it did perfectly. Thanks again for all your help
Hi, I thought my problem was fixed, but it turns out it only partially is. I am able to connect to the internet and ping devices on my local network when accessing the vpn through my local network, but when outside of my local network, I am able to connect to the vpn, but unable to connect to the internet or ping devices other than pihole.
I have port forwarded 1194 on my router and I ran a udp open port scanner and it verified that the port was open.
Thanks for your reply, it was already set to that, I set it to only listen on the pihole interface, and then set it back to Listen on all interfaces, permit all origins, but it still doesn't work
I've discovered the problem, the iptables commands I was given are being removed after every reboot, even though I added the last line in /etc/rc.local, but I might not have added correctly, is it correct? I simply added the line at the end of the file as you can see, also, if I wanted to change the port that was being used for openvpn, how would I go about that?
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
exit 0
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to 192.168.1.2
Thanks for your reply, I'm running raspbian, should this have fixed it then?
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to 192.168.1.2
exit 0
It seems not, I can't even connect anymore, beforehand, I was able to connect, but just not access the internet or other devices on my network, I also tried to copy and paste all the commands back in, which worked every other time, but not this time.