You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+59-6Lines changed: 59 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ iproute2, and have at least version 229 of systemd, then it should work.
16
16
Nonetheless, if you do come across problems, fork and fix, or raise an issue.
17
17
All are most welcome.
18
18
19
-
# How to use?
19
+
##How to Enable
20
20
21
21
Make sure that you have `systemd-resolved` enabled and running:
22
22
@@ -29,22 +29,75 @@ Then update your `/etc/nsswitch.conf` file to look up DNS via the `resolve`
29
29
service:
30
30
31
31
```
32
-
# Use systemd-resolved first, then fall back to /etc/resolv.conf
33
-
hosts: files resolve dns myhostname
34
32
# Use /etc/resolv.conf first, then fall back to systemd-resolved
35
33
hosts: files dns resolve myhostname
34
+
# Use systemd-resolved first, then fall back to /etc/resolv.conf
35
+
hosts: files resolve dns myhostname
36
+
# Don't use /etc/resolv.conf at all
37
+
hosts: files resolve myhostname
36
38
```
37
39
40
+
*Note*: If you intend on using this script, the latter two are preferred
41
+
otherwise the configuration provided by this script will only work on domains
42
+
that cannot be resolved by the currently configured DNS servers (i.e. they must
43
+
fall back after trying the ones set by your LAN's DHCP server).
44
+
38
45
Finally, update your OpenVPN configuration file and set the `up` and `down-pre`
39
46
options:
40
47
41
48
```
42
49
script-security 2
50
+
setenv PATH /usr/bin
43
51
up /etc/openvpn/update-systemd-resolved
44
52
down-pre /etc/openvpn/update-systemd-resolved
45
53
```
46
54
47
-
# How to help
55
+
## Usage
56
+
57
+
`update-systemd-resolved` works by processing the `dhcp-option` commands set in
58
+
OpenVPN, either through the server, or the client, configuration:
59
+
60
+
| Option | Examples | Notes |
61
+
|--:|---|---|
62
+
|`DNS`|`0.0.0.0`<br />`::1`| This sets the DNS servers for the link and can take any IPv4 or IPv6 address. |
63
+
|`DOMAIN`|`example.com`| The primary domain for this host. If set multiple times, the last provided is used. Will be the primary search domain for bare hostnames. All requests for this domain as well will be routed to the `DNS` servers provided on this link. |
64
+
|`DOMAIN-SEARCH`|`example.com`| Secondary domains which will be used to search for bare hostnames (after any `DOMAIN`, if set) and in the order provided. All requests for this domain will be routed to the `DNS` servers provided on this link. |
65
+
|`DOMAIN-ROUTE`|`example.com`| All requests for these domains will be routed to the `DNS` servers provided on this link. They will *not* be used to search for bare hostnames, only routed. |
66
+
|`DNSSEC`|`yes`<br />`no`</br >`default`| Control of DNSSEC should be enabled (`yes`) or disabled (`no`) for any queries over this link only, or use the system default (`default`). |
67
+
68
+
*Note*: There are no local or system options to be configured. All configuration
69
+
for this script is handled though OpenVPN, including, for example, the name of
70
+
the interface to be configured.
71
+
72
+
### Example
73
+
74
+
```
75
+
push "dhcp-option DNS 10.62.3.2"
76
+
push "dhcp-option DNS 10.62.3.3"
77
+
push "dhcp-option DNS 2001:db8::a3:c15c:b56e:619a"
78
+
push "dhcp-option DNS 2001:db8::a3:ffec:f61c:2e06"
79
+
push "dhcp-option DOMAIN example.office"
80
+
push "dhcp-option DOMAIN-SEARCH example.com"
81
+
push "dhcp-option DOMAIN-ROUTE example.net"
82
+
push "dhcp-option DOMAIN-ROUTE example.org"
83
+
push "dhcp-option DNSSEC yes"
84
+
```
85
+
86
+
This, added to the OpenVPN server's configuration file will set two IPv4 DNS
87
+
servers and two IPv6 and will set the primary domain for the link to be
88
+
`example.office`. Therefore if you try to look up the bare address `mail` then
89
+
`mail.example.office` will be attempted first. The domain `example.com` is also
90
+
added as an additional search domain, so if `mail.example.office` fails, then
91
+
`mail.example.com` will be tried next.
92
+
93
+
Requests for `example.net` and `example.org` will also be routed though to the
94
+
four DNS servers listed too, but they will *not* be appended (i.e.
95
+
`mail.example.net` will not be attempted, nor `mail.example.org` if
96
+
`mail.example.office` or `mail.example.com` do not exist).
97
+
98
+
Finally, DNSSEC has been enabled for this link (and this link only).
99
+
100
+
## How to help
48
101
49
102
If you can help with any of these areas, or have bug fixes, please fork and
50
103
raise a Pull Request for me.
@@ -60,10 +113,10 @@ langauge.
60
113
TravisCI is enabled on this repository: Click the link at the top of this README
61
114
to see the current state of the code and its tests.
0 commit comments