Add MAC variable
This commit is contained in:
parent
6a693c66bc
commit
3ae0404e92
1 changed files with 9 additions and 9 deletions
|
@ -3,12 +3,14 @@ set -Eeuo pipefail
|
|||
|
||||
# Docker environment variables
|
||||
|
||||
: ${DHCP:='N'}
|
||||
: ${MAC:='82:cf:d0:5e:57:66'}
|
||||
|
||||
: ${VM_NET_TAP:='qemu'}
|
||||
: ${VM_NET_DEV:='eth0'}
|
||||
: ${VM_NET_HOST:='QEMU'}
|
||||
: ${VM_NET_MAC:='82:cf:d0:5e:57:66'}
|
||||
: ${VM_NET_MAC:="${MAC}"}
|
||||
|
||||
: ${DHCP:='N'}
|
||||
: ${DNS_SERVERS:=''}
|
||||
: ${DNSMASQ_OPTS:=''}
|
||||
: ${DNSMASQ:='/usr/sbin/dnsmasq'}
|
||||
|
@ -28,11 +30,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 +41,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 +216,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
|
||||
|
||||
|
|
Loading…
Reference in a new issue