mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-07-28 02:34:49 +08:00
Update network.sh
This commit is contained in:
parent
3f35e406b9
commit
ff7e28040d
@ -398,8 +398,16 @@ getInfo() {
|
||||
error "Invalid MAC address: '$VM_NET_MAC', should be 12 or 17 digits long!" && exit 28
|
||||
fi
|
||||
|
||||
GATEWAY=$(ip route list dev "$VM_NET_DEV" | awk ' /^default/ {print $3}')
|
||||
IP=$(ip address show dev "$VM_NET_DEV" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
|
||||
GATEWAY=$(ip route list dev "$VM_NET_DEV" | awk ' /^default/ {print $3}' | head -n 1)
|
||||
IP=$(ip address show dev "$VM_NET_DEV" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/ | head -n 1)
|
||||
|
||||
IP6=""
|
||||
# shellcheck disable=SC2143
|
||||
if [ -f /proc/net/if_inet6 ] && [ -n "$(ifconfig -a | grep inet6)" ]; then
|
||||
IP6=$(ip -6 addr show dev "$VM_NET_DEV" scope global up)
|
||||
[ -n "$IP6" ] && IP6=$(echo "$IP6" | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | head -n 1)
|
||||
fi
|
||||
|
||||
echo "$IP" > /run/shm/qemu.ip
|
||||
|
||||
return 0
|
||||
@ -466,7 +474,7 @@ else
|
||||
|
||||
closeBridge
|
||||
NETWORK="user"
|
||||
warn "falling back to usermode networking! Performance will be bad and port mapping will not work."
|
||||
warn "falling back to user-mode networking! Performance will be bad and port mapping will not work."
|
||||
|
||||
fi
|
||||
|
||||
@ -474,7 +482,7 @@ else
|
||||
|
||||
if [[ "${NETWORK,,}" == "user"* ]]; then
|
||||
|
||||
# Configure for usermode networking (slirp)
|
||||
# Configure for user-mode networking (slirp)
|
||||
configureUser || exit 24
|
||||
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user