Przeglądaj źródła

安装配置细节调整

hongwenjun 6 lat temu
rodzic
commit
deaca19f94
5 zmienionych plików z 51 dodań i 33 usunięć
  1. 21 13
      Wireguard/wg5clients.sh
  2. 3 3
      autoBestTrace.sh
  3. 7 7
      centos7_wireguard_install.sh
  4. 1 1
      netlog.sh
  5. 19 9
      vps.sh

+ 21 - 13
Wireguard/wg5clients.sh

@@ -1,11 +1,13 @@
 #!/bin/bash
-#    WireGuard VPN多用户服务端  自动配置脚本
+# WireGuard VPN多用户服务端 自动配置脚本 支持IPV6
 
-#    本脚本(WireGuard 多用户配置)一键安装短网址
-#    wget -qO- https://git.io/fpnQt | bash
+# 本脚本(WireGuard 多用户配置)一键安装短网址
+# wget -qO- https://git.io/fpnQt | bash
+# 使用url调用脚本, 或者下载脚本使用, 可以指定端口数
+# bash <(curl -L -s https://git.io/fpnQt) 9999
 #############################################################
-# 定义修改端口号,适合已经安装WireGuard而不想改端口
-port=9999
+
+let port=$RANDOM/2+9999
 mtu=1420
 ip_list=(2 5 8 178 186 118 158 198 168 9)
 ipv6_range="fd08:620c:4df0:65eb::"
@@ -27,10 +29,18 @@ wget -qO- git.io/fhExJ | bash
 EOF
 }
 #############################################################
