Ubuntu 系统使用iptables防火墙使用手册

摘要:自从Ubuntu 20.04.4 LTS版本后,Ubuntu默认的防火墙是ufwufw对于普通的开放端口和限制使用很简单,如果你想更加精确使用防火墙,推荐直接使用iptables的规则。

安装

apt安装

matlab 复制代码
sudo apt install iptables-persistent

查看服务状态

lua 复制代码
sudo systemctl status netfilter-persistent

netfilter-persistent命令使用

  • 保存规则到文件/etc/iptables/rules.v4netfilter-persistent save
  • 从文件中重新加载规则:netfilter-persistent reload
  • 开启服务:netfilter-persistent start
  • 停止服务:netfilter-persistent stop
  • 清空规则:netfilter-persistent flush
相关推荐
Better Bench2 小时前
WSL2 Ubuntu 中 Claude CLI “command not found” 故障排查与修复
linux·ubuntu·claude·wsl·claudecode
Shell运维手记11 小时前
ARP 协议超详细讲解(适合网工考试 / 运维理解)
运维·网络·网络协议·智能路由器
ShineWinsu12 小时前
对于Linux:HTTP中cookie、session的解析
linux·网络·c++·网络协议·http·cookie·session
huainingning12 小时前
华三瘦AP切换为胖AP并配置无线功能
运维·网络·网络协议·tcp/ip
LSG_Dawn14 小时前
XBOX360 kinect + ROS2_humble
ubuntu·深度相机
jing.wang_202515 小时前
NVIDIA CUDA C++编程环境搭建--Windows + Ubuntu 22.04
c++·windows·ubuntu·gpu算力
跨境技工小黎16 小时前
4G/5G 移动代理实战:什么时候必须用移动 IP?
网络协议·tcp/ip·5g
米尔的可达鸭16 小时前
UDP 通信深度实验:从 Windows FastPath 到 ICMP 端口不可达的完整排查
windows·websocket·网络协议·rust·udp·wireshark·tcpdump
黑白园18 小时前
个人台式机VMware 15及Ubuntu 16.04.5卸载以及VMware 16.2.3及Ubuntu 24.04.4安装
linux·ubuntu
gwf2161 天前
RoCEv2无损网络配置实战:PFC与ECN深度调优
网络·网络协议·tcp/ip·udp·tcpdump