Hướng dẫn tự thiết lập VPN cá nhân chỉ với 1 dòng lệnh cài đặt WireGuard VPN

Dưới đây là hướng dẫn cài đặt Wireguard VPN Server trên VPS cực kỳ đơn giản chỉ với 1 dòng lệnh. Script cài đặt tự động được tạo ra bởi Nyr trên Github, thay thế cho rất nhiều bước phức tạp nếu làm heo như hướng dẫn của UpCloud.

Cài đặt WireGuard VPN Server
Đầu tiên, bạn cần phải có sẵn 1 VPS với quyền truy cập root. Bạn có thể đăng ký 1 VPS mới Hetzner, UpCloud hay DigitalOcean tuỳ thích. Hoặc sử dụng bất kỳ VPS nào bạn đang có sẵn.

Tiếp theo SSH vào VPS với tài khoản root và cài đặt Wireguard VPN với lệnh sau.

wget https://git.io/wireguard -O wireguard-install.sh && bash wireguard-install.sh


Nếu VPS / Server của bạn có nhiều IP mạng, nhớ chọn IP Public của VPS.

Which IPv4 address should be used?
1) 5.196.89.40
2) 172.17.0.1
IPv4 address [1]: 1


Tiếp theo nhập thông tin theo yêu cầu của script cài đặt.

Chọn port, bấm Enter để giữ nguyên port mặc định 51820

What port should WireGuard listen to?
Port [51820]:

Chọn tên

Enter a name for the first client:
Name [client]: thuanbui

Chọn DNS Server

Select a DNS server for the client:
1) Current system resolvers
2) Google
3) 1.1.1.1
4) OpenDNS
5) Quad9
6) AdGuard
DNS server [1]: 2
WireGuard installation is ready to begin.
Press any key to continue…

Bấm nút bất kỳ để tiếp tục

Đơi khoảng vài phút cho script cài đặt và cấu hình Wireguard VPN tự động cho bạn. Sau khi hoàn tất, bạn sẽ nhận được thông báo như sau.

[QR Code]  
That is a QR code containing the client configuration.
The client configuration is available in: /root/thuanbui.conf
New clients can be added by running this script again.

Tạo thêm tài khoản client

Bạn có thể chạy lại lệnh cài đặt thêm lần nữa để tạo thêm nhiều tài khoản mới.

wget https://git.io/wireguard -O wireguard-install.sh && bash wireguard-install.sh

Hệ thống sẽ tự động nhận ra WireGuard đã được cài đặt và hiện thông báo như dưới đây. Chọn 1 để tạo thêm client mới, 2 để xoá client hiện có, 3 để xoá WireGuard và 4 để thoát ra

WireGuard is already installed.

Select an option:
   1) Add a new client
   2) Remove an existing client
   3) Remove WireGuard
   4) Exit
Option: 

Để xem lại QR Code của tài khoản đã tạo bạn dùng lệnh sau

qrencode -t UTF8 < thuanbui.conf

Nhớ thay thế thuanbu.conf bằng tên file tương ứng với tài khoản bạn đã tạo trước đó. File này được lưu ở thư mục /root

Cài đặt WireGuard Client

Để kết nối với Wireguard Server vừa tạo, bạn cần tải Wireguard Client trên thiết bị cần sử dụng. Wireguard cung cấp client cho mọi hệ điều hành phỏo biến: iOS, Android, Windows, Linux, Mac OS,… Bạn có thể tham khảo hướng dẫn chi tiết ở đây: WireGuard install.

Nhanh gọn lẹ nhất là cài WireGuard client trên iOS / Android thông qua App Store / Play Store. Sau đó bạn thêm cấu hình WireGuard bằng cách chọn Create from QR Code và scan QR Code nhận được ở bước cài đặt trên. Vậy là xong.

Nếu cài đặt client trên Windows / Linux / MacOS, bạn cần mở file cấu hình vừa tạo ở trên. Chú ý đổi thuanbui thành tên client bạn tạo ở bước cài đặt ban đầu

