add 2 more devices to wireguard
This commit is contained in:
parent
424d9e4224
commit
60422a1900
2 changed files with 52 additions and 0 deletions
42
scripts/wireguard-client.sh
Normal file
42
scripts/wireguard-client.sh
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Create a new wireguard client
|
||||
|
||||
client_name="ipad tina"
|
||||
client_ip=10.100.0.9
|
||||
private_key=$( wg genkey )
|
||||
public_key=$( echo "$private_key" | wg pubkey )
|
||||
|
||||
cat <<EOF > client.conf
|
||||
[Interface]
|
||||
Address = ${client_ip}/32
|
||||
MTU = 1280
|
||||
ListenPort = 51820
|
||||
PrivateKey = ${private_key}
|
||||
|
||||
[Peer]
|
||||
PublicKey = uWR93xJe5oEbX3DsAYpOS9CuSg1VmXEQxJzdlJpe3DU=
|
||||
Endpoint = ingolf-wagner.de:51820
|
||||
AllowedIPs = 10.100.0.1/24
|
||||
EOF
|
||||
|
||||
cat <<EOF
|
||||
## nixos configuration:
|
||||
|
||||
{
|
||||
# ${client_name}
|
||||
publicKey = "${public_key}";
|
||||
allowedIPs = [ "${client_ip}/32" ];
|
||||
}
|
||||
|
||||
## client configuration
|
||||
|
||||
is in ./client.conf
|
||||
|
||||
### QR Code
|
||||
|
||||
for quick configuration
|
||||
|
||||
EOF
|
||||
|
||||
qrencode -t ansiutf8 < client.conf
|
Loading…
Add table
Add a link
Reference in a new issue