搜索结果: "iptables"
共找到 33 个页面
K8s DNS 故障排查实战:iptables 封禁 53 端口引发的 DNS 雪崩
标题匹配title: K8s DNS 故障排查实战:iptables 封禁 53 端口引发的 DNS 雪崩
tags: [kubernetes, dns, iptables, troubleshooting, networking, production]
- raw/articles/一条错误的iptables规则-干翻了整个K8s集群DNS-附完整排查过程.md
# K8s DNS 故障排查实战:iptables 封禁 53 端口引发的 DNS 雪崩
> **一句话复盘:** 运维安全加固脚本误加了一条 `iptables -A OUTPUT -p udp --dport 53 -j DROP`,导致 DNS 上游转发失败 → CoreDNS 超时积压崩溃 → 全集群 DNS 解析不可用。从症状到根因,层层递进排查了 76 分钟。
Kubernetes kube-proxy 模式选型与切换:iptables vs IPVS
标题匹配title: Kubernetes kube-proxy 模式选型与切换:iptables vs IPVS
sources: [raw/articles/Kubernetes-网络的-iptables-vs-IPVS-模式-性能差在哪-选哪个-怎么切.md]
# Kubernetes kube-proxy 模式选型与切换:iptables vs IPVS
> ⚠️ **更新提醒**:K8s v1.32 实验性支持 nftables 模式,v1.33 正式 GA。但截至目前 iptables 仍是默认模式,切换 IPVS/nftables 需手动操作。
# iptables → "Using iptables proxy"
CNI 网络插件深度对比 — Flannel vs Calico vs Cilium
传统 iptables Flannel (VXLAN) Calico (BGP)
| **Calico** | Underlay | BGP + Felix + iptables | 把 K8s 网络当成数据中心网络来管理 |
- **Felix agent**:运行在每个节点上,负责编排 iptables 规则实现 NetworkPolicy
- **eBPF 数据面(可选)**:替换 iptables,性能大幅提升
- **NetworkPolicy 完整实现**:iptables + 细粒度策略,K8s 原生 NetworkPolicy 的最完整实现之一
网络基础必知必会 — IP/子网掩码/网关/路由/VLAN 完全解读
iptables -L -n -v # 查防火墙
**排查:** 确认 IP/掩码正确 → `arp -a` 看 MAC → `iptables -L INPUT` 查 ICMP 是否被 DROP。
**排查:** `nc -zv` 测端口 → `traceroute` 追跳点 → `iptables -L OUTPUT` → 检查 MTU(`ping -M do -s 1400`)、检查代理变量 `echo $http_proxy`。
### iptables 概要
iptables -A INPUT -p tcp --dport 22 -j ACCEPT # SSH
网络丢包排查全链路分析:从 ping 到 tcpdump 逐层排查指南
| **逻辑丢包** | 网络协议栈内部(IP/TCP/socket) | `/proc/net/snmp`、`nstat`、`ss`、`conntrack`、`iptables` |
### 第八步:查看 Netfilter/iptables 丢包
iptables -L -n -v # 查看各规则匹配的包数量
iptables -L INPUT -n -v # 入站规则,看 DROP 计数
iptables -t filter -L -n -v # filter 表
服务器网络排障方法论 — 分层定位七步法
### ④ 防火墙 & iptables
# iptables
iptables -L -n -v
iptables-save > /root/iptables.bak # 操作前先备份!
**⚠️ `--permanent` 不加的话,重启就全没了。** 生产环境操作 iptables 前**一定先备份**,误操作锁死自己连控制台都救不回来。
运维工程师面试 50 题 — 经典 Linux/网络/数据库基础全覆盖
### 24. iptables 规则管理
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -s 192.168.1.100 -j DROP
iptables-save > /etc/iptables/rules.v4
参见 [[ssh-brute-force-protection-guide]](fail2ban + iptables 防暴力破解)。
线上服务端口连不上?完整排查指南(从进程到客户端)
| Connection refused | 端口没在监听,或被 iptables REJECT | 服务是否启动、端口是否监听 |
**iptables(Ubuntu/底层):**
iptables -L INPUT -n -v --line-numbers # 看入站规则
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT # 临时放行
> 临时关闭防火墙测试(仅排查用):`iptables -F && iptables -P INPUT ACCEPT`,用完立即恢复。
K8s 架构与核心概念深度解析 — 面试通关秘籍(一)
| **Kube-proxy** | 网络代理,维护节点上的网络规则(iptables/ipvs),实现 Service 负载均衡 |
| **ClusterIP** | 集群内部 | iptables/ipvs | 内部微服务调用 |
→ kube-proxy 更新 iptables/ipvs 规则
→ kube-proxy iptables/ipvs 规则
| [[k8s-iptables-ipvs-switch-guide]] | Kubernetes kube-proxy 模式选型与切换:iptables vs IPVS 原理对 |
Kubernetes 负载均衡深度实践:Service 数据面到生产级流量治理全链路
| **iptables** | 随机选择后端 Pod | 成熟稳定,Linux 内核原生 | 规则量大时性能下降,更新需 iptables-save 全量刷新 | 小集群(<100 个 Service) |
### iptables 的核心缺陷
- **规则链膨胀**:每增加一个 Service,iptables 规则链线性增长,更新一条规则需全量 reload
- **连接跟踪压力**:iptables 依赖 conntrack 模块,高并发时 conntrack 表打满导致丢包
3. 检查 iptables/IPVS 规则:
K8s 服务访问排查 — 从 Pod、Service 到 Ingress 十步工作流
PodA → ClusterIP:ServicePort → kube-proxy (iptables/ipvs) → EndpointIP:ContainerPort → PodB
- kube-proxy 的 iptables/ipvs 规则是否正确生成
kube-proxy 运行在每个节点上,监听 Service 和 Endpoints 的变化,动态更新本地的 iptables 或 ipvs 规则。
- **iptables 模式**:默认,性能稍差,但稳定
### 4.3 iptables 模式排查
Service 与网络排障 — Endpoints / DNS / kube-proxy / CNI / NetworkPolicy / Ingress
kube-proxy 运行在每个节点上,监听 Service 和 Endpoints 的变化,动态更新本地的 iptables 或 ipvs 规则。
# iptables 模式:默认,稳定但性能稍差
### iptables 模式排查
ssh
ssh
SSH 暴力破解防御指南 — 公钥认证 / fail2ban / 2FA / 入侵检测 / 连接限制 / 蜜罐
iptables -L f2b-sshd -n # 查看规则
iptables -A INPUT -p tcp -s <运维IP> --dport 2222 -j ACCEPT
| **止血**(15min) | `pkill -kill -t
| [[network-troubleshooting-order]] | iptables / firewalld 防火墙规则配置 |
| [[anti-brute-force-script]] | SSH 防暴力破解自动化脚本(iptables 封禁/白名单/通知/监控)——fail2ban 轻量替代方案 |
容器网络排障 6 层模型 — K8s/Docker/containerd 统一排查体系
| ④ 转发与 NAT 层 | iptables/nft FORWARD & MASQUERADE 生效? | `iptables -L -n -v`, `iptables -t nat -L -n -v` |
| ⑤ 主机与内核层 | ip_forward、rp_filter、bridge-nf-call-iptables 等阻断? | `sysctl net.ipv4.ip_forward`, `sysctl net.ipv4.conf.all.rp_filter` |
5. **NAT 命中** — `iptables -t nat -L -n -v` → pkts/bytes 增长,MASQUERADE 是否存在
- **宿主机:** `ip -br link` · `bridge fdb show` · `iptables -L -n -v`
Linux SSH 防暴力破解脚本 — anti_brute_force.sh 实战部署指南
> 一个功能完整的 Linux 防暴力破解 bash 脚本,自动检测 SSH 登录失败行为,对恶意 IP 进行 iptables/ufw 封禁。可作为 fail2ban 的轻量替代或补充方案。
| 自动封禁 IP | 超过阈值的 IP 自动被 iptables/ufw 封禁 |
脚本通过解析系统 SSH 认证日志(`/var/log/auth.log` 或 `/var/log/secure`),使用 `grep "Failed password"` 提取失败登录 IP,按出现次数排序。超过 `MAX_ATTEMPTS` 阈值的 IP 自动通过 `iptables -I INPUT -s
- 脚本依赖 iptables 或 ufw,检查是否已安装
服务器安全加固清单 — 新机器上线前必做的 20 件事
⚠️ 任何生产环境操作前,必须先做好备份和快照。加固涉及 SSH、iptables、服务重启,操作失误可能导致服务器无法登录。
# iptables 底层(firewalld 操作前务必备份)
sudo iptables-save > /root/iptables.bak
| [[network-troubleshooting-order]] | 防火墙 / iptables 配置与排障 |
Wiki Index
- [[anti-brute-force-script]] — SSH 防暴力破解脚本:iptables/ufw 自动封禁 + whitelist + Webhook 通知 + systemd 服务
- [[k8s-dns-iptables-troubleshooting]] — K8s DNS 故障真实案例复盘:iptables 封禁 53 端口导致 CoreDNS 雪崩,完整排障过程与加固方案
- [[k8s-iptables-ipvs-switch-guide]] — Kubernetes kube-proxy 模式选型与切换:iptables vs IPVS 原理对比、性能拐点、切换操作全流程、踩坑指南
- [[ops-interview-50-questions]] — 运维工程师面试 50 题:经典 Linux/网络/数据库基础全覆盖(OSI/LVM/RAID/iptables/systemd/MySQL/Docker)
Wiki Log
- 完整的 Linux SSH 防暴力破解 bash 脚本(iptables/ufw 自动封禁)
- 本文系统讲解 Kubernetes 负载均衡从 Service 数据面到生产级流量治理的全链路方案,涵盖 kube-proxy(iptables/IPVS/eBPF)三种模式对比、Ingress Controller 选型、Service Mesh 影响分析、conntrack 高并发陷阱与止血方案、无损发布与灰度策略、跨可用区流量治理
| 2026-06-02 11:22 | create | k8s-dns-iptables-troubleshooting | tags: kubernetes,dns,iptables,troubleshooting,networking,production | source: 刘军军 2026-05-28 | P2 auto-publish, 4 cross-refs |
| 2026-06-08 11:20 | create | k8s-iptables-ipvs-switch-guide | tags: kubernetes,networking,performance,troubleshooting,architecture | source: 老郭 2026-05-09 | P2 auto-publish, 5 cross-refs |
Docker 生产环境踩坑指南 — 10 + 5 个常见问题
- iptables 规则被意外修改:Docker 自动添加的 NAT 规则被清理
# 检查 Docker iptables NAT 规则
iptables -t nat -L -n | grep DOCKER
Linux 目录结构完全指南 — FHS 标准与运维实战
`fdisk`, `mkfs`, `mount`, `sysctl`, `iptables`, `reboot`, `shutdown`, `modprobe`
├── firewalld/ / iptables/ # 防火墙配置
| 查看防火墙规则 | /etc/firewalld/zones/ / /etc/iptables/ |
Wiki Schema
- iptables: iptables 防火墙规则与排障
DevOps 技术面试指南 — 容器/云原生/内核 59 题
| 50 | iptables vs ipvs? | iptables:规则链匹配(规模大效率低);ipvs:哈希表转发(效率高/支持会话保持)。kube-proxy mode 切换 | [[service-troubleshooting]] |
Kubernetes CoreDNS 自定义域名解析 — 五种场景从原理到生产实操
- [[k8s-dns-iptables-troubleshooting]] — K8s DNS 故障真实案例复盘:iptables 封禁 53 端口导致 CoreDNS 雪崩,完整
K8s 高频问题一站式排查清单 — 10 大故障场景快速参考
| kube-proxy 转发 | iptables/ipvs 规则、kube-proxy 日志 | `iptables-save -t nat`, `ipvsadm -Ln` |
K8s 生产排障基本原则与快速定位流程
- kube-proxy 的 iptables/ipvs 规则是否正确生成
Linux 服务器 CPU 飙高排查 — 完整方法论 + 应急响应实战
| `%soft` 高 | 软中断 | 网卡小包洪峰、iptables/conntrack 压力 |
DNS 故障排查实战指南 — 从本地解析到权威 DNS 全链路
- [[k8s-dns-iptables-troubleshooting]] — K8s DNS 故障真实案例复盘:iptables 封禁 53 端口导致 CoreDNS 雪崩,完整
Linux 入侵检测与应急响应 — AIDE/rkhunter/auditd 安全事件排查实战
│ 网络层:iptables/nftables + Suricata NIDS │
NFS 故障排查 SOP — 7 步法 / 6 类故障 / 实战案例
> 若 111/2049 不通 → 检查 firewalld/iptables、云平台安全组、中间防火墙策略。
TCP 连接数爆表:攻击还是 Bug 排查指南
| **攻击** | iptables 限制单 IP 并发(`--connlimit-above 50`);接入云厂商 DDoS 高防;临时扩容 |
Nginx 502/504/Connection Reset 深度排查指南
| ③ 防火墙 | `iptables -L -n` | 是否拦截了 upstream 端口 |
Nginx 典型配置错误复盘 — 20+ 个踩坑点详解
├── 2. 网络连通性(telnet/ping/iptables)
Nginx 安全配置实战 — 防DDoS/限流/WAF 规则编写
| [[network-troubleshooting-order]] | 防火墙/iptables 与 Nginx 安全联动 |