惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
雷峰网
雷峰网
博客园_首页
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
小众软件
小众软件
D
Docker
P
Proofpoint News Feed
B
Blog
Vercel News
Vercel News
B
Blog RSS Feed
U
Unit 42
月光博客
月光博客
The GitHub Blog
The GitHub Blog
Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
I
InfoQ
Recent Announcements
Recent Announcements

博客园 - 番茄的梦想

Linux—nvm教程 LNMP一键安装包安装的mysql远程连接不上的问题 linux service文件格式 linux if命令 微软sdk及运行时下载地址 解决python错误 UnicodeDecodeError: 'gb2312' codec can't decode byte 0x8b in position 1: illegal multibyt pip相关介绍 结构(位置)伪类选择器 如何清除mstsc记录 ubuntu开启远程桌面功能 使用Windows远程桌面工具来远程连接控制Ubuntu系统 缓存头Cache-Control的含义和使用 正则表达式 以A开头B结尾 取中间的内容 nginx 不带www的域名跳转www域名 IIS配置导入导出 CSS中hover选择器的使用详解 html 锚点三种实现方法 重置自增长id 如何解决Visual Studio2012 与此版本的Windows不兼容
Debian防火墙的ufw的使用
番茄的梦想 · 2024-04-29 · via 博客园 - 番茄的梦想

安装ufw

1 sudo apt update
2 sudo apt install ufw 

开启防火墙

关闭防火墙

查看策略:

ufw status verbose
ufw status numbered

恢复默认策略:

1 ufw default deny incoming
2 ufw default allow outgoing
3 ufw default reject routed

重置UFW(将删除所有自定义策略并关闭UFW)

添加允许连接的商端口:

放行指定范围的端口:

1 ufw allow 10010:10086/tcp
2 ufw allow 10010:10086/udp

允许指定ip访问

复制代码

1 # 放行ip
2 ufw allow 221.123.1.1
3 ufw allow 221.123.1.1 to any port 22
4 
5 # 放行ip段
6 ufw allow 221.123.1.0/24
7 ufw allow 221.123.1.0/24 to any port 22

复制代码

拒绝连接

1 ufw deny http
2 ufw deny from 221.123.1.1

删除规则

复制代码

# 按编号删除
ufw delete [num]

# 按实际规则删除
ufw delete allow http 
# or 
ufw delete allow 80

复制代码

posted on 2024-04-29 22:15  番茄的梦想  阅读(503)  评论()    收藏  举报