mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
Allow MAC configuration through file
This commit is contained in:
parent
cd1cb3095c
commit
70138041b7
12
network.sh
12
network.sh
@ -2,8 +2,8 @@
|
||||
set -eu
|
||||
|
||||
: ${VM_NET_TAP:=''}
|
||||
: ${VM_NET_MAC:=''}
|
||||
: ${VM_NET_IP:='20.20.20.21'}
|
||||
: ${VM_NET_MAC:='00:11:32:2C:A7:85'}
|
||||
|
||||
: ${DNSMASQ:='/usr/sbin/dnsmasq'}
|
||||
: ${DNSMASQ_OPTS:=''}
|
||||
@ -61,6 +61,16 @@ if [ ! -c /dev/net/tun ]; then
|
||||
fi
|
||||
|
||||
[ ! -c /dev/net/tun ] && echo "Error: TUN network interface not available..." && exit 85
|
||||
[ ! -d "$IMG" ] && echo "Storage folder (${IMG}) not found!" && exit 86
|
||||
|
||||
#If environment variabele not set fall back to file
|
||||
if [ -z "$VM_NET_MAC" ]; then
|
||||
FILE="${IMG}/guest.mac"
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "00:11:32:2C:A7:85" > "$FILE"
|
||||
fi
|
||||
VM_NET_MAC=$(cat "${FILE}")
|
||||
fi
|
||||
|
||||
update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null
|
||||
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null
|
||||
|
Loading…
x
Reference in New Issue
Block a user