wsl: update
This commit is contained in:
parent
043f926541
commit
7d41f0ad81
@ -1,8 +1,30 @@
|
||||
## Force DNS Usage inside VPN
|
||||
|
||||
### SystemD
|
||||
### Bash script
|
||||
|
||||
```bash
|
||||
$ cat /bin/vpn-dns
|
||||
#!/bin/bash
|
||||
|
||||
echo "Getting current DNS servers, this takes a couple of seconds"
|
||||
|
||||
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command '
|
||||
$ErrorActionPreference="SilentlyContinue"
|
||||
Get-NetAdapter -InterfaceDescription "WireGuard Tunnel*" | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses
|
||||
Get-NetAdapter | ?{-not ($_.InterfaceDescription -like "WireGuard Tunnel*") } | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses
|
||||
' | \
|
||||
awk 'BEGIN { print "# Generated by vpn fix func on", strftime("%c"); print } { print "nameserver", $1 }' | \
|
||||
tr -d '\r' > /etc/resolv.conf
|
||||
clear
|
||||
```
|
||||
|
||||
### Configure Init
|
||||
|
||||
#### SystemD
|
||||
|
||||
Save file into /etc/systemd/system/vpn-dns.service with 755 permissions
|
||||
|
||||
```bash
|
||||
$ cat /etc/systemd/system/vpn-dns.service
|
||||
[Unit]
|
||||
Description=VPN DNS Configuration
|
||||
|
||||
@ -15,7 +37,9 @@ Environment=TERM=xterm
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
### OpenRC
|
||||
#### OpenRC
|
||||
|
||||
Save file into /etc/init.d/vpn-dn swith 755 permissions
|
||||
|
||||
```bash
|
||||
#!/sbin/openrc-run
|
||||
@ -48,21 +72,6 @@ stop() {
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cat /bin/vpn-dns
|
||||
#!/bin/bash
|
||||
|
||||
echo "Getting current DNS servers, this takes a couple of seconds"
|
||||
|
||||
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command '
|
||||
$ErrorActionPreference="SilentlyContinue"
|
||||
Get-NetAdapter -InterfaceDescription "WireGuard Tunnel*" | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses
|
||||
Get-NetAdapter | ?{-not ($_.InterfaceDescription -like "WireGuard Tunnel*") } | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses
|
||||
' | \
|
||||
awk 'BEGIN { print "# Generated by vpn fix func on", strftime("%c"); print } { print "nameserver", $1 }' | \
|
||||
tr -d '\r' > /etc/resolv.conf
|
||||
clear
|
||||
```
|
||||
### Show Networks
|
||||
|
||||
c/> Get-NetAdapter
|
||||
|
Loading…
x
Reference in New Issue
Block a user