nano /root/thuanbui.conf

Copy lại toàn bộ nội dung bên trong và paste vào mục cấu hình trên máy client tương ứng

[Interface]
Address = x.x.x.x/24
DNS = 8.8.8.8, 8.8.4.4
PrivateKey = iPp8KmZQzsxxxxxxxxxxxxxxxxxxxxxz9X0OO8ED0A=

[Peer]
PublicKey = 4SJMlcxxxxxxxxxxxxxxxxxxxxxxxxxxxxf2s9nzM=
PresharedKey = dtZgt7SEElxxxxxxxxxxxxxxxxxxxxxxxxxxxe0qICQ6N2w=
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = x.x.x.xx:51820
PersistentKeepalive = 25

Vậy là xong! Bạn đã có 1 VPN có thể sẵn sàng phục vụ để vượt tường lừa, vượt qua những tháng ngày “cá mập cắn cáp”

Chúc bạn cài đặt thành công!

Theo ThuanBui.Me

Related Posts

Những Bức Ảnh Nhìn Có Vẻ Bình Thường Nhưng Lại Ẩn Chứa Những Sự Thật Đáng Sợ

Thông thường, mọi người dùng những bức ảnh để ghi lại khoảnh khắc và kỉ niệm đẹp trong cuộc đời mình. Nhưng bên cạnh những sự kiện…

AI nguy hiểm thế nào: Elon Musk và hơn 1.000 tinh hoa công nghệ yêu cầu dừng phát triển, chính ‘cha đẻ’ còn lên tiếng cảnh báo hiểm họa

Công cuộc phát triển AI cần chậm lại. Đồng sáng lập Apple Steve Wozniak, Elon Musk cùng hơn 1.000 nhà lãnh đạo doanh nghiệp vừa ký một…

This Post Has 102 Comments

    1. An impressive share! I’ve just forwarded this onto a colleague who had
      been doing a little research on this. And he actually bought me breakfast simply because I
      stumbled upon it for him… lol. So allow me to
      reword this…. Thank YOU for the meal!! But yeah, thanx for spending
      time to talk about this topic here on your web page.

    1. We are a group of volunteers and starting a new scheme in our
      community. Your website provided us with valuable information to
      work on. You’ve done a formidable job and our entire
      community will be thankful to you.

  1. That analysis of team comps is spot on! Seeing more strategic diversity would be awesome. Plus, platforms like jlboss com are really raising the bar for player experience – smooth logins & quick access matter! Great read.

  2. How can I help you? This is a job advertisement for a live chat customer support assistant. Your job will be to respond to live chat messages from customers on a business’s website and help them with their support questions. Most questions are about shipping rates, return policies and what types of items are in stock, etc. Don’t worry if you have not done this type of work before, this is an entry-level position and full training is provided. Check it out here : http://chat-assistant.advertising4you.co.uk to complete your application if you are interested.

  3. I just like the valuable information you supply for your articles. I’ll bookmark your blog and test once more right here frequently. I am quite certain I’ll learn many new stuff proper right here! Good luck for the next!

  4. Hey! I know this is somewhat off topic but I was wondering if you knew
    where I could find a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having trouble finding
    one? Thanks a lot!

  5. Greetings from Florida! I’m bored to death at work
    so I decided to check out your blog on my iphone
    during lunch break. I really like the info you provide here and can’t wait to take a look when I get home.
    I’m amazed at how quick your blog loaded on my phone .. I’m
    not even using WIFI, just 3G .. Anyways, very good blog!

Leave a Reply to 📠 📥 Account Alert: 0.33 Bitcoin pending. Complete transfer => https://graph.org/ACCESS-CRYPTO-REWARDS-07-23?hs=cdd5e2a5b55f9d58801e864017074a53& 📠 Cancel reply

Your email address will not be published. Required fields are marked *