dotfiles/bin/myip

26 lines
540 B
Bash
Executable file

#!/bin/bash
# List system's WAN and LAN ip addresses
# Depends on ifconfig and awk
declare -r ipv4="$(curl --max-time 1 -s https://api4.ipify.org)"
if [[ -n "$ipv4" ]]; then
echo "IPv4 (WAN): $ipv4"
else
echo "IPv4 (WAN): Not available"
fi
declare -r ipv6="$(curl --max-time 1 -s https://api6.ipify.org)"
if [[ -n "$ipv6" ]]; then
echo "IPv6 (WAN): $ipv6"
else
echo "IPv6 (WAN): Not available"
fi
declare -r ipv64="$(curl --max-time 1 -s https://api64.ipify.org)"
if [[ -n "$ipv64" ]]; then
echo "First Resolved: $ipv64"
fi