From b6d8e256341f0d09152f04b3975de6d70d30f7e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E6=B5=A9=E5=A4=A9?= <1924295747@qq.com> Date: Fri, 27 Nov 2026 22:50:16 +0800 Subject: [PATCH] 11 --- ...16\351\230\262\347\201\253\345\242\231.md" | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 "35 \346\254\247\351\230\263\346\265\251\345\244\251/20261125 \347\275\221\347\273\234\351\205\215\347\275\256\346\216\222\351\232\234\344\270\216\351\230\262\347\201\253\345\242\231.md" diff --git "a/35 \346\254\247\351\230\263\346\265\251\345\244\251/20261125 \347\275\221\347\273\234\351\205\215\347\275\256\346\216\222\351\232\234\344\270\216\351\230\262\347\201\253\345\242\231.md" "b/35 \346\254\247\351\230\263\346\265\251\345\244\251/20261125 \347\275\221\347\273\234\351\205\215\347\275\256\346\216\222\351\232\234\344\270\216\351\230\262\347\201\253\345\242\231.md" new file mode 100644 index 0000000..d3ebc41 --- /dev/null +++ "b/35 \346\254\247\351\230\263\346\265\251\345\244\251/20261125 \347\275\221\347\273\234\351\205\215\347\275\256\346\216\222\351\232\234\344\270\216\351\230\262\347\201\253\345\242\231.md" @@ -0,0 +1,70 @@ +## 十、课后作业 + +### 基础题 1:网络故障判断 + +**背景**:同事发来三台服务器的三连 ping 结果: + +| 服务器 | ping 网关 | ping 223.5.5.5 | ping www.baidu.com | +| :----: | :-------: | :---------------------------: | :----------------: | +| A | ✅ | ✅ | ❌ | +| B | ✅ | ❌(`Network is unreachable`) | ❌ | +| C | ❌ | ❌ | ❌ | + +**要求**:分别说出 A、B、C 的问题出在哪一层,以及第一条该敲什么命令去查。 +**提交**:文字回答。 + +A:DNS有问题,用`cat /etc/resolv.conf` 看有没有 `nameserver + +B:出不了外网,`ip r` 看有没有 `default via` + +C:**本机网卡 / IP 有问题**,`ip a` 看是不是 `UP`、有没有 `inet` + +### 基础题 2:静态 IP 配置 + +**要求**: + +1. 把 `vm-local` 配置为静态 IP(IP 用你当前的地址,网关和 DNS 以自己环境为准); +2. 重启虚拟机后 IP 不变,三连 ping 全通; +3. 主机名改为 `web01`,并同步 `/etc/hosts`。 + +**验证标准**:`ip a show ens33` 中没有 `dynamic`;`hostname` 输出 `web01`;`sudo` 不报 `unable to resolve host`。 +**提交**:`cat /etc/network/interfaces`、`ip a show ens33`、`hostname` 三张截图。![2.1](https://gitee.com/ouyang-haotian921/picture/raw/master/pic/upgit_20261127_1795790951.PNG) + +![2.2](https://gitee.com/ouyang-haotian921/picture/raw/master/pic/upgit_20261127_1795790960.PNG) + +![2.3](https://gitee.com/ouyang-haotian921/picture/raw/master/pic/upgit_20261127_1795790966.PNG) + +### 提高题:防火墙上线 + +**背景**:`web01` 要用 Nginx 上线一个网站,端口 `80`。 + +**要求**: + +1. 安装并启动 `nginx`,把 `/var/www/html/index.html` 内容改为 `web01 ok`; +2. 按正确顺序启用 `ufw`:SSH 不能断,网站外面能访问; +3. 在 Windows 上用 `curl.exe` 访问成功。 + +**验证标准**:`ufw status verbose` 显示 `active`,有 22 和 80 的放行规则;Windows 访问返回 `200 OK`。 +**提交**:完整命令清单 + `ufw status verbose` 截图 + Windows 访问截图。 + +![3.1](./%E4%BD%9C%E4%B8%9A%E6%88%AA%E5%9B%BE/3.1.PNG) + +![3.2](./%E4%BD%9C%E4%B8%9A%E6%88%AA%E5%9B%BE/3.2.PNG) + +![3.3](https://gitee.com/ouyang-haotian921/picture/raw/master/pic/upgit_20261127_1795790973.PNG) + +### 挑战题:故障排查报告 + +**背景**:讲师(或同桌)在你的 `vm-local` 上预埋了下面**其中两个**故障: + +- `/etc/resolv.conf` 被清空; +- Nginx 服务被停掉(`systemctl stop nginx`); +- `ufw` 中 80 的放行规则被删除。 + +**要求**: + +1. 只告诉你“二维码打不开”,按本课排障顺序逐层排查; +2. 找出两个故障并修复; +3. 写一份 150 字以内的排查记录:**现象 → 查了什么 → 发现什么 → 怎么修 → 怎么验证**。 + +**提交**:排查记录 + 关键命令截图。 \ No newline at end of file -- Gitee