wsl: update
This commit is contained in:
parent
a1db584b8f
commit
32190623ef
@ -1,5 +1,6 @@
|
|||||||
## Force DNS Usage inside VPN
|
## Force DNS Usage inside VPN
|
||||||
|
|
||||||
|
### SystemD
|
||||||
```bash
|
```bash
|
||||||
$ cat /etc/systemd/system/vpn-dns.service
|
$ cat /etc/systemd/system/vpn-dns.service
|
||||||
[Unit]
|
[Unit]
|
||||||
@ -7,15 +8,48 @@ Description=VPN DNS Configuration
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/vpn-dns.sh
|
ExecStart=/bin/vpn-dns
|
||||||
Environment=TERM=xterm
|
Environment=TERM=xterm
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### OpenRC
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ cat /bin/vpn-dns.sh
|
#!/sbin/openrc-run
|
||||||
|
# Distributed under the terms of the GNU General Public License v3 or later
|
||||||
|
name="vpn-dns"
|
||||||
|
description="VPN DNS Configuration"
|
||||||
|
pidfile="/var/run/vpn-dns.pid"
|
||||||
|
command="/bin/vpn-dns"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
use net
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Starting ${name}"
|
||||||
|
start-stop-daemon --start --exec "${command}" --pidfile "${pidfile}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Reloading ${name}"
|
||||||
|
start-stop-daemon --signal HUP --pidfile "${pidfile}"
|
||||||
|
eend $?
|
||||||
|
}+
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping ${name}"
|
||||||
|
start-stop-daemon --quiet --stop --exec "${command}" --pidfile "${pidfile}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat /bin/vpn-dns
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Getting current DNS servers, this takes a couple of seconds"
|
echo "Getting current DNS servers, this takes a couple of seconds"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user