-#定义文字颜色
+
+if [[ $# > 0 ]]; then
+    num="$1"
+    if [[ ${num} -ge 100 ]] && [[ ${num} -le 60000 ]]; then
+       port=$num
+    fi
+fi
+
+# 定义文字颜色
 Green="\033[32m"  && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m" && Font="\033[0m"
 
-#定义提示信息
+# 定义提示信息
 Info="${Green}[信息]${Font}"  &&  OK="${Green}[OK]${Font}"  &&  Error="${Red}[错误]${Font}"
 
 # 检查是否安装 WireGuard
@@ -49,7 +59,6 @@ if [ ! -f '/usr/bin/curl' ]; then
     apt update && apt install -y curl
 fi
 
-
 if [ ! -e '/var/ip_addr' ]; then
    echo -n $(curl -4 ip.sb) > /var/ip_addr
 fi
@@ -61,7 +70,7 @@ if [ ! -f '/usr/bin/qrencode' ]; then
 fi
 
 # 安装 bash wgmtu 脚本用来设置服务器
-wget -O ~/wgmtu  https://raw.githubusercontent.com/hongwenjun/vps_setup/master/Wireguard/wgmtu.sh
+wget -O ~/wgmtu  https://git.io/wgmtu 
 #############################################################
 
 # 打开ip4/ipv6防火墙转发功能
@@ -78,7 +87,6 @@ sysctl_config() {
 }
 sysctl_config
 
-
 # wg配置文件目录 /etc/wireguard
 mkdir -p /etc/wireguard
 chmod 777 -R /etc/wireguard
@@ -153,7 +161,7 @@ EOF
     cat /etc/wireguard/wg_${host}_$i.conf | qrencode -o wg_${host}_$i.png
 done
 
-#  vps网卡如果不是eth0,修改成实际网卡
+# vps网卡如果不是eth0,修改成实际网卡
 ni=$(ls /sys/class/net | awk {print} | grep -e eth. -e ens. -e venet.)
 if [ $ni != "eth0" ]; then
     sed -i "s/eth0/${ni}/g"  /etc/wireguard/wg0.conf
@@ -184,8 +192,8 @@ echo -e "${RedBG}   一键安装 WireGuard 脚本 For Debian_9 Ubuntu Centos_7
 echo -e "${GreenBG}     开源项目:https://github.com/hongwenjun/vps_setup    ${Font}"
 echo
 echo -e "# ${Info} 新手使用${GreenBG} bash wg5 ${Font} 命令,使用临时网页下载配置和手机客户端二维码配置"
-echo -e "# ${Info} 大佬使用${GreenBG} bash wgmtu ${Font} 命令,服务端高级配置和添加删除客户端数量"
-
+echo -e "# ${Info} 大佬使用${GreenBG} bash wgmtu ${Font} 命令,WireGuard 配置管理支持IPV6,稳定有待测试"
+echo -e "# ${Info} 个性端口${RedBG} bash <(curl -L -s https://git.io/fpnQt) ${GreenBG}9999 ${Font} 参数是端口号"
 # echo -e "# ${Info} 请网页打开 ${GreenBG}${conf_url}${Font} 下载配置文件 wg5clients.tar ,${RedBG}注意: 完成后请重启VPS.${Font}"
 # python -m SimpleHTTPServer 8000 &
 echo ""

+ 3 - 3
autoBestTrace.sh

@@ -7,15 +7,15 @@
 #  https://cdn.ipip.net/17mon/besttrace4linux.zip
 
 # install besttrace
-if [ ! -f "besttrace" ]; then
+if [ ! -e "/usr/bin/besttrace" ]; then
     apt -y install unzip
     wget https://cdn.ipip.net/17mon/besttrace4linux.zip
     unzip besttrace4linux.zip
     chmod +x besttrace
-    
+
     mv besttrace /usr/bin/besttrace
     rm besttrace* -rf
-    
+
 fi
 
 ## start to use besttrace

+ 7 - 7
centos7_wireguard_install.sh

@@ -2,17 +2,17 @@
 
 # Centos 安装脚本源  https://github.com/atrandys/wireguard
 
-#判断系统
+# 判断系统
 if [ ! -e '/etc/redhat-release' ]; then
-echo "仅支持centos7"
-exit
+    echo "仅支持centos7"
+    exit
 fi
 if  [ -n "$(grep ' 6\.' /etc/redhat-release)" ] ;then
-echo "仅支持centos7"
-exit
+    echo "仅支持centos7"
+    exit
 fi
 
-#更新内核
+# 更新内核
 update_kernel(){
 
     yum -y install epel-release curl
@@ -35,7 +35,7 @@ update_kernel(){
 	fi
 }
 
-#centos7安装wireguard
+# centos7安装wireguard
 wireguard_install(){
     curl -Lo /etc/yum.repos.d/wireguard.repo https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
     yum install -y epel-release

+ 1 - 1
netlog.sh

@@ -50,7 +50,7 @@ vnstat_install(){
     else
         # centos 系安装 vnstat nginx,如果web没法访问,需要关防火墙
         yum -y install vnstat nginx
-	systemctl enable  nginx
+        systemctl enable  nginx
         systemctl restart nginx
     fi
 

+ 19 - 9
vps.sh

@@ -24,7 +24,7 @@ display_conf(){
     cat /etc/v2ray/config.json
     echo
     echo_SkyBlue "# WG+Speed+Udp2Raw 和 SS+Kcp+Udp2RAW 配置 /etc/rc.local"
-    cat /etc/rc.local
+    cat vps_setup.log
     echo_GreenBG "# WireGuard 客户端配置 /etc/wireguard/client.conf"
     cat /etc/wireguard/client.conf
 }
@@ -37,9 +37,10 @@ start_menu(){
     echo_SkyBlue ">  2. 选择安装 WireGuard 多用户服务端"
     echo_SkyBlue ">  3. 选择安装 Shadowsocks 编译/更新"
     echo_SkyBlue ">  4. 卸载 WireGuard Shadowsocks V2ray 服务"
-    echo_SkyBlue ">  5. 显示 WireGuard V2ray 和 rc.local 配置"
-    echo_SkyBlue ">  6. 退出"
-    echo_SkyBlue ">  8. ${GreenBG} Shadowsocks 和 V2Ray 配置显示二维码 "
+    echo_Yellow  ">  5. 显示 WireGuard V2ray 和 rc.local 配置"
+    echo_Yellow  ">  6. 退出"
+    echo_Yellow  ">  7. WireGuard 管理命令 ${RedBG} bash wgmtu "
+    echo_Yellow  ">  8. 选择安装${GreenBG} Shadowsocks 和 V2Ray 配置显示二维码"
     read -p "请输入数字:" num
     case "$num" in
         1)
@@ -61,8 +62,12 @@ start_menu(){
         6)
         exit 1
         ;;
+        7)
+        bash <(curl -L -s https://git.io/wgmtu)
+        wget -O wgmtu https://git.io/wgmtu  >/dev/null 2>&1
+        ;;
         8)
-        bash <(curl -L -s https://raw.githubusercontent.com/hongwenjun/vps_setup/master/v2ray_ss_conf.sh)
+        bash <(curl -L -s https://git.io/v2ray.ss)
         ;;
         *)
         default_install
@@ -71,13 +76,18 @@ start_menu(){
 }
 
 # 显示文字颜色
-GreenBG="\033[42;37m" && Font="\033[0m" && SkyBlue="\033[0;36m"
-echo_GreenBG(){
-    echo -e "${GreenBG}$1${Font}"
-}
+Green="\033[32m"  && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m"
+Font="\033[0m"  && Yellow="\033[0;33m" && SkyBlue="\033[0;36m"
+
 echo_SkyBlue(){
     echo -e "${SkyBlue}$1${Font}"
 }
+echo_Yellow(){
+    echo -e "${Yellow}$1${Font}"
+}
+echo_GreenBG(){
+    echo -e "${GreenBG}$1${Font}"
+}
 
 start_menu