From 4a737723a32ccc0879db954d582fb1583393671d Mon Sep 17 00:00:00 2001 From: Patrick Greiner Date: Thu, 22 Apr 2021 19:37:46 +0200 Subject: [PATCH] added dhcp support --- install.sh | 7 ++++++- zamba.conf | 3 +++ zamba.conf.md | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 35b2f2e..2e1fb6a 100644 --- a/install.sh +++ b/install.sh @@ -106,7 +106,12 @@ else VLAN="" fi # Reconfigure conatiner -pct set $LXC_NBR -memory $LXC_MEM -swap $LXC_SWAP -hostname $LXC_HOSTNAME \-nameserver $LXC_DNS -searchdomain $LXC_DOMAIN -onboot 1 -timezone $LXC_TIMEZONE -features nesting=$LXC_NESTING -net0 name=eth0,bridge=$LXC_BRIDGE,firewall=1,gw=$LXC_GW,ip=$LXC_IP,type=veth$VLAN; +pct set $LXC_NBR -memory $LXC_MEM -swap $LXC_SWAP -hostname $LXC_HOSTNAME -onboot 1 -timezone $LXC_TIMEZONE -features nesting=$LXC_NESTING; +if [ $LXC_DHCP == true ]; then + pct set $LXC_NBR -net0 name=eth0,bridge=$LXC_BRIDGE,ip=dhcp; +else + pct set $LXC_NBR -net0 name=eth0,bridge=$LXC_BRIDGE,firewall=1,gw=$LXC_GW,ip=$LXC_IP,type=veth$VLAN -nameserver $LXC_DNS -searchdomain $LXC_DOMAIN; +fi sleep 2 if [ $LXC_MP -gt 0 ]; then diff --git a/zamba.conf b/zamba.conf index 59816c5..11738a4 100644 --- a/zamba.conf +++ b/zamba.conf @@ -39,6 +39,9 @@ LXC_HOSTNAME="zamba" # Defines the domain name / search domain of your LXC container LXC_DOMAIN="zmb.rocks" +# Enable DHCP on LAN (eth0) - (Obtain an IP address automatically) [true/false] +LXC_DHCP=false + # Defines the local IP address and subnet of your LXC container in CIDR format LXC_IP="192.168.100.200/24" diff --git a/zamba.conf.md b/zamba.conf.md index 1dfdd40..a4c3114 100644 --- a/zamba.conf.md +++ b/zamba.conf.md @@ -57,6 +57,11 @@ Defines the domain name / search domain of your LXC container ```bash LXC_DOMAIN="zmb.rocks" ``` +### LXC_DHCP +Enable DHCP on LAN (eth0) - (Obtain an IP address automatically) [true/false] +```bash +LXC_DHCP=false +``` ### LXC_IP Defines the local IP address and subnet of your LXC container in CIDR format ```bash