mirror of
https://github.com/thelittlerocket/pve.git
synced 2024-11-15 11:38:00 +08:00
Update build_nat_network.sh
This commit is contained in:
parent
dedfed06df
commit
25da9bb440
1 changed files with 11 additions and 10 deletions
|
@ -18,16 +18,17 @@ else
|
|||
echo "Locale set to $utf8_locale"
|
||||
fi
|
||||
|
||||
API_NET=("ip.sb" "ipget.net" "ip.ping0.cc" "https://ip4.seeip.org" "https://api.my-ip.io/ip" "https://ipv4.icanhazip.com" "api.ipify.org")
|
||||
for p in "${API_NET[@]}"; do
|
||||
response=$(curl -s4m8 "$p")
|
||||
sleep 1
|
||||
if [ $? -eq 0 ] && ! echo "$response" | grep -q "error"; then
|
||||
IP_API="$p"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IPV4=$(curl -s4m8 "$IP_API")
|
||||
# API_NET=("ip.sb" "ipget.net" "ip.ping0.cc" "https://ip4.seeip.org" "https://api.my-ip.io/ip" "https://ipv4.icanhazip.com" "api.ipify.org")
|
||||
# for p in "${API_NET[@]}"; do
|
||||
# response=$(curl -s4m8 "$p")
|
||||
# sleep 1
|
||||
# if [ $? -eq 0 ] && ! echo "$response" | grep -q "error"; then
|
||||
# IP_API="$p"
|
||||
# break
|
||||
# fi
|
||||
# done
|
||||
# IPV4=$(curl -s4m8 "$IP_API")
|
||||
IPV4=$(ip -4 addr show | grep global | awk '{print $2}' | cut -d '/' -f1 | head -n 1)
|
||||
|
||||
# 查询信息
|
||||
interface=$(lshw -C network | awk '/logical name:/{print $3}' | head -1)
|
||||
|
|
Loading…
Reference in a new issue