From 5b19904cd45dc4f4dea2c1f2bd54e685ac559c33 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 7 May 2023 13:40:40 +0200 Subject: [PATCH 1/4] Hide ifconfig --- run/network.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/run/network.sh b/run/network.sh index f1dce2e..ba9c9d3 100644 --- a/run/network.sh +++ b/run/network.sh @@ -30,7 +30,7 @@ configureDHCP() { if (( rc != 0 )); then - echo -n "INFO: Could not create macvlan, skipping..." + echo "INFO: Could not create macvlan, skipping..." else @@ -214,8 +214,8 @@ if [[ "${DEBUG}" == [Yy1]* ]]; then IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/) echo "INFO: Container IP is ${IP} with gateway ${GATEWAY}" && echo - ifconfig - ip route && echo + #ifconfig + #ip route && echo fi From 50f7fdde52cc46ac2960703f12d2658cb618905a Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 7 May 2023 13:51:08 +0200 Subject: [PATCH 2/4] macvlan --- run/network.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/run/network.sh b/run/network.sh index ba9c9d3..153045e 100644 --- a/run/network.sh +++ b/run/network.sh @@ -28,11 +28,7 @@ configureDHCP() { [[ "${DEBUG}" == [Yy1]* ]] && set -x { ip link add link "${VM_NET_DEV}" "${VM_NET_VLAN}" type macvlan mode bridge ; rc=$?; } || : - if (( rc != 0 )); then - - echo "INFO: Could not create macvlan, skipping..." - - else + if (( rc == 0 )); then ip address add "${IP}" dev "${VM_NET_VLAN}" ip link set dev "${VM_NET_VLAN}" up @@ -43,6 +39,10 @@ configureDHCP() { ip route add "${NETWORK}" dev "${VM_NET_VLAN}" metric 0 ip route add default via "${GATEWAY}" + else + + echo "INFO: Could not create ${VM_NET_VLAN} on ${VM_NET_DEV}, skipping..." + fi { ip link add link "${VM_NET_DEV}" name "${VM_NET_TAP}" address "${VM_NET_MAC}" type macvtap mode bridge ; rc=$?; } || : @@ -214,8 +214,6 @@ if [[ "${DEBUG}" == [Yy1]* ]]; then IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/) echo "INFO: Container IP is ${IP} with gateway ${GATEWAY}" && echo - #ifconfig - #ip route && echo fi From df1b00076ad22f18e8ab789120ac60245e14057d Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 7 May 2023 14:34:16 +0200 Subject: [PATCH 3/4] GUEST_MAC --- run/network.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run/network.sh b/run/network.sh index 153045e..b3e5a6f 100644 --- a/run/network.sh +++ b/run/network.sh @@ -3,10 +3,12 @@ set -Eeuo pipefail # Docker environment variables +: ${GUEST_MAC:='02:11:32:AA:BB:CC'} + : ${VM_NET_TAP:='dsm'} : ${VM_NET_DEV:='eth0'} : ${VM_NET_HOST:='VirtualDSM'} -: ${VM_NET_MAC:='02:11:32:AA:BB:CC'} +: ${VM_NET_MAC:='$GUEST_MAC'} : ${DHCP:='N'} : ${DNS_SERVERS:=''} @@ -208,6 +210,7 @@ update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null VM_NET_MAC="${VM_NET_MAC//-/:}" + GATEWAY=$(ip r | grep default | awk '{print $3}') if [[ "${DEBUG}" == [Yy1]* ]]; then From 551a34ec12bb529b60bd5faff1bbb304f706dff0 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 7 May 2023 14:39:09 +0200 Subject: [PATCH 4/4] MAC --- run/network.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/run/network.sh b/run/network.sh index b3e5a6f..92019f9 100644 --- a/run/network.sh +++ b/run/network.sh @@ -3,14 +3,14 @@ set -Eeuo pipefail # Docker environment variables -: ${GUEST_MAC:='02:11:32:AA:BB:CC'} +: ${DHCP:='N'} +: ${MAC:='02:11:32:AA:BB:CC'} : ${VM_NET_TAP:='dsm'} : ${VM_NET_DEV:='eth0'} +: ${VM_NET_MAC:='$MAC'} : ${VM_NET_HOST:='VirtualDSM'} -: ${VM_NET_MAC:='$GUEST_MAC'} -: ${DHCP:='N'} : ${DNS_SERVERS:=''} : ${DNSMASQ_OPTS:=''} : ${DNSMASQ:='/usr/sbin/dnsmasq'} @@ -210,7 +210,6 @@ update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null VM_NET_MAC="${VM_NET_MAC//-/:}" - GATEWAY=$(ip r | grep default | awk '{print $3}') if [[ "${DEBUG}" == [Yy1]* ]]; then