)
此文章我用的ai 跑的可能会出一些小错误我会尽量检查一下请谅解二层局域网搭建思科模拟器-CSDN博客三层网络搭建思科模拟器-CSDN博客《企业网络架构实战一基于OSPF的高可用网络搭建》-思科模拟器-CSDN博客《企业网络实战二NAT 实现内网 Web 服务对外发布》-CSDN博客上面是我写的最后一部分这些分开的是我做实验的时候一边做一边写的比较清楚这个看的难受可以看上面的每一个都附带下一章节的链接## 全过程步骤从零到高可用企业网络### 一、基础拓扑与接口配置#### 1. 设备与连接- **路由器**两台Router1、Router2均添加 HWIC-4ESW 二层交换模块。- **交换机**三台 2950 交换机左、中、右。- **PC**PC0、PC1左PC2、PC3中PC4、PC5右。- **服务器**Server0左交换机下。- **外网 PC**连接 Router1 的扩展接口如 Fa0/0/2。#### 2. Router1 基础接口配置bashenableconfigure terminal! 内网接口连接左侧交换机interface fastEthernet 0/0ip address 192.168.1.1 255.255.255.0no shutdown! 内网接口连接中间交换机interface fastEthernet 0/1ip address 192.168.2.1 255.255.255.0no shutdown! 冗余链路1使用交换模块接口 Fa0/0/0interface fastEthernet 0/0/0switchport mode accessswitchport access vlan 10no shutdownexitinterface vlan 10ip address 192.168.10.1 255.255.255.252no shutdown! 冗余链路2使用交换模块接口 Fa0/0/1interface fastEthernet 0/0/1switchport mode accessswitchport access vlan 20no shutdownexitinterface vlan 20ip address 192.168.20.1 255.255.255.252no shutdown! 外网接口使用交换模块接口 Fa0/0/2划入 VLAN 30interface fastEthernet 0/0/2switchport mode accessswitchport access vlan 30no shutdownexitinterface vlan 30ip address 203.0.113.1 255.255.255.0no shutdownexitwrite memory#### 3. Router2 基础接口配置bashenableconfigure terminal! 内网接口连接中间交换机interface fastEthernet 0/0ip address 192.168.2.2 255.255.255.0no shutdown! 内网接口连接右侧交换机interface fastEthernet 0/1ip address 192.168.3.1 255.255.255.0no shutdown! 冗余链路1使用交换模块接口 Fa0/0/0interface fastEthernet 0/0/0switchport mode accessswitchport access vlan 10no shutdownexitinterface vlan 10ip address 192.168.10.2 255.255.255.252no shutdown! 冗余链路2使用交换模块接口 Fa0/0/1interface fastEthernet 0/0/1switchport mode accessswitchport access vlan 20no shutdownexitinterface vlan 20ip address 192.168.20.2 255.255.255.252no shutdownexitwrite memory---### 二、动态路由 OSPF 配置替代静态路由#### 1. 删除原有静态路由如果存在bash! 在 Router1 上no ip route 192.168.3.0 255.255.255.0 192.168.10.2! 在 Router2 上no ip route 192.168.1.0 255.255.255.0 192.168.10.1#### 2. 配置 OSPF**Router1**bashrouter ospf 1network 192.168.1.0 0.0.0.255 area 0network 192.168.10.0 0.0.0.3 area 0network 192.168.20.0 0.0.0.3 area 0**Router2**bashrouter ospf 1network 192.168.3.0 0.0.0.255 area 0network 192.168.10.0 0.0.0.3 area 0network 192.168.20.0 0.0.0.3 area 0#### 3. 验证 OSPFbashshow ip ospf neighbor # 应看到两个 FULL 邻居show ip route ospf # 应看到对方网段有两条等价下一跳---### 三、NAT 配置发布内网 Web 服务#### 1. 定义内外网接口bashRouter1 enableRouter1# configure terminal! 内网接口连接左侧交换机interface fastEthernet 0/0ip nat inside! 外网接口VLAN 30interface vlan 30ip nat outsideexit#### 2. 配置静态 NAT 映射假设 Web 服务器 IP 为 192.168.1.10左侧交换机下baship nat inside source static tcp 192.168.1.10 80 203.0.113.1 80#### 3. 保存配置bashendwrite memory---### 四、Web 服务器与外网 PC 配置#### 1. Web 服务器Server0- 连接至左侧交换机的任意空闲接口如 Fa0/4。- **IP 配置**192.168.1.100/24网关 192.168.1.1。- **开启 HTTP 服务**在 Services 选项卡中启用 HTTP端口 80。#### 2. 外网 PC- 连接至 Router1 的 Fa0/0/2 接口已划入 VLAN 30。- **IP 配置**203.0.113.2/24网关 203.0.113.1。---### 五、验证与测试#### 1. 基本连通性- 从外网 PC ping 203.0.113.1应通。- 从外网 PC 浏览器访问 http://203.0.113.1应显示 Web 页面。#### 2. 查看 NAT 表项bashRouter1# show ip nat translations应看到静态映射条目。#### 3. 高可用验证冗余链路- 在外网 PC 上持续 ping 203.0.113.1或访问网页。- 在 Router1 上执行bashconfigure terminalinterface vlan10shutdown- 观察 ping 窗口短暂超时后恢复因为 OSPF 将流量切换至另一条链路。- 恢复链路no shutdown路由表重新出现两条等价路径。---### 六、最终网络状态- **动态路由**OSPF 全网互通两条链路负载均衡。- **高可用**任意一条链路故障业务自动切换丢包5个。- **服务发布**内网 Web 服务器通过 NAT 对外提供访问。- **扩展性**新增网段只需在 OSPF 中宣告无需手动指路由。---