Skip to content

debian

apt install net-tools

apt install vim

配置静态ip

  • vim /etc/network/interfaces

    bash
    iface 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             # 删除规则3
  • ufw 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-free

apt update && apt upgrade -y