mirror of
https://github.com/thelittlerocket/pve.git
synced 2025-03-01 00:06:29 +08:00
Update buildvm_extraip.sh
This commit is contained in:
parent
c1e4da0eea
commit
733826ffff
1 changed files with 5 additions and 1 deletions
|
@ -96,6 +96,10 @@ fi
|
||||||
if ! command -v lshw > /dev/null 2>&1; then
|
if ! command -v lshw > /dev/null 2>&1; then
|
||||||
apt-get install -y lshw
|
apt-get install -y lshw
|
||||||
fi
|
fi
|
||||||
|
if ! command -v ping > /dev/null 2>&1; then
|
||||||
|
apt-get install -y iputils-ping
|
||||||
|
apt-get install -y ping
|
||||||
|
fi
|
||||||
interface=$(lshw -C network | awk '/logical name:/{print $3}' | head -1)
|
interface=$(lshw -C network | awk '/logical name:/{print $3}' | head -1)
|
||||||
user_main_ip_range=$(grep -A 1 "iface ${interface}" /etc/network/interfaces | grep "address" | awk '{print $2}')
|
user_main_ip_range=$(grep -A 1 "iface ${interface}" /etc/network/interfaces | grep "address" | awk '{print $2}')
|
||||||
# 宿主机IP
|
# 宿主机IP
|
||||||
|
@ -111,7 +115,7 @@ for ((i=0; i<=$range; i++)); do
|
||||||
ip="${octets[0]}.${octets[1]}.${octets[2]}.$((octets[3] + octet))"
|
ip="${octets[0]}.${octets[1]}.${octets[2]}.$((octets[3] + octet))"
|
||||||
ip_list+=("$ip")
|
ip_list+=("$ip")
|
||||||
done
|
done
|
||||||
# 打印IP列表
|
# 宿主机的IP列表
|
||||||
for ip in "${ip_list[@]}"; do
|
for ip in "${ip_list[@]}"; do
|
||||||
echo "$ip"
|
echo "$ip"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue