summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorPierre Langlois <pierre.langlois@gmx.com>2020-04-10 17:00:47 +0100
committer宋文武 <iyzsong@member.fsf.org>2020-05-02 13:00:24 +0800
commit5a0b78e62bc3122998990cea5ee17bdb2789aada (patch)
tree8f22dba0ee7cd0c8071efa1505bfccf642003dab /doc
parentf2531a254f7133b343034aa2c66fe14e518c45b8 (diff)
downloadguix-5a0b78e62bc3122998990cea5ee17bdb2789aada.tar.gz
services: dnsmasq: Support the --address flag.
Introduce a new `addresses' field that translates to passing `--address='
multiple times to dnsmasq.

* gnu/services/dns.scm (<dnsmasq-configuration>): Add an addresses field.
(dnsmasq-shepherd-service): Match the addresses field and translate it to
multiple '--address=' flags.
* doc/guix.texi (DNS Services): Document it.

Signed-off-by: 宋文武 <iyzsong@member.fsf.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index c571010bc8..d5d8662937 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -78,6 +78,7 @@ Copyright @copyright{} 2020 Jack Hill@*
 Copyright @copyright{} 2020 Naga Malleswari@*
 Copyright @copyright{} 2020 Brice Waegeneire@*
 Copyright @copyright{} 2020 R Veera Kumar@*
+Copyright @copyright{} 2020 Pierre Langlois@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -21874,6 +21875,25 @@ When true, don't read @var{resolv-file}.
 @item @code{servers} (default: @code{'()})
 Specify IP address of upstream servers directly.
 
+@item @code{addresses} (default: @code{'()})
+For each entry, specify an IP address to return for any host in the
+given domains.  Queries in the domains are never forwarded and always
+replied to with the specified IP address.
+
+This is useful for redirecting hosts locally, for example:
+
+@lisp
+(service dnsmasq-service-type
+         (dnsmasq-configuration
+           (addresses
+             '(; Redirect to a local web-server.
+               "/example.org/127.0.0.1"
+               ; Redirect subdomain to a specific IP.
+               "/subdomain.example.org/192.168.1.42"))))
+@end lisp
+
+Note that rules in @file{/etc/hosts} take precedence over this.
+
 @item @code{cache-size} (default: @code{150})
 Set the size of dnsmasq's cache.  Setting the cache size to zero
 disables caching.