about summary refs log tree commit diff
path: root/nixos/modules/virtualisation/xen-dom0.nix
diff options
context:
space:
mode:
authorMichał Pałka <michal.palka@chalmers.se>2017-04-30 06:50:28 +0000
committerMichał Pałka <michal.palka@chalmers.se>2017-05-04 08:48:03 +0000
commite7203cb03d981220354cb01216f283e176139c20 (patch)
tree4ab65272e7f82967ebc22b492ea5555bb3a39d86 /nixos/modules/virtualisation/xen-dom0.nix
parentf556d94527a4246c044586fa47904643b8c4a89d (diff)
xen service: Forward DNS queries from Xen guests
Provide the option forwardDns in virtualisation.xen.bridge, which
enables forwarding of DNS queries to the default resolver, allowing
outside internet access for the xen guests.
Diffstat (limited to 'nixos/modules/virtualisation/xen-dom0.nix')
-rw-r--r--nixos/modules/virtualisation/xen-dom0.nix18
1 files changed, 15 insertions, 3 deletions
diff --git a/nixos/modules/virtualisation/xen-dom0.nix b/nixos/modules/virtualisation/xen-dom0.nix
index 1f5b6bd1d8082..c4c3dd128920f 100644
--- a/nixos/modules/virtualisation/xen-dom0.nix
+++ b/nixos/modules/virtualisation/xen-dom0.nix
@@ -100,6 +100,16 @@ in
             subnet.
           '';
         };
+
+        forwardDns = mkOption {
+          default = false;
+          description = ''
+            If set to <literal>true</literal>, the DNS queries from the
+            hosts connected to the bridge will be forwarded to the DNS
+            servers specified in /etc/resolv.conf .
+            '';
+        };
+
       };
 
     virtualisation.xen.stored =
@@ -339,7 +349,6 @@ in
         interface=${cfg.bridge.name}
         except-interface=lo
         bind-interfaces
-        auth-server=dns.xen.local,${cfg.bridge.name}
         auth-zone=xen.local,$XEN_BRIDGE_NETWORK_ADDRESS/${toString cfg.bridge.prefixLength}
         domain=xen.local
         addn-hosts=/var/run/xen/dnsmasq.hostsfile
@@ -347,8 +356,11 @@ in
         strict-order
         no-hosts
         bogus-priv
-        no-resolv
-        no-poll
+        ${optionalString (!cfg.bridge.forwardDns) ''
+          no-resolv
+          no-poll
+          auth-server=dns.xen.local,${cfg.bridge.name}
+        ''}
         filterwin2k
         clear-on-reload
         domain-needed