diff --git a/README.md b/README.md
index 0e94a5d8bf1f405a78c5d8233f50b5bb83db7fcd..1dd84fbc4dfd1f3ec4e5acdd4693d0af189e09c4 100644
--- a/README.md
+++ b/README.md
@@ -35,8 +35,8 @@ The dnsname plugin can be enabled in the cni network configuration file.
 
 ## DNSMasq configuration files
 The dnsmasq service and its configuration files are considered to be very fluid and are not meant to survive a system
-reboot.  Therefore, files are stored in `/run/containers/cni/dnsname`. The plugin knows to recreate the necessary
-files if it detects they are not present.
+reboot.  Therefore, files are stored in `/run/containers/cni/dnsname`, or under `$XDG_RUNTIME_DIR/containers/cni/dnsname` if
+`XDG_RUNTIME_DIR` is specified.  The plugin knows to recreate the necessary files if it detects they are not present.
 
 ##  DNSMasq default configuration
 Much like the implementation of DNSMasq for libvirt, this plugin will only set up dnsmasq to listen on the network
diff --git a/plugins/meta/dnsname/config.go b/plugins/meta/dnsname/config.go
index 9c1039bf01d2500db83b5346da5b07771af3d27d..f8fda57e489b138cf4815ca56606c9e109aa7168 100644
--- a/plugins/meta/dnsname/config.go
+++ b/plugins/meta/dnsname/config.go
@@ -2,13 +2,13 @@ package main
 
 import (
 	"errors"
+	"os"
+	"path/filepath"
 
 	"github.com/containernetworking/cni/pkg/types"
 )
 
 const (
-	//	dnsNameConfPath is where we store the conf, pid, and hosts files
-	dnsNameConfPath = "/run/containers/cni/dnsname"
 	// confFileName is the name of the dns masq conf file
 	confFileName = "dnsmasq.conf"
 	// hostsFileName is the name of the addnhosts file
@@ -53,3 +53,12 @@ type dnsNameFile struct {
 	NetworkInterface string
 	PidFile          string
 }
+
+// dnsNameConfPath tells where we store the conf, pid, and hosts files
+func dnsNameConfPath() string {
+	xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR")
+	if xdgRuntimeDir != "" {
+		return filepath.Join(xdgRuntimeDir, "containers/cni/dnsname")
+	}
+	return "/run/containers/cni/dnsname"
+}
diff --git a/plugins/meta/dnsname/main.go b/plugins/meta/dnsname/main.go
index 114b16b6bdeee8a2628ed155564abf9ae20bfd63..271d495d5865c592bead9020c57cd0f1f9625a98 100644
--- a/plugins/meta/dnsname/main.go
+++ b/plugins/meta/dnsname/main.go
@@ -193,7 +193,7 @@ func cmdCheck(args *skel.CmdArgs) error {
 		return errors.Errorf("dnsmasq instance not running")
 	}
 	// Above will make sure the pidfile exists
-	files, err := ioutil.ReadDir(dnsNameConfPath)
+	files, err := ioutil.ReadDir(dnsNameConfPath())
 	if err != nil {
 		return err
 	}
diff --git a/plugins/meta/dnsname/service.go b/plugins/meta/dnsname/service.go
index c4b8b0f5f741e6e443585295f0d62d8d533a7358..717d6c0c8c623c6f68ba633f3fe890a1788fe6b2 100644
--- a/plugins/meta/dnsname/service.go
+++ b/plugins/meta/dnsname/service.go
@@ -96,5 +96,5 @@ func (d dnsNameFile) getProcess() (*os.Process, error) {
 func makePath(networkName, fileName string) string {
 	// the generic path for where conf, host, pid files are kept is:
 	// /run/containers/cni/dnsmasq/<network-name>/
-	return filepath.Join(dnsNameConfPath, networkName, fileName)
+	return filepath.Join(dnsNameConfPath(), networkName, fileName)
 }