mirror of
https://github.com/thelittlerocket/pve.git
synced 2024-11-15 19:44:38 +08:00
Update network.sh
This commit is contained in:
parent
f26338b790
commit
beaf942335
1 changed files with 11 additions and 6 deletions
17
network.sh
17
network.sh
|
@ -13,7 +13,7 @@ IFS='.' read -ra IP_ARR <<< "$IP_ADDR"
|
||||||
IFS='.' read -ra MASK_ARR <<< "$SUBNET_MASK"
|
IFS='.' read -ra MASK_ARR <<< "$SUBNET_MASK"
|
||||||
NET_ADDR=""
|
NET_ADDR=""
|
||||||
for ((i=0; i<4; i++)); do
|
for ((i=0; i<4; i++)); do
|
||||||
NET_ADDR="$NET_ADDR$(( ${IP_ARR[$i]} & ${MASK_ARR[$i]} ))."
|
NET_ADDR="${NET_ADDR}$((${IP_ARR[$i]} & ${MASK_ARR[$i]}))."
|
||||||
done
|
done
|
||||||
NET_ADDR=${NET_ADDR::-1}
|
NET_ADDR=${NET_ADDR::-1}
|
||||||
|
|
||||||
|
@ -22,8 +22,13 @@ GATEWAY=$(ip route | awk '/default/ {print $3}')
|
||||||
|
|
||||||
# 创建虚拟网桥并将其记录到PVE配置中
|
# 创建虚拟网桥并将其记录到PVE配置中
|
||||||
pvesh set /nodes/localhost/network/$BRIDGE_NAME \
|
pvesh set /nodes/localhost/network/$BRIDGE_NAME \
|
||||||
bridge_ports=none \
|
-content-type "application/json" \
|
||||||
bridge_vlan_aware=1 \
|
-put \
|
||||||
vlan_ids=100 \
|
-data \
|
||||||
addresses="$IP_ADDR/$SUBNET_MASK" \
|
'{
|
||||||
gateway="$GATEWAY"
|
"bridge_ports": "none",
|
||||||
|
"bridge_vlan_aware": "1",
|
||||||
|
"vlan_ids": "100",
|
||||||
|
"addresses": "'"$IP_ADDR/$SUBNET_MASK"'",
|
||||||
|
"gateway": "'"$GATEWAY"'"
|
||||||
|
}'
|
||||||
|
|
Loading…
Reference in a new issue