[Install Failed]: Invalid public IP
Closed this issue · 2 comments
In raising this issue I confirm that
- I have read the documentation
- I have read and understood the PiVPN General Guidelines
- I have read and understood the PiVPN Troubleshooting Guidelines
- The issue I am reporting isn't a duplicate, see closed issues and open issues.
- I have searched for similar issues and solutions
- I can replicate the issue even after a clean OS installation
Describe the issue
I am running into problems when trying to run the installation script using curl -L https://install.pivpn.io | bash
I'm running the installation on a Raspberry Pi 3 Model B, Raspberry OS 64 bit lite with pi-hole installed
The error message I'm getting is:
[2023-12-28T20:26:28+0100]: dig failed, now trying to curl checkip.amazonaws.com
curl: (6) Could not resolve host: checkip.amazonaws.com
[2023-12-28T20:26:28+0100]: checkip.amazonaws.com failed, please check your internet connection/DNS
I check on getting the result of curl -sSf https://checkip.amazonaws.com
from within my Pi. I get my public IP, which I'm going to keep anonymous for now 😄
When I try running traceroute on it, things work as expected.
traceroute to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx), 64 hops max, 52 byte packets
1 xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 15.902 ms 6.882 ms 6.509 ms
I have checked the installation script, and the function that gets called is validIP
validIP() {
local ip="${1}"
local stat=1
if [[ "${ip}" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
OIFS="${IFS}"
IFS='.'
read -r -a ip <<< "${ip}"
IFS="${OIFS}"
[[ "${ip[0]}" -le 255 && "${ip[1]}" -le 255 && "${ip[2]}" -le 255 && "${ip[3]}" -le 255 ]]
stat="$?"
fi
return "${stat}"
}
I have created a simple bash script that I executed in my Raspebbry Pi to validate this logic
pi3@pihole:~ $ cat test.sh
#!/usr/bin/env bash
validIP() {
local ip="${1}"
local stat=1
if [[ "${ip}" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
OIFS="${IFS}"
IFS='.'
read -r -a ip <<< "${ip}"
IFS="${OIFS}"
[[ "${ip[0]}" -le 255 && "${ip[1]}" -le 255 && "${ip[2]}" -le 255 && "${ip[3]}" -le 255 ]]
stat="$?"
fi
return "${stat}"
}
if ! IPv4pub="$(curl -sSf https://checkip.amazonaws.com)" || ! validIP "${IPv4pub}"; then
echo "invalid"
else
echo "valid"
fi
Running the script returns that my public IP is valid 😄
pi3@pihole:~ $ ./test.sh
valid
I'm not sure if missing anything
Expected behavior
pivpm gets installed successfully
Please describe the steps to replicate the issue
run curl -L https://install.pivpn.io | bash
after asking if I want to use the pi-hole as my DNS server the installation exit with 1
Have you taken any steps towards solving your issue?
Yes. I tried to debug the validIP
function locally.
Screenshots
No response
Where did you run pivpn?
Raspberry Pi
Please provide your output from uname -a
Linux pihole 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
Details about Operative System
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
I am running in the exact same issue... Googling led me to this post. I am not smart enough to figure out how to fix it.