diff --git a/weavedns/README.md b/weavedns/README.md index 83576f7c..1eb8b262 100644 --- a/weavedns/README.md +++ b/weavedns/README.md @@ -134,6 +134,21 @@ that you can use unqualified hostnames. Use `--dns-search=.` to make the resolver use the container's domain, or e.g., `--dns-search=weave.local` to make it look in `weave.local`. +### Using a different local domain + +By default, WeaveDNS uses `weave.local.` as the domain for names on the +Weave network. In general users do not need to change this domain, but you +can force WeaveDNS to use a different domain by launching it +with the `--domain` argument. For example, + +```bash +$ weave launch-dns 10.2.254.1/24 --domain="mycompany.local." +``` + +The local domain should end with `local.`, since these names are +link-local as per [RFC6762](https://tools.ietf.org/html/rfc6762), +(though this is not strictly neccessary). + ### Adding containers to DNS If DNS is started after you've attached a container to the weave diff --git a/weavedns/main.go b/weavedns/main.go index 476282b8..b7ae993a 100644 --- a/weavedns/main.go +++ b/weavedns/main.go @@ -21,7 +21,7 @@ func main() { justVersion bool ifaceName string apiPath string - localDomain string + domain string dnsPort int httpPort int wait int @@ -36,7 +36,7 @@ func main() { flag.BoolVar(&justVersion, "version", false, "print version and exit") flag.StringVar(&ifaceName, "iface", "", "name of interface to use for multicast") flag.StringVar(&apiPath, "api", "unix:///var/run/docker.sock", "path to Docker API socket") - flag.StringVar(&localDomain, "localDomain", weavedns.DefaultLocalDomain, "local domain (ie, 'weave.local.')") + flag.StringVar(&domain, "domain", weavedns.DefaultLocalDomain, "local domain (ie, 'weave.local.')") flag.IntVar(&wait, "wait", 0, "number of seconds to wait for interface to be created and come up") flag.IntVar(&dnsPort, "dnsport", weavedns.DefaultServerPort, "port to listen to DNS requests") flag.IntVar(&httpPort, "httpport", 6785, "port to listen to HTTP requests") @@ -79,7 +79,7 @@ func main() { srvConfig := weavedns.DNSServerConfig{ Port: dnsPort, CacheLen: cacheLen, - LocalDomain: localDomain, + LocalDomain: domain, Timeout: timeout, UDPBufLen: udpbuf, } @@ -93,7 +93,7 @@ func main() { Debug.Printf("Starting the signals handler") go handleSignals(srv) - go weavedns.ListenHTTP(version, srv, localDomain, zone, httpPort) + go weavedns.ListenHTTP(version, srv, domain, zone, httpPort) err = srv.Start() if err != nil { Error.Fatal("Failed to start the WeaveDNS server", err)