hivefans

euserv_ipv4

Apr 6th, 2021 (edited)
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.84 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ########来源 https://haoduck.com/794.html    https://haoduck.com/774.html
  4.  
  5. if [[ "$OSTYPE" == "linux-gnu" ]]; then
  6.     if [ -f /etc/redhat-release ]; then
  7.         cmd=yum
  8.         wireguard=wireguard-tools
  9.         $cmd install epel-release -y
  10.         #$cmd makecache
  11.     elif [ -f /etc/debian_version ]; then
  12.         cmd=apt-get
  13.         wireguard=wireguard
  14.         $cmd update
  15.         if [ "$(cat /etc/apt/sources.list|grep debian)" ]; then
  16.             echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list
  17.             printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
  18.         fi
  19.     fi
  20. else
  21.     echo -e "暂仅支持 Linux(Ubuntu/Debian) 系统\n其他系统可参考[https://haoduck.com/774.html]手动进行配置"
  22. fi
  23.  
  24. $cmd install wget $wireguard -y
  25. # wireguard-go
  26. wget https://git.haoduck.cf/github.com/peng4740/wireguard-go-builder/releases/download/0.0.20201118/wireguard-go-linux-amd64.tar.gz
  27. tar zxf wireguard-go-linux-amd64.tar.gz
  28. mv wireguard-go /usr/local/sbin
  29. rm -f wireguard-go-linux-amd64.tar.gz
  30. # wgcf
  31. wget https://git.haoduck.cf/github.com/ViRb3/wgcf/releases/download/v2.2.2/wgcf_2.2.2_linux_amd64 -O /usr/local/sbin/wgcf
  32. chmod +x /usr/local/sbin/wgcf
  33. echo|wgcf register
  34. wgcf generate
  35. sed -i '/\:\:\/0/d' wgcf-profile.conf
  36. mkdir -p /etc/wireguard
  37. cp -f wgcf-profile.conf /etc/wireguard/wgcf.conf
  38. # systemctl
  39. ln -s /usr/bin/resolvectl /usr/local/bin/resolvconf
  40. ln -sf /lib/systemd/system/systemd-resolved.service /etc/systemd/system/dbus-org.freedesktop.resolve1.service
  41. systemctl enable wg-quick@wgcf
  42. systemctl start wg-quick@wgcf
  43. echo -e "完成了,可以 ping 1.1.1.1 试试看了\n如果没出问题,这里应该能显示你的IP:$(wget -qO- ipv4.ip.sb) <=如果这里是空的,大概是失败了"
  44.  
  45.  
Add Comment
Please, Sign In to add comment