系统安装环境升级
Centos7/8系统
yum -y install wget yum update -y && yum install curl –y
Ubuntu20.04系统
apt-get install wget apt-get update -y && apt-get install curl -y
centos7/8 防火墙相关命令
**#进程与状态相关**
systemctl start firewalld.service #启动防火墙
systemctl stop firewalld.service #停止防火墙
systemctl status firewalld #查看防火墙状态
systemctl enable firewalld #设置防火墙随系统启动
systemctl disable firewalld #禁止防火墙随系统启动
firewall-cmd --state #查看防火墙状态
firewall-cmd --reload #更新防火墙规则
firewall-cmd --list-ports #查看所有打开的端口
firewall-cmd --list-services #查看所有允许的服务
firewall-cmd --get-services #获取所有支持的服务
**#区域相关**
firewall-cmd --list-all-zones #查看所有区域信息
firewall-cmd --get-active-zones #查看活动区域信息
firewall-cmd --set-default-zone=public #设置public为默认区域
firewall-cmd --get-default-zone #查看默认区域信息
**#接口相关**
firewall-cmd --zone=public --add-interface=eth0 #将接口eth0加入区域public
firewall-cmd --zone=public --remove-interface=eth0 #从区域public中删除接口eth0
firewall-cmd --zone=default --change-interface=eth0 #修改接口eth0所属区域为default
firewall-cmd --get-zone-of-interface=eth0 #查看接口eth0所属区域
**#端口控制**
firewall-cmd --query-port=8080/tcp #查询端口是否开放
firewall-cmd --add-port=8080/tcp --permanent #永久添加8080端口例外(全局)
firewall-cmd --remove-port=8800/tcp --permanent #永久删除8080端口例外(全局)
firewall-cmd --add-port=65001-65010/tcp --permanent #永久增加65001-65010例外(全局)
firewall-cmd --zone=public --add-port=8080/tcp --permanent #永久添加8080端口例外(区域public)
firewall-cmd --zone=public --remove-port=8080/tcp --permanent #永久删除8080端口例外(区域public)
firewall-cmd --zone=public --add-port=65001-65010/tcp --permanent #永久增加65001-65010例外(区域public)
Arm-Ubuntu20防火墙开放指定端口
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 58900 -j ACCEPT
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 443 -j ACCEPT
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 22 -j ACCEPT
sudo iptables-save
sudo apt-get update
sudo apt-get install iptables-persistent -y
sudo netfilter-persistent save
sudo netfilter-persistent reload
apt update && apt dist-upgrade -y && apt autoremove -y
# ubuntu防火墙开放所有端口
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 1:65535 -j ACCEPT
sudo iptables -I INPUT -s 0.0.0.0/0 -p udp --dport 1:65535 -j ACCEPT
sudo iptables-save
sudo ip6tables -I INPUT -s ::/0 -p tcp --dport 1:65535 -j ACCEPT
sudo ip6tables -I INPUT -s ::/0 -p udp --dport 1:65535 -j ACCEPT
sudo ip6tables-save
apt update && apt dist-upgrade -y
sudo apt-get install iptables-persistent -y
sudo netfilter-persistent save
sudo netfilter-persistent reload
# ubuntu删除防火墙
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -F
sudo apt-get purge netfilter-persistent
#
删除iptables规则
sudo rm -rf /etc/iptables && reboot
自定义规则
ufw enable #需要输入Y确认
ufw allow 22/tcp #开放22/tcp端口
ufw allow 80,443/tcp #开放80/tcp和443/tcp端口
ufw allow 1234/udp #开放1234/udp端口
ufw reload #重载防火墙
Arm-Ubuntu20防火墙全部端口开放
iptables -D INPUT -j REJECT --reject-with icmp-host-prohibited
iptables -D FORWARD -j REJECT --reject-with icmp-host-prohibited
/etc/init.d/netfilter-persistent save
/etc/init.d/netfilter-persistent reload
root权限修改密码登录
#!/bin/bash
echo root:bbrios520 |sudo chpasswd root
sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
sudo service sshd restart
Arm-bbr开启
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
Arm测速脚本
wget -qO- git.io/superbench.sh | bash
乌班图18.0.0系统DD-debian10
apt-get update
apt-get install -y xz-utils openssl gawk file
mkdir /etc/network/interfaces.d
复制以下整段代码
echo "# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug ens3
iface ens3 inet dhcp
" > /etc/network/interfaces
下面2条代码
wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && chmod a+x InstallNET.sh
bash <(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') -d 9 -v 64 -a -firmware
0 Comments