Linux常用命令
V2Ray
## TUN interface
ip link set tun0 up
ip addr add 198.18.0.1/15 dev tun0
##clean
iptables -t nat -F
iptables -t nat -X
iptables -t nat -Z
iptables -t mangle -F
iptables -t mangle -X
iptables -t mangle -Z
##iptables list
iptables -t nat -L
iptables -t mangle -L
##service v2ray
service v2ray restart
service v2ray status
##persistent save
sudo netfilter-persistent save
## CIDR iptables
iptables -t nat -N V2RAY
iptables -t nat -A V2RAY -d 149.154.0.0/16 -p tcp -j REDIRECT --to-ports 9527
iptables -t nat -A V2RAY -d 91.108.0.0/16 -p tcp -j REDIRECT --to-ports 9527
iptables -t nat -A V2RAY -d 91.105.0.0/16 -p tcp -j REDIRECT --to-ports 9527
iptables -t nat -A V2RAY -d 185.76.0.0/16 -p tcp -j REDIRECT --to-ports 9527
iptables -t nat -A PREROUTING -p tcp -j V2RAY
#iptables -t nat -A V2RAY -s 10.0.0.128/25 -j RETURN
##TCP
iptables -t nat -N V2RAY
iptables -t nat -A V2RAY -d 127.0.0.1/8 -j RETURN
iptables -t nat -A V2RAY -d 255.255.255.255/32 -j RETURN
iptables -t nat -A V2RAY -d 10.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 9527
iptables -t nat -A PREROUTING -p tcp -j V2RAY
##eth (Not use)
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o enp3s0 -j MASQUERADE
##TCP origin (Not use)
iptables -t nat -N V2RAY
iptables -t nat -A V2RAY -d 10.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 9527
iptables -t nat -A PREROUTING -p tcp -j V2RAY
使用mark标记流量会降速
sniffing后才可以分流
Nextcloud
##maintenancemode
sudo -u www-data php occ maintenance:mode
sudo -u www-data php occ maintenance:mode --on
sudo -u www-data php occ maintenance:mode --off
##repair
sudo -u www-data php occ maintenance:repair
Apache2
ufw allow 'Apache Full'
apt install apache2 php libapache2-mod-php
##mod
sudo a2enmod ssl
sudo a2enmod proxy
sudo a2enmod proxy_wstunnel
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo a2enmod headers
# 监控进程crontab
* * * * * /bin/bash apachedamon.sh
#监控进程
#!/bin/bash
# Apache httpd进程监控shell
# 如果你在使用RHEL / CentOS / Fedora Linux,使用这个重启命令
#RESTART="/sbin/service httpd restart"
# 如果你在使用 Debian / Ubuntu Linux,把上面的RHEL的注释掉,换用这个
RESTART="/etc/init.d/apache2 restart"
#path to pgrep command
PGREP="/usr/bin/pgrep"
# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2
#HTTPD="httpd"
# Debian / Ubuntu Linux 下进程名是apache2
HTTPD="apache2"
# find httpd pid
$PGREP ${HTTPD}
if [ $? -ne 0 ] # if apache not running
then
echo "restart"
$RESTART # restart apache
fi
DDNS (3322)
vi /etc/crontab
//添加一行 每分钟刷新一次
1 * * * * wget "http://用户名:密码@members.3322.org/dyndns/update?system=dyndns&hostname=域名" && rm -r update?system=dyndns*
youtube-dl
youtube-dl --proxy socks5://127.0.0.1:1080 url
Last updated