Skip to content

Commit 22a4071

Browse files
authored
Create README.md
1 parent 6f581fe commit 22a4071

File tree

1 file changed

+203
-0
lines changed

1 file changed

+203
-0
lines changed

README.md

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# Wireguard-VPN-server-client-setup : راه اندازی سرور وی پی ان وایرگارد.
2+
3+
###### وی پی ان شخصی با آی پی ثابت
4+
###### برای اینکار بهتره از سرور دبین استفاده کنید، روی باقی توزیع های لینوکسها هم جواب میده ولی خب سازگاری بهتری با دبین داره.
5+
###### درصورتی که درحالت روت هستید نیازی نیست از سودو استفاده کنید.
6+
7+
###### لینک ویدیو :
8+
```
9+
https://youtu.be/Fp0zazxtaIs
10+
```
11+
12+
###### خرید دامنه از نیم چیپ:
13+
```
14+
https://namecheap.pxf.io/BX7m6W
15+
```
16+
###### خرید دامنه سایت ایرانی:
17+
```
18+
https://www.hub.shatelhost.com/aff.php?aff=290
19+
```
20+
###### خرید سرور از دیجیتال اوشن :
21+
```
22+
https://m.do.co/c/0fb522deafa4
23+
```
24+
###### خرید سرور از سایت ایرانی :
25+
```
26+
https://berbidserver.com/portal/aff.php?aff=53
27+
```
28+
###### خرید سرور از سایت ایرانی :
29+
```
30+
https://dashboard.azaronline.com/order/?aff=790
31+
```
32+
33+
**If you think this project is helpful to you, you may wish to give a** 🌟
34+
35+
**Feel Free To Donation :** ❤️
36+
37+
>TRC20: ```TGTyqv2MH7dZztMvaP5PKuS9Bma8RY5Pk8```
38+
39+
>ETH: ```0x5b5202a54e5ce4fb25f0d886254eeb07bb088614```
40+
41+
#### EU-SERVER
42+
43+
###### Add REP. اضافه کردن ریپازتوری
44+
```
45+
echo 'deb http://ftp.debian.org/debian buster-backports main' | sudo tee /etc/apt/sources.list.d/buster-backports.list
46+
```
47+
48+
###### Update server and Wirguard instalation. آپدیت سرور و نصب وایرکارد
49+
```
50+
sudo apt update
51+
```
52+
```
53+
sudo apt install wireguard
54+
```
55+
```
56+
sudo apt install iptables
57+
```
58+
59+
###### Generate Private and Public keys. ساخت کلید عمومی و خصوصی سرور
60+
```
61+
wg genkey | sudo tee /etc/wireguard/privatekey | wg pubkey | sudo tee /etc/wireguard/publickey
62+
```
63+
###### Find Privarekey. دیدن کلید خصوصی
64+
```
65+
cat privatekey
66+
```
67+
68+
###### Create Server Configuration. ساخت فایل کانفیگ سرور
69+
```
70+
sudo nano /etc/wireguard/wg0.conf
71+
```
72+
###### Paste following to the file. کدها مورد نیاز کانفیگ
73+
```
74+
[Interface]
75+
Address = 10.0.0.1/24
76+
SaveConfig = true
77+
ListenPort = 51820
78+
PrivateKey = SERVER_PRIVATE_KEY
79+
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
80+
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
81+
```
82+
###### Save the File (in Nano editore use Ctrl+x)
83+
###### اگه کنجکاوید بدونید چی میشه این کدارو ران کنید.
84+
###### در غیر اینصورت برید به [فوروارد IPV4](https://github.com/pouramin/Wireguard-VPN-server-client-setup/new/main?readme=1#allow-ipv4-forward-%D9%81%D9%88%D8%B1%D9%88%D8%A7%D8%B1%D8%AF-%D8%A2%DB%8C%D9%BE%DB%8C-%D9%88%D8%B1%DA%98%D9%86-4)
85+
###### Start the wg config.
86+
```
87+
sudo wg-quick up wg0
88+
```
89+
###### Output should be:
90+
```
91+
[#] ip link add wg0 type wireguard
92+
[#] wg setconf wg0 /dev/fd/63
93+
[#] ip -4 address add 10.0.0.1/24 dev wg0
94+
[#] ip link set mtu 1420 up dev wg0
95+
[#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
96+
```
97+
###### See more details:
98+
```
99+
sudo wg show
100+
interface: wg0
101+
public key: +Vpyku+gjVJuXGR/OXXt6cmBKPdc06Qnm3hpRhMBtxs=
102+
private key: (hidden)
103+
listening port: 51820
104+
```
105+
106+
###### See the ip for the vpn.
107+
```
108+
ip a show wg0
109+
```
110+
```
111+
4: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN
112+
group default qlen 1000
113+
link/none
114+
inet 10.0.0.1/24 scope global wg0
115+
valid_lft forever preferred_lft forever
116+
```
117+
118+
###### Allow ipv4 forward. فوروارد آیپی ورژن 4
119+
```
120+
sysctl net.ipv4.ip_forward=1
121+
```
122+
123+
###### Enable to start with system. استارت آپ وایرگارد
124+
```
125+
sudo systemctl enable wg-quick@wg0
126+
```
127+
128+
###### Server publickey. دیدن کلید عمومی سرور
129+
```
130+
cat publickey
131+
```
132+
133+
###### Create client config. ساخت یوزر
134+
```
135+
nano /etc/wireguard/wg1.conf
136+
```
137+
138+
###### Paste the following to the file. کدهای مورد نیاز ساخت یوزر
139+
```
140+
#Change the lines to your keys and ip addr!
141+
[Interface]
142+
PrivateKey = CLIENT_PRIVATE_KEY
143+
Address = 10.0.0.2/24
144+
DNS = 1.1.1.1, 8.8.8.8
145+
[Peer]
146+
PublicKey = SERVER_PUBLIC_KEY
147+
Endpoint = SERVER_IP_ADDRESS:51820
148+
AllowedIPs = 0.0.0.0/0
149+
```
150+
151+
###### Save the file and add the client public key with following command. اضافه کردن یوزر به کانفیگ
152+
```
153+
sudo wg set wg0 peer CLIENT_PUBLIC_KEY allowed-ips 10.0.0.2
154+
```
155+
```
156+
Watch wg show
157+
```
158+
159+
###### Connect to the vpn from PC/Phone
160+
161+
###### TO export the config to a qr-code install the following. ساخت کیو آر کد برای یوزر
162+
163+
```
164+
sudo apt install qrencode
165+
cd /etc/wireguard/
166+
```
167+
###### then use the command (You need to be in the same dir as the conf file /etc/wireguard)
168+
```
169+
qrencode -t ansiutf8 < wg1.conf
170+
```
171+
172+
###### Scan the QR code from your phone.
173+
174+
175+
###### Softs. نرم افزارها
176+
177+
178+
###### WinSCP. نرم افزار دیدن فایلای لینوکس
179+
```
180+
https://soft98.ir/internet/ftp-tools/748-winscp.html
181+
```
182+
183+
###### WireGuard Soft. نرم افزار وایرگارد برای دیوایس های مختلف
184+
185+
###### Win 32. ویندوز 32 بیتی
186+
```
187+
https://www.uplooder.net/files/be3aae21a20551904422ee1a170747ec/wire32.zip.html
188+
```
189+
190+
###### win 64. ویندوز 64 بیتی
191+
```
192+
https://www.uplooder.net/files/6ed0a416f8d537332c710a5664e889dd/wire64.zip.html
193+
```
194+
195+
###### Android. اندروید
196+
```
197+
https://www.uplooder.net/files/8a52533bbf7bec80224b2f8955795273/android.zip.html
198+
```
199+
200+
###### IOS-Mac. آیفون و مک
201+
```
202+
https://www.uplooder.net/files/37a0e4fc0e7d0404595ca31591ddfb66/IOS-Mac.zip.html
203+
```

0 commit comments

Comments
 (0)