From 73a1d82ded460955dd5f51d23b421b8ec99a2559 Mon Sep 17 00:00:00 2001 From: Kroese Date: Thu, 20 Apr 2023 06:25:46 +0200 Subject: [PATCH] DHCP --- run/network.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/run/network.sh b/run/network.sh index 989bf67..986d5a0 100644 --- a/run/network.sh +++ b/run/network.sh @@ -161,17 +161,21 @@ if [ "$DEBUG" = "Y" ]; then fi -if [[ "$GATEWAY" == "172."* ]]; then - # Bridge network - configureNAT +if [ "$DHCP" != "Y" ]; then + + # Configuration for static IP + configureNAT + else - if [ "$DHCP" = "Y" ]; then - # Configuration for DHCP IP - configureDHCP - else - # Configuration for static IP - configureNAT + + if [[ "$GATEWAY" == "172."* ]]; then + echo -n "ERROR: You cannot enable DHCP while the container is " + echo "in a bridge network, only on a macvlan network!" && exit 86 fi + + # Configuration for DHCP IP + configureDHCP + fi NET_OPTS="${NET_OPTS} -device virtio-net-pci,romfile=,netdev=hostnet0,mac=${VM_NET_MAC},id=net0"