debian
apt install net-tools
apt install vim
配置静态ip
vim /etc/network/interfacesbashiface eth0 inet static #static表示使用固定ip,dhcp表述使用动态ip address 192.168.100.198 #设置ip地址 netmask 255.255.255.0 #设置子网掩码 gateway 192.168.100.1 #设置网关/etc/init.d/networking stop/etc/init.d/networking start
ssh root登录
vim /etc/ssh/sshd_config- 添加
PermitRootLogin yes
debian防火墙
sh
apt install ufw
ufw status verbose # 查看防火墙状态
ufw app info OpenSSH # 查看软件关于防火墙的配置规则
ufw allow OpenSSH # UFW 防火墙接受 SSH 连接
ufw enable # 启用防火墙
ufw disable # 停用防火墙
ufw allow 80/tcp
ufw allow 7100:7200/tcp
ufw allow from 64.63.62.61 # 允许某个ip访问
ufw allow from 64.63.62.61 to any port 22 # 允许指定 IP 地址访问指定端口
ufw deny from 23.24.25.0/24 # 禁止某个ip访问
ufw deny from 23.24.25.0/24 to any port 80 # 禁止指定 IP 地址访问指定端口
ufw status numbered # 查看规则(序号)
ufw delete 3 # 删除规则3ufw deny out from any to 116.62.153.154
apt源
vi /etc/apt/sources.list
sh
deb http://mirrors.ustc.edu.cn/debian buster main contrib non-free
deb http://mirrors.ustc.edu.cn/debian buster-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian buster-backports main contrib non-free
deb http://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-freeapt update && apt upgrade -y
nas下安装v2ray
下载核心
sh
# 下载
wget https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-64.zip
unzip v2ray-linux-64.zip -d v2ray
# 移动到系统目录
sudo mkdir -p /usr/local/v2ray
sudo cp -r v2ray/* /usr/local/v2ray/
sudo ln -sf /usr/local/v2ray/v2ray /usr/bin/v2ray
sudo ln -sf /usr/local/v2ray/v2ctl /usr/bin/v2ctl
# 创建配置目录
sudo mkdir -p /usr/local/etc/v2ray
# 写入最简配置文件
sudo tee /usr/local/etc/v2ray/config.json >/dev/null <<'EOF'
{
"inbounds": [{
"port": 1080,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": { "udp": true }
}],
"outbounds": [{ "protocol": "freedom", "settings": {} }]
}
EOF
# 启动测试
sudo /usr/local/v2ray/v2ray run -config /usr/local/etc/v2ray/config.json下载v2raya
sh
# 下载
wget https://github.com/v2rayA/v2rayA/releases/latest/download/v2raya_linux_amd64.deb
sudo apt install ./v2raya_linux_amd64.deb
# 启动
sudo systemctl enable v2raya
sudo systemctl start v2raya
# 查看状态
sudo systemctl status v2raya下载geoip.dat 和 geosite.dat
sh
sudo mkdir -p /usr/share/v2ray
sudo wget -O /usr/share/v2ray/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
sudo wget -O /usr/share/v2ray/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat
sudo mv /usr/share/v2ray/dlc.dat /usr/share/v2ray/geosite.dat
sudo systemctl restart v2raya浏览器访问 ip:2017