From 4c0cd1b2903cbde4294ec7cff8fb0ca048464082 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 18 Mar 2025 19:23:05 +0100 Subject: [PATCH] Update network.sh --- src/network.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/network.sh b/src/network.sh index a0a8ead..556f305 100644 --- a/src/network.sh +++ b/src/network.sh @@ -170,7 +170,7 @@ getHostPorts() { 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 forward=$(getUserPorts "$USER_PORTS") @@ -365,9 +365,15 @@ getInfo() { if [ ! -d "/sys/class/net/$VM_NET_DEV" ]; then 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 + 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 MTU=$(cat "/sys/class/net/$VM_NET_DEV/mtu") fi