mirror of
https://github.com/SinTan1729/random.git
synced 2024-12-26 13:18:35 -06:00
fix: Missing interfaces and protocols
This commit is contained in:
parent
3a2f1761e5
commit
9c7dcdbd63
1 changed files with 6 additions and 2 deletions
8
getip.sh
8
getip.sh
|
@ -4,16 +4,20 @@
|
||||||
|
|
||||||
echo 'ipv4:'
|
echo 'ipv4:'
|
||||||
for i in eno1 wlan0; do
|
for i in eno1 wlan0; do
|
||||||
|
$(ip -4 addr | grep -q $i) || continue
|
||||||
addr="$(ip -4 addr show dev $i | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
|
addr="$(ip -4 addr show dev $i | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
|
||||||
[ -z "$addr" ] || echo -e "\t$i: \t\t$addr"
|
[ -z "$addr" ] || echo -e "\t$i: \t\t$addr"
|
||||||
done
|
done
|
||||||
echo -e "\texternal: \t$(curl -s ipv4.icanhazip.com)"
|
addr=$(curl --connect-timeout 3 -s ipv4.icanhazip.com)
|
||||||
|
echo -e "\texternal: \t${addr:-n/a}"
|
||||||
|
|
||||||
[ "$(cat /sys/module/ipv6/parameters/disable)" == "1" ] && exit
|
[ "$(cat /sys/module/ipv6/parameters/disable)" == "1" ] && exit
|
||||||
|
|
||||||
echo 'ipv6:'
|
echo 'ipv6:'
|
||||||
for i in eno1 wlan0; do
|
for i in eno1 wlan0; do
|
||||||
|
$(ip -6 addr | grep -q $i) || continue
|
||||||
addr="$(ip -6 addr show dev $i | grep -oP '(?<=inet6\s)\w+(\:{1,2}\w+){4}(?=.+link)')"
|
addr="$(ip -6 addr show dev $i | grep -oP '(?<=inet6\s)\w+(\:{1,2}\w+){4}(?=.+link)')"
|
||||||
[ -z "$addr" ] || echo -e "\t$i: \t\t$addr"
|
[ -z "$addr" ] || echo -e "\t$i: \t\t$addr"
|
||||||
done
|
done
|
||||||
echo -e "\texternal: \t$(curl -s ipv6.icanhazip.com)"
|
addr=$(curl --connect-timeout 3 -s ipv6.icanhazip.com)
|
||||||
|
echo -e "\texternal: \t${addr:-n/a}"
|
||||||
|
|
Loading…
Reference in a new issue