aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx4
-rwxr-xr-xkvmx-create14
-rw-r--r--kvmxfile5
3 files changed, 18 insertions, 5 deletions
diff --git a/kvmx b/kvmx
index 70de333..9575ef9 100755
--- a/kvmx
+++ b/kvmx
@@ -416,6 +416,10 @@ function kvmx_up {
net_opts="tap,ifname=$tap,script=no,downscript=no,vlan=0,name=hostnet0 -device virtio-net-pci,vlan=0,id=net0,mac=$mac_address,bus=pci.0"
fi
+ if [ ! -z "$net_dns" ] && [ "$net_dns" != "host" ]; then
+ net_opts="$net_opts,dns=$net_dns"
+ fi
+
if [ -z "$spice" ] || [ "$spice" == "1" ]; then
spice_opts="-spice port=$PORT,addr=127.0.0.1,disable-ticketing,streaming-video=off,jpeg-wan-compression=never,playback-compression=off,zlib-glz-wan-compression=never,image-compression=off"
spice_opts="$spice_opts -device virtio-serial-pci"
diff --git a/kvmx-create b/kvmx-create
index a908663..56b08b6 100755
--- a/kvmx-create
+++ b/kvmx-create
@@ -364,10 +364,7 @@ EOF
# Second stage procedure
function __kvmx_create_custom_second_stage {
- if [ ! -z "$net_ip" ] && [ ! -z "$net_mask" ] && [ ! -z "$net_gateway" ] && [ -z "$net_dns" ]; then
- # DNS config
- echo "nameserver $net_dns" > $WORK/etc/resolv.conf
-
+ if [ ! -z "$net_ip" ] && [ ! -z "$net_mask" ] && [ ! -z "$net_gateway" ]; then
# Networking: eth0
cat <<-EOF | $SUDO tee $WORK/etc/network/interfaces.d/eth0 > /dev/null
auto eth0
@@ -403,6 +400,15 @@ iface ens3 inet dhcp
EOF
fi
+ # DNS config
+ if [ ! -z "$net_dns" ]; then
+ if [ "$net_dns" == "host" ]; then
+ cp /etc/resolv.conf $WORK/etc/resolv.conf
+ else
+ echo "nameserver $net_dns" > $WORK/etc/resolv.conf
+ fi
+ fi
+
# Locale
$APT_INSTALL locales
echo "LANG=$LANG" | $SUDO tee $WORK/etc/default/locale > /dev/null
diff --git a/kvmxfile b/kvmxfile
index 3247505..a15a1fb 100644
--- a/kvmxfile
+++ b/kvmxfile
@@ -15,12 +15,15 @@ password="`head -c 20 /dev/urandom | base64`"
#net="tap"
net="user"
+# DNS config
+#net_dns="192.168.1.1"
+#net_dns="host" # copy /etc/resolv.conf from host when creating the box
+
# Networking: tap config only
# This setting is used during virtual machine bootstrapping by kvmx-create.
#net_ip="10.1.1.2"
#net_mask="255.255.255.0"
#net_gateway="10.1.1.1"
-#net_dns="192.168.1.1"
# Set this is you want to be able to share a single folder between host and guest.
# Needs ssh_support set to "y" and a workable SSH connection to the guest.