This commit is contained in:
Kroese 2023-05-13 06:06:32 +02:00 committed by GitHub
parent a321726bbc
commit 86d107e363

View File

@ -109,6 +109,11 @@ configureNAT () {
fi fi
fi fi
NET_OPTS="-netdev tap,ifname=${VM_NET_TAP},script=no,downscript=no,id=hostnet0"
{ exec 40>>/dev/vhost-net; rc=$?; } 2>/dev/null || :
(( rc == 0 )) && NET_OPTS="$NET_OPTS,vhost=on,vhostfd=40"
# dnsmasq configuration: # dnsmasq configuration:
DNSMASQ_OPTS="$DNSMASQ_OPTS --dhcp-range=$VM_NET_IP,$VM_NET_IP --dhcp-host=$VM_NET_MAC,,$VM_NET_IP,$VM_NET_HOST,infinite --dhcp-option=option:netmask,255.255.255.0" DNSMASQ_OPTS="$DNSMASQ_OPTS --dhcp-range=$VM_NET_IP,$VM_NET_IP --dhcp-host=$VM_NET_MAC,,$VM_NET_IP,$VM_NET_HOST,infinite --dhcp-option=option:netmask,255.255.255.0"
@ -116,11 +121,6 @@ configureNAT () {
echo "0 $VM_NET_MAC $VM_NET_IP $VM_NET_HOST 01:${VM_NET_MAC}" > /var/lib/misc/dnsmasq.leases echo "0 $VM_NET_MAC $VM_NET_IP $VM_NET_HOST 01:${VM_NET_MAC}" > /var/lib/misc/dnsmasq.leases
chmod 644 /var/lib/misc/dnsmasq.leases chmod 644 /var/lib/misc/dnsmasq.leases
NET_OPTS="-netdev tap,ifname=${VM_NET_TAP},script=no,downscript=no,id=hostnet0"
{ exec 40>>/dev/vhost-net; rc=$?; } 2>/dev/null || :
(( rc == 0 )) && NET_OPTS="$NET_OPTS,vhost=on,vhostfd=40"
# Build DNS options from container /etc/resolv.conf # Build DNS options from container /etc/resolv.conf
if [[ "${DEBUG}" == [Yy1]* ]]; then if [[ "${DEBUG}" == [Yy1]* ]]; then
@ -196,8 +196,7 @@ fi
if [[ "${DHCP}" == [Yy1]* ]]; then if [[ "${DHCP}" == [Yy1]* ]]; then
if [[ "$GATEWAY" == "172."* ]]; then if [[ "$GATEWAY" == "172."* ]]; then
error "You cannot enable DHCP while the container is " error "You can only enable DHCP while the container is on a macvlan network!" && exit 86
error "in a bridge network, only on a macvlan network!" && exit 86
fi fi
# Configuration for DHCP IP # Configuration for DHCP IP