diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-06-10 20:07:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-10 20:07:57 +0200 |
commit | 299e16aae6d2b1038be5b3d492000c590050b4c9 (patch) | |
tree | 100cd850c2d3564cb8f335f0c67efb9bcfe78059 /src/op_mode | |
parent | 18b303734d84c0c5677ea4d872ec068ffcab4cad (diff) | |
parent | a03b89039266b8e2a9cf95eef026365a863a8431 (diff) | |
download | vyos-1x-299e16aae6d2b1038be5b3d492000c590050b4c9.tar.gz vyos-1x-299e16aae6d2b1038be5b3d492000c590050b4c9.zip |
Merge pull request #1326 from sever-sever/T4429
op-mode: T4429: Ability to detect external IP address
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/show_ip_external.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/op_mode/show_ip_external.sh b/src/op_mode/show_ip_external.sh new file mode 100755 index 000000000..275d05278 --- /dev/null +++ b/src/op_mode/show_ip_external.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Detect an external IP address +# Use random services for checking + + +array=( + ipinfo.io/ip + ifconfig.me + ipecho.net/plain + icanhazip.com + v4.ident.me + checkip.amazonaws.com +) + +size=${#array[@]} +index=$(($RANDOM % $size)) + +curl --silent ${array[$index]} | tr -d "[:space:]" && echo |