当前位置:网站首页>ufw set firewall rules
ufw set firewall rules
2022-07-30 01:24:00 【I am yogurt cover】
ufw 设置防火墙规则
安装以及初始化
# 安装命令
sudo apt install ufw
# 检查UFW状态命令,Inactive by default
sudo ufw status verbose
在配置之前
# 重置所有规则 (The previous configuration cannot be modified)
sudo ufw reset
# Enable and activate the firewall at system startup
sudo ufw enable
# 再次查看UFW状态,will be found to be activated
sudo ufw status verbose
Turn on the set default policy
# 在配置之前,Enable the default settings first,The default policy will deny all incoming connections,All outgoing links are allowed,This opens the specified port or allows the specified port on demandip来连接服务器.
sudo ufw default allow
配置规则
# 打开端口(端口/协议)If no protocol is specified, it defaults to all
sudo ufw allow 22/tcp
# 端口范围
sudo ufw allow 7100:7200/tcp
# 允许指定 IP 地址访问
sudo ufw allow from 64.63.62.61
# 允许指定 IP 地址访问指定端口
sudo ufw allow from 64.63.62.61 to any port 22
# 允许子网
sudo ufw allow from 192.168.1.0/24 to any port 3306
# Allow network card
sudo ufw allow in on eth2 to any port 3306
# 禁止IP连接
sudo ufw deny from 23.24.25.0/24
# 禁止IP连接端口
sudo ufw deny proto tcp from 23.24.25.0/24 to any port 80,443
添加规则,Block other incoming connections
需要注意,Rules are prioritized in the order they were added,若执行ufw deny from any后,Subsequent new rules will not take effect!!!
# 添加规则,Block other incoming connections
sudo ufw deny from any
# 检查UFW状态
sudo ufw status
删除 UFW 规则
有两种不同的方式可以删除 UFW 规则.通过规则序号和通过指定的规则.
- 通过规则序号来删除
sudo ufw status numbered
# 输出
Status: active
To Action From
-- ------ ----
[ 1] 22/tcp ALLOW IN Anywhere
[ 2] 80/tcp ALLOW IN Anywhere
[ 3] 8080/tcp ALLOW IN Anywhere
# 删除规则,序号为3,这个规则允许对端口8080的连接
sudo ufw delete 3
- Specify the actual rule to delete
sudo ufw delete allow 8069
禁用\启用\重置UFW
# 禁用
sudo ufw disable
# 启用
sudo ufw enable
# 重置
sudo ufw reset
边栏推荐
- Meetings OA To Be Meeting && All Meetings
- Selenium上传文件有多少种方式?不信你有我全
- FlutterBoost 3.0出现 Activity无法转换为ExclusiveAppComponent<Activity>的解决办法
- LeetCode / Scala - 无重复字符最长子串 ,最长回文子串
- STM32 - OLED display experiment
- 这是一道非常有争议的题,我的分析如下: TCP/IP在多个层引入了安全机制,其中TLS协议位于______。 A.数据链路层 B.网络层 C.传输层 D.应用层
- CAPL中的键值对(hash)数据类型
- 泰克Tektronix示波器软件TDS420|TDS430|TDS460上位机软件NS-Scope
- 经典毕业设计:基于SSM实现高校后勤报修系统
- 气路旋转连接器怎么用
猜你喜欢

百度智能云章淼:详解企业级七层负载均衡开源软件BFE

转发和重定向的区别及使用场景

重新定义分析 - EventBridge 实时事件分析平台发布

泰克Tektronix示波器软件TDS2012|TDS2014|TDS2022上位机软件NS-Scope
![2022-07-29:一共有n个人,从左到右排列,依次编号0~n-1, h[i]是第i个人的身高, v[i]是第i个人的分数, 要求从左到右选出一个子序列,在这个子序列中的人,从左到右身高是不下降的。](/img/a0/998fb7edca5ebe5d9b1d1e8b705faa.png)
2022-07-29:一共有n个人,从左到右排列,依次编号0~n-1, h[i]是第i个人的身高, v[i]是第i个人的分数, 要求从左到右选出一个子序列,在这个子序列中的人,从左到右身高是不下降的。

Recommendation system: collection of user "behavioral data" [use Kafka and Cassandra to process data] [if it overlaps with business data, it also needs to be collected independently]

【Flutter】Flutter inspector 工具使用详解,查看Flutter布局,widget树,调试界面等

CMake Tutorial Tour (1)_Basic starting point

How many ways does Selenium upload files?I don't believe you have me

自学HarmonyOS应用开发(47)- 自定义switch组件
随机推荐
机械设备制造企业如何借助ERP系统,解决成本核算难题?
泰克Tektronix示波器软件TDS1012|TDS2002|TDS2004上位机软件NS-Scope
Unity便携式 VR 的实现
神经网络迭代次数的一个近似关系
多AZ双活容灾部署的云端系统架构设计说明书框架
泰克Tektronix示波器软件TDS520|TDS1001|TDS1002上位机软件NS-Scope
How many ways does Selenium upload files?I don't believe you have me
[Flutter] Detailed explanation of the use of the Flutter inspector tool, viewing the Flutter layout, widget tree, debugging interface, etc.
Recurrent Neural Network (RNN)
canvas 中如何实现物体的框选(六)
经典毕业设计:基于SSM实现高校后勤报修系统
【C Primer Plus第九章课后编程题】
新型LaaS协议Elephant Swap给ePLATO提供可持续溢价空间
推荐系统:用户“行为数据”的采集【使用Kafaka、Cassandra处理数据】【如果与业务数据重合,也需要独自采集】
string replace spaces
Performance Testing Theory 1 | Sorting out difficult problems in performance testing
Win11的WSL2系统更换磁盘和wsl使用简介
Replace the executable file glibc version of the one
网络原理 基础知识
小白必看|不用编程的labview,ATECLOUD完全满足你的需求