From ebffe4e73883d832bc76ea69eab26ba63b1f07dd Mon Sep 17 00:00:00 2001
From: sspark <sspark@onioi.com>
Date: Tue, 17 Jan 2023 13:10:31 +0000
Subject: [PATCH] fix wireguard config

---
 README.md |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md
index 75d6b4c..676b875 100644
--- a/README.md
+++ b/README.md
@@ -166,6 +166,44 @@
 sudo wg show wg0
 ```
 
+/etc/wireguard/wg0.conf
+```
+[Interface]
+PrivateKey =  
+#Address = 10.8.0.2/24
+#DNS = 1.1.1.1
+#MTU = 1420
+
+[Peer]
+PublicKey =  
+PresharedKey =  
+AllowedIPs = 192.168.1.0/24, 10.8.0.0/24
+PersistentKeepalive = 30
+Endpoint = vp.onioi.com:51888
+```
+
+/etc/network/interfaces.d/wg0
+```
+# indicate that wg0 should be created when the system boots, and on ifup -a
+auto wg0
+
+# describe wg0 as an IPv4 interface with static address
+iface wg0 inet static
+
+        # the IP address of this client on the WireGuard network
+        address 10.8.0.2/24
+
+        # before ifup, create the device with this ip link command
+        pre-up ip link add $IFACE type wireguard
+
+        # before ifup, set the WireGuard config from earlier
+        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf
+
+        # after ifdown, destroy the wg0 interface
+        post-down ip link del $IFACE
+```
+
+
 ### update gateway ###
 
 ```

--
Gitblit v1.9.3