Cài đặt Wireguard trên Debian

https://nfalcone.net/blog/wireguard-vpn-debian-server/

https://unix.stackexchange.com/questions/543601/failed-to-update-linux-headers-on-debian-stretch-debian-9

Bản nháp:

Để cài đặt Wireguard trên Linux thông thường có 2 cách;

1 Tự build file cài đặt từ mã nguồn 2 Sử dụng file đã biên dịch sẵn có ở repo Debian (nằm trong repo unstable)

6 echo “deb http://deb.debian.org/debian/ unstable main” | sudo tee /etc/apt/sources.list.d/unstable.list 7 echo “deb http://deb.debian.org/debian/ unstable main” | tee /etc/apt/sources.list.d/unstable.list 8 echo -e “Package: *\nPin: release a=unstable\nPin-Priority: 150\n” | tee /etc/apt/preferences.d/limit-unstable sudo apt update sudo apt install wireguard lsmod | grep wireguard 32 sudo nano /etc/sysctl.conf 33 sudo sysctl -p 34 ip l 35 mkdir /etc/wireguard/ 36 cd /etc/wireguard/ 37 apt install wireguard-dkms wireguard-tools 38 lsmod | grep wireguard 39 apt install linux-headers-$(uname -r) 40 wg-quick up wg0 41 apt-get install wireguard-dkms wireguard-tools linux-headers-$(uname -r) 42 nano /etc/apt/sources.list.d/snapshot.list 43 apt -o Acquire::Check-Valid-Until=false update 44 apt install linux-headers-4.9.0-3-amd64 45 apt install linux-headers-$(uname -r) 46 lsmod | grep wireguard 47 wg-quick up wg0 48 apt-get install linux-headers-$(uname -r) 49 apt install linux-headers-4.9.0-3-amd64 50 apt install linux-headers-4.9.0-4-amd64 51 cd 52 modprobe wireguard && lsmod | grep wireguard 54 modprobe wireguard 55 apt-get install libmnl-dev libelf-dev linux-headers-$(uname -r) build-essential pkg-config 56 dpkg-reconfigure wireguard-dkms 57 modprobe wireguard 58 apt-get install linux-headers libmnl-dev linux-headers-$(uname -r) build-essential make git 59 nano /etc/apt/sources.list.d/snapshot.list 60 apt -o Acquire::Check-Valid-Until=false update 61 apt install linux-headers-$(uname -r) 62 modprobe wireguard 63 lsmod | grep wireguard 64 wg-quick up wg0 65 chmod 600 /etc/wireguard/wg0.conf 66 wg 67 sysctl -p