From 4a737723a32ccc0879db954d582fb1583393671d Mon Sep 17 00:00:00 2001 From: Patrick Greiner Date: Thu, 22 Apr 2021 19:37:46 +0200 Subject: [PATCH 1/6] 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 From 584bffc85bdec94e817c6fd943aa163efad71660 Mon Sep 17 00:00:00 2001 From: Patrick <38922528+diddip21@users.noreply.github.com> Date: Thu, 22 Apr 2021 21:18:11 +0200 Subject: [PATCH 2/6] Update install.sh Fix VLAN on dhcp --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 2e1fb6a..69a9fc6 100644 --- a/install.sh +++ b/install.sh @@ -108,7 +108,7 @@ fi # Reconfigure conatiner 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; + pct set $LXC_NBR -net0 name=eth0,bridge=$LXC_BRIDGE,ip=dhcp,type=veth$VLAN; 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 From 5b05d94d64aca4887e352a4e2f0363eadc7de46f Mon Sep 17 00:00:00 2001 From: Thorsten Spille Date: Thu, 22 Apr 2021 21:26:33 +0200 Subject: [PATCH 3/6] Update CHANGELOG.md --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d423b7a..bfe889b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +**** Zamba LXC Toolbox main branch **** +- added dhcp support + **** Zamba LXC Toolbox v0.1 **** - `locales` are now configured noninteractive #21 - timezone is now configured with `pct set` command in `install.sh` #22 @@ -9,4 +12,4 @@ - `mailpiler`: website is now also `default_host`, removed nginx default site, dns entry is still required - changed `mailpiler` version to 1.3.11 - changed `element-web` version to 1.7.25 -- `LXC_AUTHORIZED_KEY` variable now defines an `authorized_keys` file, by default the configuration of you proxmox host will be inherited (`~/.ssh/authorized_keys`) \ No newline at end of file +- `LXC_AUTHORIZED_KEY` variable now defines an `authorized_keys` file, by default the configuration of you proxmox host will be inherited (`~/.ssh/authorized_keys`) From a543e0a07637f747bbdd0c83a30a441a25cde503 Mon Sep 17 00:00:00 2001 From: Thorsten Spille Date: Thu, 22 Apr 2021 23:16:22 +0200 Subject: [PATCH 4/6] Replaced hardcoded sharename by $ZMB_SHARE --- zmb-standalone.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zmb-standalone.sh b/zmb-standalone.sh index 85ab941..a3077fd 100644 --- a/zmb-standalone.sh +++ b/zmb-standalone.sh @@ -25,7 +25,7 @@ smbpasswd -x $USER (echo $ZMB_ADMIN_PASS; echo $ZMB_ADMIN_PASS) | smbpasswd -a $USER cat << EOF >> /etc/samba/smb.conf -[share] +[$ZMB_SHARE] comment = Main Share path = /$LXC_SHAREFS_MOUNTPOINT/$ZMB_SHARE read only = No From 3376652bbec0386af8be7480e0925952dfe90953 Mon Sep 17 00:00:00 2001 From: Thorsten Spille Date: Fri, 23 Apr 2021 12:05:07 +0200 Subject: [PATCH 5/6] Fixed conatainer id detection Supporting container ids larger than 999. --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 69a9fc6..4a20bbf 100644 --- a/install.sh +++ b/install.sh @@ -85,7 +85,7 @@ else fi # Get next free LXC-number -LXC_LST=$( lxc-ls | egrep -o '.{1,5}$' ) +LXC_LST=$( lxc-ls -1 | tail -1 ) LXC_CHK=$((LXC_LST+1)); if [ $LXC_CHK -lt 100 ] || [ -f /etc/pve/qemu-server/$LXC_CHK.conf ]; then From 3d4b24ca512bf70f38260cc760f053f2ea9a35c4 Mon Sep 17 00:00:00 2001 From: Thorsten Spille Date: Fri, 23 Apr 2021 12:08:25 +0200 Subject: [PATCH 6/6] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfe889b..8344929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ **** Zamba LXC Toolbox main branch **** - added dhcp support +- fixed hardcoded samba sharename in `zmb-standalone` script +- added support for container id's larger than 999 **** Zamba LXC Toolbox v0.1 **** - `locales` are now configured noninteractive #21