ubuntu防火墙ufw基本使用方法

ubuntu系统基本使用方法


防火墙

# 查看服务器防火墙状态
ufw status
# 将防火墙设置为可用状态
ufw enable
# 将防火墙设置为关闭状态
ufw disbale
# 放行端口
ufw allow 22
# 指定ip为192.168.1.1的计算机操作所有端口
ufw allow from 192.168.1.1
# 开放指定ip为192.168.1.2的计算机访问本机的3306端口
ufw allow from 192.168.1.2 to any port 3306
# 重启防火墙,使配置生效
ufw reload
# 关闭端口
ufw delete allow 21 
# 查看编号
ufw status numbered
# 删除编号
ufw delete 4
# 重置防火墙
ufw reset

常用软件包

# ping无法使用
apt-get -y install iputils-ping
# netstat无法使用
apt-get -y install net-tools
# 编译工具 gcc gcc-c++等
apt-get -y install build-essential
# 查看默认的软件包版本(以nginx为例)
apt-cache policy nginx
# 查看已经安装的软件包(以nginx为例)
dpkg --list|grep nginx
posted @ 2023-12-15 10:44  wltianOne  阅读(72)  评论(0编辑  收藏  举报