mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-12-16 07:10:35 +08:00
Update network.sh
This commit is contained in:
@@ -170,7 +170,7 @@ getHostPorts() {
|
|||||||
|
|
||||||
configureUser() {
|
configureUser() {
|
||||||
|
|
||||||
NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
|
NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.2,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
|
||||||
|
|
||||||
local forward
|
local forward
|
||||||
forward=$(getUserPorts "$USER_PORTS")
|
forward=$(getUserPorts "$USER_PORTS")
|
||||||
@@ -365,9 +365,15 @@ getInfo() {
|
|||||||
|
|
||||||
if [ ! -d "/sys/class/net/$VM_NET_DEV" ]; then
|
if [ ! -d "/sys/class/net/$VM_NET_DEV" ]; then
|
||||||
error "Network interface '$VM_NET_DEV' does not exist inside the container!"
|
error "Network interface '$VM_NET_DEV' does not exist inside the container!"
|
||||||
error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 27
|
error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 26
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
BASE_IP="${VM_NET_IP%.*}."
|
||||||
|
|
||||||
|
if [ "${VM_NET_IP/$BASE_IP/}" -lt "3" ]; then
|
||||||
|
error "Invalid VM_NET_IP, must end in a higher number than .3" && exit 27
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$MTU" ]; then
|
if [ -z "$MTU" ]; then
|
||||||
MTU=$(cat "/sys/class/net/$VM_NET_DEV/mtu")
|
MTU=$(cat "/sys/class/net/$VM_NET_DEV/mtu")
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user