forked from jiangwei7king/CFWarp-Pro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmulti.sh
1456 lines (1294 loc) · 48.6 KB
/
multi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
export PATH=$PATH:/usr/local/bin
red(){
echo -e "\033[31m\033[01m$1\033[0m"
}
green(){
echo -e "\033[32m\033[01m$1\033[0m"
}
yellow(){
echo -e "\033[33m\033[01m$1\033[0m"
}
blue(){
echo -e "\033[36m\033[01m$1\033[0m"
}
white(){
echo -e "\033[1;37m\033[01m$1\033[0m"
}
bblue(){
echo -e "\033[1;34m\033[01m$1\033[0m"
}
rred(){
echo -e "\033[1;35m\033[01m$1\033[0m"
}
if [[ -f /etc/redhat-release ]]; then
release="Centos"
elif cat /etc/issue | grep -q -E -i "debian"; then
release="Debian"
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
release="Ubuntu"
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
release="Centos"
elif cat /proc/version | grep -q -E -i "debian"; then
release="Debian"
elif cat /proc/version | grep -q -E -i "ubuntu"; then
release="Ubuntu"
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
release="Centos"
fi
bit=`uname -m`
version=`uname -r | awk -F "-" '{print $1}'`
main=`uname -r | awk -F . '{print $1 }'`
minor=`uname -r | awk -F . '{print $2}'`
rv4=`ip a | grep global | awk 'NR==1 {print $2}' | cut -d'/' -f1`
rv6=`ip a | grep inet6 | awk 'NR==2 {print $2}' | cut -d'/' -f1`
op=`hostnamectl | grep -i Operating | awk -F ':' '{print $2}'`
vi=`hostnamectl | grep -i Virtualization | awk -F ':' '{print $2}'`
if [[ ${vi} == " kvm" ]]; then
green " ---VPS扫描中---> "
elif [[ ${vi} == " xen" ]]; then
green " ---VPS扫描中---> "
elif [[ ${vi} == " microsoft" ]]; then
green " ---VPS扫描中---> "
else
yellow " 虚拟架构类型 - $vi "
yellow " 对此vps架构不支持,脚本安装自动退出,赶紧提醒甬哥加上你的架构吧!"
exit 1
fi
yellow " VPS相关信息如下:"
white "------------------------------------------"
blue " 操作系统名称 -$op "
blue " 系统内核版本 - $version "
blue " CPU架构名称 - $bit "
blue " 虚拟架构类型 -$vi "
white " -----------------------------------------------"
sleep 1s
warpwg=$(systemctl is-active wg-quick@wgcf)
case ${warpwg} in
active)
WireGuardStatus=$(green "运行中")
;;
*)
WireGuardStatus=$(red "未运行")
esac
v44=`ping ipv4.google.com -c 1 | grep received | awk 'NR==1 {print $4}'`
if [[ ${v44} == "1" ]]; then
v4=`wget -qO- -4 ip.gs`
WARPIPv4Status=$(curl -s4 https://www.cloudflare.com/cdn-cgi/trace | grep warp | cut -d= -f2)
case ${WARPIPv4Status} in
on)
WARPIPv4Status=$(green "WARP已开启,当前IPV4地址:$v4 ")
;;
off)
WARPIPv4Status=$(yellow "WARP未开启,当前IPV4地址:$v4 ")
esac
else
WARPIPv4Status=$(red "不存在IPV4地址 ")
fi
v66=`ping ipv6.google.com -c 1 | grep received | awk 'NR==1 {print $4}'`
if [[ ${v66} == "1" ]]; then
v6=`wget -qO- -6 ip.gs`
WARPIPv6Status=$(curl -s6 https://www.cloudflare.com/cdn-cgi/trace | grep warp | cut -d= -f2)
case ${WARPIPv6Status} in
on)
WARPIPv6Status=$(green "WARP已开启,当前IPV6地址:$v6 ")
;;
off)
WARPIPv6Status=$(yellow "WARP未开启,当前IPV6地址:$v6 ")
esac
else
WARPIPv6Status=$(red "不存在IPV6地址 ")
fi
Print_ALL_Status_menu() {
blue "-----------------------"
blue "WGCF 运行状态\t: ${WireGuardStatus}"
blue "IPv4 网络状态\t: ${WARPIPv4Status}"
blue "IPv6 网络状态\t: ${WARPIPv6Status}"
blue "-----------------------"
}
if [[ ${bit} == "x86_64" ]]; then
function wo646(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N -6 https://cdn.jsdelivr.net/gh/YG-tsj/EUserv-warp/wgcf
cp wgcf /usr/local/bin/wgcf
sudo chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -6 rule add from $rv6 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -6 rule delete from $rv6 table main\n/" wgcf-profile.conf
sed -i 's/engage.cloudflareclient.com/2606:4700:d0::a29f:c001/g' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
grep -qE '^[ ]*precedence[ ]*::ffff:0:0/96[ ]*100' /etc/gai.conf || echo 'precedence ::ffff:0:0/96 100' | sudo tee -a /etc/gai.conf
yellow " 检测是否成功启动(IPV4+IPV6)双栈Warp!\n 显示IPV4地址:$(wget -qO- -4 ip.gs) 显示IPV6地址:$(wget -qO- -6 ip.gs) "
green " 如上方显示IPV4地址:8.…………,IPV6地址:2a09:…………,则说明成功啦!\n 如上方IPV4无IP显示,IPV6显示本地IP,则说明失败喽!! "
}
function wo66(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N -6 https://cdn.jsdelivr.net/gh/YG-tsj/EUserv-warp/wgcf
cp wgcf /usr/local/bin/wgcf
sudo chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -6 rule add from $rv6 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -6 rule delete from $rv6 table main\n/" wgcf-profile.conf
sed -i 's/engage.cloudflareclient.com/2606:4700:d0::a29f:c001/g' wgcf-profile.conf
sed -i '/0\.0\.0\.0\/0/d' wgcf-profile.conf
sed -i 's/1.1.1.1/2001:4860:4860::8888,8.8.8.8/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
grep -qE '^[ ]*label[ ]*2002::/16[ ]*2' /etc/gai.conf || echo 'label 2002::/16 2' | sudo tee -a /etc/gai.conf
yellow " 检测是否成功启动Warp!\n 显示IPV6地址:$(wget -qO- -6 ip.gs) "
green " 如上方显示IPV6地址:2a09:…………,则说明成功!\n 如上方IPV6显示本地IP,则说明失败喽! "
}
function wo64(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N -6 https://cdn.jsdelivr.net/gh/YG-tsj/EUserv-warp/wgcf
cp wgcf /usr/local/bin/wgcf
sudo chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i 's/engage.cloudflareclient.com/2606:4700:d0::a29f:c001/g' wgcf-profile.conf
sed -i '/\:\:\/0/d' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
grep -qE '^[ ]*precedence[ ]*::ffff:0:0/96[ ]*100' /etc/gai.conf || echo 'precedence ::ffff:0:0/96 100' | sudo tee -a /etc/gai.conf
yellow " 检测是否成功启动Warp!\n 显示IPV4地址:$(wget -qO- -4 ip.gs) "
green " 如上方显示IPV4地址:8.…………,则说明成功啦!\n 如上方显示VPS本地IP,则说明失败喽! "
}
function warp6(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N https://github.com/ViRb3/wgcf/releases/download/v2.2.3/wgcf_2.2.3_linux_amd64 -O /usr/local/bin/wgcf
sudo chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sudo sed -i 's/engage.cloudflareclient.com/162.159.192.1/g' wgcf-profile.conf
sudo sed -i '/0\.0\.0\.0\/0/d' wgcf-profile.conf
sudo sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
sudo cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
sudo cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动Warp!\n 显示IPV6地址:$(wget -qO- -6 ip.gs) "
green " 如上方显示IPV6地址:2a09:…………,则说明成功!\n 如上方无IP显示,则说明失败喽! "
}
function warp64(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N https://github.com/ViRb3/wgcf/releases/download/v2.2.3/wgcf_2.2.3_linux_amd64 -O /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -4 rule add from $rv4 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -4 rule delete from $rv4 table main\n/" wgcf-profile.conf
sed -i 's/engage.cloudflareclient.com/162.159.192.1/g' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动(IPV4+IPV6)双栈Warp!\n 显示IPV4地址:$(wget -qO- -4 ip.gs) 显示IPV6地址:$(wget -qO- -6 ip.gs) "
green " 如上方显示IPV4地址:8.…………,IPV6地址:2a09:…………,则说明成功啦!\n 如上方IPV4显示本地IP,IPV6无ip显示,则说明失败喽!! "
}
function warp4(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N https://github.com/ViRb3/wgcf/releases/download/v2.2.3/wgcf_2.2.3_linux_amd64 -O /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -4 rule add from $rv4 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -4 rule delete from $rv4 table main\n/" wgcf-profile.conf
sed -i 's/engage.cloudflareclient.com/162.159.192.1/g' wgcf-profile.conf
sed -i '/\:\:\/0/d' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动Warp!\n 显示IPV4地址:$(wget -qO- -4 ip.gs) "
green " 如上方显示IPV4地址:8.…………,则说明成功啦!\n 如上方显示VPS本地IP,则说明失败喽! "
}
function warp466(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N https://github.com/ViRb3/wgcf/releases/download/v2.2.3/wgcf_2.2.3_linux_amd64 -O /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -6 rule add from $rv6 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -6 rule delete from $rv6 table main\n/" wgcf-profile.conf
sed -i '/0\.0\.0\.0\/0/d' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动Warp!\n 显示IPV6地址:$(wget -qO- -6 ip.gs) "
green " 如上方显示IPV6地址:2a09:…………,则说明成功啦!\n 如上方无IP显示,则说明失败喽! "
}
function warp4646(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N https://github.com/ViRb3/wgcf/releases/download/v2.2.3/wgcf_2.2.3_linux_amd64 -O /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -4 rule add from $rv4 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -4 rule delete from $rv4 table main\n/" wgcf-profile.conf
sed -i "7 s/^/PostUp = ip -6 rule add from $rv6 table main\n/" wgcf-profile.conf
sed -i "8 s/^/PostDown = ip -6 rule delete from $rv6 table main\n/" wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动(IPV4+IPV6)双栈Warp!\n 显示IPV4地址:$(wget -qO- -4 ip.gs) 显示IPV6地址:$(wget -qO- -6 ip.gs) "
green " 如上方显示IPV4地址:8.…………,IPV6地址:2a09:…………,则说明成功啦!\n 如上方IPV4显示本地IP,IPV6显示本地IP,则说明失败喽! "
}
function warp464(){
yellow " 检测系统内核版本是否大于5.6版本 "
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,自动更新内核吧"
exit 1
fi
if [ $release = "Centos" ]
then
yum update -y
yum install curl wget -y && yum install sudo -y
yum install epel-release -y
yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -o /etc/yum.repos.d/jdoss-wireguard-epel-7.repo \
https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install wireguard-tools -y
elif [ $release = "Debian" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt-get install openresolv -y
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get install linux-headers-`uname -r` -y
apt-get install wireguard-tools -y
elif [ $release = "Ubuntu" ]
then
apt-get update -y
apt-get install curl wget -y && apt install sudo -y
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
else
yellow " 不支持当前系统 "
exit 1
fi
wget -N https://github.com/ViRb3/wgcf/releases/download/v2.2.3/wgcf_2.2.3_linux_amd64 -O /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -4 rule add from $rv4 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -4 rule delete from $rv4 table main\n/" wgcf-profile.conf
sed -i '/\:\:\/0/d' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动Warp!\n 显示IPV4地址:$(wget -qO- -4 ip.gs) "
green " 如上方显示IPV4地址:8.…………,则说明成功啦!\n 如上方显示VPS本地IP,则说明失败喽! "
}
function upcore(){
wget -N --no-check-certificate https://cdn.jsdelivr.net/gh/YG-tsj/CFWarp-Pro/upcore.sh&& chmod +x upcore.sh && ./upcore.sh
}
function iptables(){
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -F
sudo apt-get purge netfilter-persistent -y
sudo reboot
}
function BBR(){
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
lsmod | grep bbr
}
function cwarp(){
systemctl stop wg-quick@wgcf
systemctl disable wg-quick@wgcf
sudo reboot
}
function owarp(){
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
}
function macka(){
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -F
wget -P /root -N --no-check-certificate "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh" && chmod 700 /root/install.sh && /root/install.sh
}
function phlinhng(){
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -F
curl -fsSL https://raw.staticdn.net/phlinhng/v2ray-tcp-tls-web/main/src/xwall.sh -o ~/xwall.sh && bash ~/xwall.sh
}
function cv46(){
yellow "开始检测IPV4地址"
v4=`wget -qO- -4 ip.gs`
pingv4=$(ping -c 1 www.google.com| sed '2{s/[^(]*(//;s/).*//;q;}' | tail -n +2)
if [[ -z "${pingv4}" ]]; then
red " ---> VPS当前检测不到IPV4地址 "
else
green " VPS当前正使用的IPV4地址: $v4 "
fi
yellow "开始检测IPV6地址"
v6=`wget -qO- -6 ip.gs`
pingv6=$(ping6 -c 1 www.google.com| sed '2{s/[^(]*(//;s/).*//;q;}' | tail -n +2)
if [[ -z "${pingv6}" ]]; then
red " ---> VPS当前检测不到IPV6地址 "
else
green " VPS当前正使用的IPV6地址: $v6 "
fi
}
function Netflix(){
wget -O nf https://cdn.jsdelivr.net/gh/sjlleo/netflix-verify/CDNRelease/nf_2.60_linux_amd64 && chmod +x nf && clear && ./nf -method full
}
function reboot(){
sudo reboot
}
function dns(){
echo 'DNS=8.8.8.8 2001:4860:4860::8888'>> /etc/systemd/resolved.conf
systemctl restart systemd-resolved
systemctl enable systemd-resolved
mv /etc/resolv.conf /etc/resolv.conf.bak
ln -s /run/systemd/resolve/resolv.conf /etc/
sudo reboot
}
function status(){
systemctl status wg-quick@wgcf
}
function up4(){
wget -N --no-check-certificate https://raw.githubusercontent.com/YG-tsj/CFWarp-Pro/main/multi.sh && chmod +x multi.sh && ./multi.sh
}
function up6(){
echo -e nameserver 2a00:1098:2c::1 > /etc/resolv.conf
wget -6 -N --no-check-certificate https://raw.githubusercontent.com/YG-tsj/CFWarp-Pro/main/multi.sh && chmod +x multi.sh && ./multi.sh
}
#主菜单
function start_menu(){
clear
yellow " 详细说明 https://github.com/YG-tsj/CFWarp-Pro YouTube频道:甬哥侃侃侃"
red " 切记:进入脚本快捷方式 bash multi.sh "
white " ==================一、VPS相关调整选择(更新中)=========================================="
green " 1. 永久开启甲骨文VPS的ubuntu系统所有端口 "
green " 2. 更新系统内核 "
green " 3. 开启原生BBR加速 "
green " 4. 检测奈飞Netflix是否解锁 "
white " ==================二、“内核集成模式”WARP功能选择(更新中)======================================"
yellow " ----VPS原生IP数------------------------------------添加WARP虚拟IP的位置--------------"
green " 5. 纯IPV4的VPS。 添加WARP虚拟IPV6 "
green " 6. 纯IPV4的VPS。 添加WARP虚拟IPV4+虚拟IPV6 "
green " 7. 纯IPV4的VPS。 添加WARP虚拟IPV4 "
green " 8. 双栈IPV4+IPV6的VPS。 添加WARP虚拟IPV6 "
green " 9. 双栈IPV4+IPV6的VPS。 添加WARP虚拟IPV4+虚拟IPV6 "
green " 10. 双栈IPV4+IPV6的VPS。 添加WARP虚拟IPV4 "
green " 11. 纯IPV6的VPS。 添加WARP虚拟IPV6 "
green " 12. 纯IPV6的VPS。 添加WARP虚拟IPV4+虚拟IPV6 "
green " 13. 纯IPV6的VPS。 添加WARP虚拟IPV4 "
white " ------------------------------------------------------------------------------------------------"
green " 14. 统一DNS功能(建议选择) "
green " 15. 永久关闭WARP功能 "
green " 16. 自动开启WARP功能 "
green " 17. 有IPV4:更新脚本 "
green " 18. 无IPV4:更新脚本 "
white " ==================三、代理协议脚本选择(更新中)==========================================="
green " 19.使用mack-a脚本(支持Xray, V2ray) "
green " 20.使用phlinhng脚本(支持Xray, Trojan-go, SS+v2ray-plugin) "
white " ============================================================================================="
green " 21. 重启VPS实例,请重新连接SSH "
white " ==============================================================================================="
green " 0. 退出脚本 "
Print_ALL_Status_menu
echo
read -p "请输入数字:" menuNumberInput
case "$menuNumberInput" in
1 )
iptables
;;
2 )
upcore
;;
3 )
BBR
;;
4 )
Netflix
;;
5 )
warp6
;;
6 )
warp64
;;
7 )
warp4
;;
8 )
warp466
;;
9 )
warp4646
;;
10 )
warp464
;;
11 )
wo66
;;
12 )
wo646
;;
13 )
wo64
;;
14 )
dns
;;
15 )
cwarp
;;
16 )
owarp
;;
17 )
up4
;;
18 )
up6
;;
19 )
macka
;;
20 )
phlinhng
;;
21 )
reboot
;;
0 )
exit 1
;;
esac
}
start_menu "first"
elif [[ ${bit} == "aarch64" ]]; then
function warp6(){
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,更新内核吧"
exit 1
fi
apt update
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
wget -N https://github.com/YG-tsj/CFWarp-Pro/raw/main/wgcf
cp wgcf /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i 's/engage.cloudflareclient.com/162.159.192.1/g' wgcf-profile.conf
sed -i '/0\.0\.0\.0\/0/d' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动Warp!\n 显示IPV6地址:$(wget -qO- -6 ip.gs) "
green " 如上方显示IPV6地址:2a09:…………,则说明成功啦!\n 如上方无IP显示,则说明失败喽! "
}
function warp64(){
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,更新内核吧"
exit 1
fi
apt update
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
wget -N https://github.com/YG-tsj/CFWarp-Pro/raw/main/wgcf
cp wgcf /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -4 rule add from $rv4 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -4 rule delete from $rv4 table main\n/" wgcf-profile.conf
sed -i 's/engage.cloudflareclient.com/162.159.192.1/g' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动(IPV4+IPV6)双栈Warp!\n 显示IPV4地址:$(wget -qO- -4 ip.gs) 显示IPV6地址:$(wget -qO- -6 ip.gs) "
green " 如上方显示IPV4地址:8.…………,IPV6地址:2a09:…………,则说明成功啦!\n 如上方IPV4无IP显示,IPV6显示本地IP,则说明失败喽! "
}
function warp4(){
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,更新内核吧"
exit 1
fi
apt update
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
wget -N https://github.com/YG-tsj/CFWarp-Pro/raw/main/wgcf
cp wgcf /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s
echo | wgcf register
done
wgcf generate
sed -i "5 s/^/PostUp = ip -4 rule add from $rv4 table main\n/" wgcf-profile.conf
sed -i "6 s/^/PostDown = ip -4 rule delete from $rv4 table main\n/" wgcf-profile.conf
sed -i 's/engage.cloudflareclient.com/162.159.192.1/g' wgcf-profile.conf
sed -i '/\:\:\/0/d' wgcf-profile.conf
sed -i 's/1.1.1.1/8.8.8.8,2001:4860:4860::8888/g' wgcf-profile.conf
cp wgcf-account.toml /etc/wireguard/wgcf-account.toml
cp wgcf-profile.conf /etc/wireguard/wgcf.conf
systemctl enable wg-quick@wgcf
systemctl start wg-quick@wgcf
rm -f wgcf*
yellow " 检测是否成功启动Warp!\n 显示IPV4地址:$(wget -qO- -4 ip.gs) "
green " 如上方显示IPV4地址:8.…………,则说明成功啦!\n 如上方显示VPS本地IP,则说明失败喽! "
}
function warp466(){
if [ "$main" -lt 5 ]|| [ "$minor" -lt 6 ]; then
red " 检测到内核版本小于5.6,回到菜单,选择2,更新内核吧"
exit 1
fi
apt update
apt -y --no-install-recommends install openresolv dnsutils wireguard-tools
wget -N https://github.com/YG-tsj/CFWarp-Pro/raw/main/wgcf
cp wgcf /usr/local/bin/wgcf
chmod +x /usr/local/bin/wgcf
echo | wgcf register
until [ $? -eq 0 ]
do
sleep 1s