我的学号后三位是235,姓名拼音是wyw,按照这个实验文档给出了我的实验拓扑图和具体的实验步骤
Created on: April 27, 2026
Answered using GPT-5.5 Thinking by Chat01
Created on: April 27, 2026
Answered using GPT-5.5 Thinking by Chat01
我的学号后三位是235,姓名拼音是wyw,按照这个实验文档给出了我的实验拓扑图和具体的实验步骤
下面是按你上传的《实验8 交换实验手册》定制后的版本:学号后三位 235,所以学号后两位为 35;姓名拼音为 wyw。文档中要求“IP 第 2 字节改为学号后 2 位、VLAN 后两位改为学号后 2 位、VTP 域名改为姓名、密码改为姓名+学号后三位”等,我已统一替换。(实验8 交换实验手册.docx)
| 项目 | 你的值 |
|---|---|
| 学号后三位 | 235 |
| 学号后两位 | 35 |
| 姓名拼音 | wyw |
| VTP domain | wyw |
| VTP password | wyw235 |
| EtherChannel 编号 | 35 |
| OSPF 进程号 | 35 |
| ACL 编号 | 35 |
文档中的 VLAN 100、200、300、400 按“后两位改为 35”处理:
| 原 VLAN | 你的 VLAN | 网段 | 网关/HSRP 虚拟 IP |
|---|---|---|---|
| VLAN100 | VLAN135 | 172.35.4.0/24 | 172.35.4.254 |
| VLAN200 | VLAN235 | 172.35.5.0/24 | 172.35.5.254 |
| VLAN300 | VLAN335 | 172.35.6.0/24 | 172.35.6.254 |
| VLAN400 | VLAN435 | 172.35.7.0/24 | 172.35.7.254 |
可按下面关系在 Packet Tracer 中连线:
mermaidflowchart TB Server1["Server1\nVLAN135\n172.35.4.1/24\nGW 172.35.4.254"] -->|F0/3| SW3 PC1["PC1\nVLAN235\n172.35.5.1/24\nGW 172.35.5.254"] -->|F0/4| SW3 PC2["PC2\nVLAN335\n172.35.6.1/24\nGW 172.35.6.254"] -->|F0/5| SW3 PC3["PC3\nVLAN235\n172.35.5.2/24\nGW 172.35.5.254"] -->|F0/3| SW4 PC4["PC4\nVLAN335\n172.35.6.2/24\nGW 172.35.6.254"] -->|F0/4| SW4 PC5["PC5\nVLAN435\n172.35.7.1/24\nGW 172.35.7.254"] -->|F0/5| SW4 SW3 <-->|Trunk F0/1| SW1 SW3 <-->|Trunk F0/2| SW2 SW4 <-->|Trunk F0/1| SW1 SW4 <-->|Trunk F0/2| SW2 SW1 <-->|EtherChannel 35\nF0/3-F0/4| SW2 SW1 -->|G0/1\n172.35.1.2/24| R1["R1\nF0/0 172.35.1.1/24\nF0/1 172.35.2.1/24\nS1/0 222.21.133.1/24"] SW2 -->|G0/1\n172.35.2.2/24| R1 R1 <-->|Serial\n222.21.133.0/24| R2["R2\nS1/0 222.21.133.2/24\nF0/0 222.21.132.254/24"] R2 --> Server2["Server2\n222.21.132.1/24\nGW 222.21.132.254"]
说明:Packet Tracer 中接口名可能显示为
S0/0/0、S0/0/1,如果不是S1/0,按你设备实际接口名替换即可。
| 设备 | VLAN | IP 地址 | 子网掩码 | 网关 | 接入交换机接口 |
|---|---|---|---|---|---|
| Server1 | 135 | 172.35.4.1 | 255.255.255.0 | 172.35.4.254 | SW3 F0/3 |
| PC1 | 235 | 172.35.5.1 | 255.255.255.0 | 172.35.5.254 | SW3 F0/4 |
| PC2 | 335 | 172.35.6.1 | 255.255.255.0 | 172.35.6.254 | SW3 F0/5 |
| PC3 | 235 | 172.35.5.2 | 255.255.255.0 | 172.35.5.254 | SW4 F0/3 |
| PC4 | 335 | 172.35.6.2 | 255.255.255.0 | 172.35.6.254 | SW4 F0/4 |
| PC5 | 435 | 172.35.7.1 | 255.255.255.0 | 172.35.7.254 | SW4 F0/5 |
| Server2 | - | 222.21.132.1 | 255.255.255.0 | 222.21.132.254 | R2 F0/0 |
bashenable configure terminal hostname R1 interface f0/0 ip address 172.35.1.1 255.255.255.0 no shutdown exit interface f0/1 ip address 172.35.2.1 255.255.255.0 no shutdown exit interface s1/0 ip address 222.21.133.1 255.255.255.0 clock rate 64000 no shutdown exit
如果你的串口不是 DCE 端,clock rate 64000 可以不配。
bashenable configure terminal hostname R2 interface s1/0 ip address 222.21.133.2 255.255.255.0 no shutdown exit interface f0/0 ip address 222.21.132.254 255.255.255.0 no shutdown exit
bashenable configure terminal hostname SW1 ip routing interface g0/1 no switchport ip address 172.35.1.2 255.255.255.0 no shutdown exit
bashenable configure terminal hostname SW2 ip routing interface g0/1 no switchport ip address 172.35.2.2 255.255.255.0 no shutdown exit
bashconfigure terminal interface range f0/3 - 4 channel-protocol pagp channel-group 35 mode desirable no shutdown exit interface port-channel 35 switchport trunk encapsulation dot1q switchport mode trunk no shutdown exit port-channel load-balance dst-ip
bashconfigure terminal interface range f0/3 - 4 channel-protocol pagp channel-group 35 mode desirable no shutdown exit interface port-channel 35 switchport trunk encapsulation dot1q switchport mode trunk no shutdown exit port-channel load-balance dst-ip
若交换机提示不支持 switchport trunk encapsulation dot1q,直接跳过该命令,继续配置 switchport mode trunk。
bashconfigure terminal vtp mode server vtp domain wyw vtp version 2 vtp password wyw235
bashconfigure terminal vtp mode server vtp domain wyw vtp version 2 vtp password wyw235
bashenable configure terminal hostname SW3 vtp mode client vtp domain wyw vtp version 2 vtp password wyw235
bashenable configure terminal hostname SW4 vtp mode client vtp domain wyw vtp version 2 vtp password wyw235
bashconfigure terminal vlan 135 name VLAN135_Server exit vlan 235 name VLAN235_PC exit vlan 335 name VLAN335_PC exit vlan 435 name VLAN435_PC exit
bashconfigure terminal vlan 135 name VLAN135_Server exit vlan 235 name VLAN235_PC exit vlan 335 name VLAN335_PC exit vlan 435 name VLAN435_PC exit
在 SW3、SW4 上检查是否通过 VTP 学到 VLAN:
bashshow vlan brief
bashconfigure terminal interface range f0/1 - 2 switchport trunk encapsulation dot1q switchport mode trunk no shutdown exit
bashconfigure terminal interface range f0/1 - 2 switchport trunk encapsulation dot1q switchport mode trunk no shutdown exit
bashconfigure terminal interface range f0/1 - 2 switchport mode trunk no shutdown exit
bashconfigure terminal interface range f0/1 - 2 switchport mode trunk no shutdown exit
bashconfigure terminal interface f0/3 switchport mode access switchport access vlan 135 no shutdown exit interface f0/4 switchport mode access switchport access vlan 235 no shutdown exit interface f0/5 switchport mode access switchport access vlan 335 no shutdown exit
bashconfigure terminal interface f0/3 switchport mode access switchport access vlan 235 no shutdown exit interface f0/4 switchport mode access switchport access vlan 335 no shutdown exit interface f0/5 switchport mode access switchport access vlan 435 no shutdown exit
SW1 作为 VLAN135、VLAN235 的 Active,VLAN335、VLAN435 的 Standby。
bashconfigure terminal interface vlan 135 ip address 172.35.4.250 255.255.255.0 standby 10 ip 172.35.4.254 standby 10 priority 115 standby 10 preempt standby 10 track g0/1 no shutdown exit interface vlan 235 ip address 172.35.5.250 255.255.255.0 standby 20 ip 172.35.5.254 standby 20 priority 115 standby 20 preempt standby 20 track g0/1 no shutdown exit interface vlan 335 ip address 172.35.6.250 255.255.255.0 standby version 2 standby 30 ip 172.35.6.254 standby 30 priority 110 standby 30 preempt standby 30 track g0/1 no shutdown exit interface vlan 435 ip address 172.35.7.250 255.255.255.0 standby version 2 standby 40 ip 172.35.7.254 standby 40 priority 110 standby 40 preempt standby 40 track g0/1 no shutdown exit
SW2 作为 VLAN335、VLAN435 的 Active,VLAN135、VLAN235 的 Standby。
bashconfigure terminal interface vlan 135 ip address 172.35.4.251 255.255.255.0 standby 10 ip 172.35.4.254 standby 10 priority 110 standby 10 preempt standby 10 track g0/1 no shutdown exit interface vlan 235 ip address 172.35.5.251 255.255.255.0 standby 20 ip 172.35.5.254 standby 20 priority 110 standby 20 preempt standby 20 track g0/1 no shutdown exit interface vlan 335 ip address 172.35.6.251 255.255.255.0 standby version 2 standby 30 ip 172.35.6.254 standby 30 priority 115 standby 30 preempt standby 30 track g0/1 no shutdown exit interface vlan 435 ip address 172.35.7.251 255.255.255.0 standby version 2 standby 40 ip 172.35.7.254 standby 40 priority 115 standby 40 preempt standby 40 track g0/1 no shutdown exit
检查命令:
bashshow standby brief
bashconfigure terminal spanning-tree mode pvst spanning-tree vlan 135,235 root primary spanning-tree vlan 335,435 root secondary
bashconfigure terminal spanning-tree mode pvst spanning-tree vlan 135,235 root secondary spanning-tree vlan 335,435 root primary
检查命令:
bashshow spanning-tree vlan 135 show spanning-tree vlan 235 show spanning-tree vlan 335 show spanning-tree vlan 435
预期结果:
| VLAN | 根交换机 | 备份根 |
|---|---|---|
| VLAN135 | SW1 | SW2 |
| VLAN235 | SW1 | SW2 |
| VLAN335 | SW2 | SW1 |
| VLAN435 | SW2 | SW1 |
bashconfigure terminal router ospf 35 network 172.35.1.0 0.0.0.255 area 0 network 172.35.4.0 0.0.0.255 area 0 network 172.35.5.0 0.0.0.255 area 0 network 172.35.6.0 0.0.0.255 area 0 network 172.35.7.0 0.0.0.255 area 0 exit
bashconfigure terminal router ospf 35 network 172.35.2.0 0.0.0.255 area 0 network 172.35.4.0 0.0.0.255 area 0 network 172.35.5.0 0.0.0.255 area 0 network 172.35.6.0 0.0.0.255 area 0 network 172.35.7.0 0.0.0.255 area 0 exit
bashconfigure terminal router ospf 35 network 172.35.1.0 0.0.0.255 area 0 network 172.35.2.0 0.0.0.255 area 0 exit
检查命令:
bashshow ip ospf neighbor show ip route ospf
bashconfigure terminal ip route 0.0.0.0 0.0.0.0 222.21.133.2
bashrouter ospf 35 default-information originate exit
在 SW1、SW2 上检查:
bashshow ip route
应能看到类似:
bashO*E2 0.0.0.0/0 via 172.35.1.1
或:
bashO*E2 0.0.0.0/0 via 172.35.2.1
bashconfigure terminal access-list 35 permit 172.35.0.0 0.0.255.255 ip nat pool xcu 222.21.133.10 222.21.133.20 netmask 255.255.255.0 interface f0/0 ip nat inside exit interface f0/1 ip nat inside exit interface s1/0 ip nat outside exit ip nat inside source list 35 pool xcu overload
测试:
bashPC1> ping 222.21.132.1
如果配置正确,PC1 应能 ping 通 Server2。
查看 NAT 转换:
bashshow ip nat translations
bashconfigure terminal ip nat inside source static 172.35.4.1 222.21.133.21
公网用户 Server2 访问 Server1 时,应访问:
text222.21.133.21
原因:Server1 的真实地址 172.35.4.1 是内网私有地址,公网不能直接访问;R1 通过静态 NAT 把它映射为公网侧地址 222.21.133.21。
测试:
bashServer2> ping 222.21.133.21
PC1 连接在 SW3 的 F0/4,配置端口安全如下:
bashconfigure terminal interface f0/4 switchport mode access switchport access vlan 235 switchport port-security switchport port-security maximum 1 switchport port-security mac-address sticky switchport port-security violation shutdown exit
查看配置:
bashshow running-config
查看端口安全状态:
bashshow port-security interface f0/4
修改 PC1 MAC 地址后再次 ping PC4,预期结果是:
textping 不通,SW3 的 F0/4 会进入 err-disabled / shutdown 状态。
恢复方法:
bashconfigure terminal interface f0/4 shutdown no shutdown exit
必要时还需要清除旧的 sticky MAC:
bashclear port-security sticky interface f0/4
主要有三类:
| 类型 | 模式 | 说明 |
|---|---|---|
| PAgP | desirable / auto | Cisco 私有协议;desirable 主动协商,auto 被动等待 |
| LACP | active / passive | IEEE 标准协议;active 主动协商,passive 被动等待 |
| On | on | 强制形成 EtherChannel,不进行协商 |
常见组合:
| 组合 | 是否能形成 EtherChannel |
|---|---|
| desirable + desirable | 可以 |
| desirable + auto | 可以 |
| auto + auto | 不可以 |
| active + active | 可以 |
| active + passive | 可以 |
| passive + passive | 不可以 |
| on + on | 可以,但无协商,要求两端配置完全一致 |
常见方式有:
textsrc-mac dst-mac src-dst-mac src-ip dst-ip src-dst-ip src-port dst-port src-dst-port
如果按源进行负载均衡,通常使用:
bashport-channel load-balance src-ip
如果按目的进行负载均衡,通常使用:
bashport-channel load-balance dst-ip
本实验文档给出的方式是:
bashport-channel load-balance dst-ip
PC1 属于 VLAN235。
| 测试 | 结果 | 原因 |
|---|---|---|
| PC1 ping PC3 | 通 | 同属 VLAN235 |
| PC1 ping PC4 | 不通 | PC4 属于 VLAN335,尚未配置三层网关/HSRP |
| PC1 ping PC5 | 不通 | PC5 属于 VLAN435,尚未配置三层网关/HSRP |
| 测试 | 结果 |
|---|---|
| PC1 ping PC3 | 通 |
| PC1 ping PC4 | 通 |
| PC1 ping PC5 | 通 |
原因:SW1、SW2 已经通过 SVI 和 HSRP 实现 VLAN 间三层转发。
| VLAN | 根桥 | 备份根 | 说明 |
|---|---|---|---|
| VLAN135 | SW1 | SW2 | SW1 root primary |
| VLAN235 | SW1 | SW2 | SW1 root primary |
| VLAN335 | SW2 | SW1 | SW2 root primary |
| VLAN435 | SW2 | SW1 | SW2 root primary |
通常 root primary 会把优先级设置为 24576,root secondary 会设置为 28672,普通交换机默认优先级为 32768。实际显示时,Cisco 可能会把 VLAN ID 加入 Bridge ID,例如 VLAN135 上 SW1 可能显示为 24576 + 135 = 24711。
PC1 在 VLAN235,PC4 在 VLAN335。
推荐观察路径:
textPC1 → SW3 → SW1 → SW2 → SW4 → PC4
原因:
Server1 在 VLAN135,PC3 在 VLAN235。
推荐观察路径:
textServer1 → SW3 → SW1 → SW4 → PC3
原因:
配置 OSPF、默认路由和动态 NAT 后,PC1 ping Server2:
text应能 ping 通。
若不通,重点检查:
bashshow ip route show ip ospf neighbor show ip nat translations show access-lists show ip interface brief
应访问:
text222.21.133.21
原因:Server1 的内网地址是 172.35.4.1,通过 R1 静态 NAT 映射为公网地址 222.21.133.21。
使用:
bashshow running-config
可以看到 F0/4 下多出类似配置:
bashswitchport port-security switchport port-security maximum 1 switchport port-security mac-address sticky switchport port-security mac-address sticky xxxx.xxxx.xxxx switchport port-security violation shutdown
其中 xxxx.xxxx.xxxx 是 PC1 自动学习到的 MAC 地址。
修改 PC1 MAC 地址后再 ping PC4:
textping 不通。
SW3 的 F0/4 会因为安全违规进入:
texterr-disabled / secure-shutdown
查看命令:
bashshow port-security interface f0/4 show interface f0/4 status
恢复接口:
bashconfigure terminal interface f0/4 shutdown no shutdown exit