From c402648e62870630a4143fadb2e2e7a5b709ae10 Mon Sep 17 00:00:00 2001 From: spiritLHLS <103393591+spiritLHLS@users.noreply.github.com> Date: Thu, 23 Feb 2023 22:04:51 +0800 Subject: [PATCH] Update network.sh --- network.sh | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/network.sh b/network.sh index 884dc0b..7149de2 100644 --- a/network.sh +++ b/network.sh @@ -6,17 +6,7 @@ BRIDGE_NAME="vmbr0" # 获取本地IPv4地址和子网掩码 IP_ADDR=$(ip route get 8.8.8.8 | head -1 | awk '{print $7}') -SUBNET_MASK=$(ip route get 8.8.8.8 | head -1 | awk '{print $1}' | awk -F"/" '{print $2}') - -# 计算网络地址 -IFS='.' read -ra IP_ARR <<< "$IP_ADDR" -IFS='.' read -ra MASK_ARR <<< "$SUBNET_MASK" -NET_ADDR="" -for ((i=0; i<4; i++)); do - NET_ADDR="${NET_ADDR}$((${IP_ARR[$i]} & ${MASK_ARR[$i]}))." -done -NET_ADDR=${NET_ADDR::-1} - +SUBNET_MASK="255.255.255.0" # 获取网关地址 GATEWAY=$(ip route | awk '/default/ {print $3}')