ip实验:

发布时间:2026/8/16 5:42:59
ip实验: 一、实验拓扑二、实验需求R5 作为 ISP 设备仅配置 IP 地址不运行动态路由协议所有运营商互联网段为公网地址。R1 与 R5 使用 PPP PAP 认证R5 为主认证方R2 与 R5 使用 PPP CHAP 认证R5 为主认证方R3 与 R5 之间链路使用 HDLC 封装。R1、R2、R3 构建 MGRE 环境R1 为中心站点R1 与 R4 之间建立点到点 GRE 隧道。私有内网通过 RIP v2 实现全网可达。所有 PC 以私有 IP 作为源地址能够访问 R5 的环回网段 5.5.5.0/24配置 NAT 实现上网。三、实验思路1、IP 地址规划 全网分为三大类网段运营商公网互联网段、企业内网用户网段、隧道虚拟网段。公网串行 / 以太网链路单独分配独立 C 类网段区分 R1/R2/R3/R4 四条上联链路互不冲突四家企业内网分别使用独立 192.168.x.0/24 私有网段分配给对应路由器下的 PC隧道划分两段 10 段私网10.1.2.0/24 用于 MGRE 多点隧道10.1.1.0/24 用于 R1-R4 点到点 GRE 隧道隧道网段统一属于 10.0.0.0/8 主类网络适配华为 RIP 宣告规则。2、二层链路与 PPP 认证规划 R5 作为 ISP 认证服务器分别对接三种串行二层封装R1 上联串口PPP 封装采用 PAP 明文认证创建 AAA 用户 flower、密码 flower123R1 作为客户端携带账号密码协商R2 上联串口PPP 封装采用 CHAP 密文挑战认证创建 AAA 用户 hua、密码 hua123防止密码明文传输R3 上联串口HDLC 封装无认证仅基础 IP 连通 R4 使用以太网直连 R5无需串行封装。3、GRE 隧道部署规划 分为两种隧道类型实现分支跨公网私网互通MGRE 多点隧道R1 作为中心R2、R3 作为分支统一 Tunnel0/0/0 接口配置 tunnel-protocol gre p2mp搭配 NHRP 协议。中心开启动态注册分支手动注册中心隧道地址实现三个站点隧道内互相通信点到点 GRE 隧道R1 与 R4 单独建立 Tunnel0/0/1配置源、目的公网地址直连互通无需 NHRP。4、内网路由互通规划 全网私有网段统一使用 RIP v2 无类路由协议所有内网路由器宣告各自用户网段 192.168.x.0 与隧道主类网段 10.0.0.0关闭自动汇总保证子网路由完整传递连接 ISP 的公网串口 / 以太网口配置 silent-interface 静默避免 RIP 报文泄露到公网R1-R4 配置默认路由所有未知流量转发至 ISP R5ISP R5 不运行 RIP手动配置静态回程路由精准指向各企业内网网段保证回程流量可达。5、外网访问 NAT 规划 各企业出口路由器配置 Easy IP通过 ACL 抓取本地内网私有网段流量在连接 R5 的公网接口配置 nat outbound借用接口公网 IP 做地址转换内网 PC 访问 R5 环回 5.5.5.5 时源地址自动转换为公网地址ISP 回程路由可正常转发。6、整体测试验证顺序 先验证串行链路二层协商与 PPP 认证成功 → 隧道接口 UP、NHRP 邻居正常注册 → RIP 路由完整学习内网所有网段 → PC 内网跨网段互通 → PC 访问公网 5.5.5.5确认 NAT 转换生效。四、实验配置步骤1. R5Huaweisystem-view[Huawei]sysname R5[R5]interface LoopBack 0[R5-LoopBack0]ip address 5.5.5.5 255.255.255.0[R5-LoopBack0]quit[R5]interface Serial 4/0/1[R5-Serial4/0/1]link-protocol ppp[R5-Serial4/0/1]ip address 15.1.1.5 255.255.255.0[R5-Serial4/0/1]ppp authentication-mode pap[R5-Serial4/0/1]quit[R5]interface Serial 3/0/1[R5-Serial3/0/1]link-protocol ppp[R5-Serial3/0/1]ip address 25.1.1.5 255.255.255.0[R5-Serial3/0/1]ppp authentication-mode chap[R5-Serial3/0/1]quit[R5]interface Serial 4/0/0[R5-Serial4/0/0]link-protocol hdlc[R5-Serial4/0/0]ip address 35.1.1.5 255.255.255.0[R5-Serial4/0/0]quit[R5]interface GigabitEthernet 0/0/0[R5-GigabitEthernet0/0/0]ip address 45.1.1.5 255.255.255.0[R5-GigabitEthernet0/0/0]quit[R5]aaa[R5-aaa]local-user flower password cipher flower123[R5-aaa]local-user flower service-type ppp[R5-aaa]local-user hua password cipher hua123[R5-aaa]local-user hua service-type ppp[R5-aaa]quit[R5]ip route-static 192.168.1.0 255.255.255.0 15.1.1.1[R5]ip route-static 192.168.2.0 255.255.255.0 25.1.1.2[R5]ip route-static 192.168.3.0 255.255.255.0 35.1.1.3[R5]ip route-static 192.168.4.0 255.255.255.0 45.1.1.42、R1Huaweisystem-view[Huawei]sysname R1[R1]interface GigabitEthernet 0/0/0[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 255.255.255.0[R1-GigabitEthernet0/0/0]quit[R1]interface Serial 4/0/0[R1-Serial4/0/0]link-protocol ppp[R1-Serial4/0/0]ip address 15.1.1.1 255.255.255.0[R1-Serial4/0/0]ppp pap local-user flower password cipher flower123[R1-Serial4/0/0]quit[R1]interface Tunnel 0/0/0[R1-Tunnel0/0/0]tunnel-protocol gre p2mp[R1-Tunnel0/0/0]ip address 10.1.2.1 255.255.255.0[R1-Tunnel0/0/0]source 15.1.1.1[R1-Tunnel0/0/0]nhrp network-id 100[R1-Tunnel0/0/0]nhrp entry multicast dynamic[R1-Tunnel0/0/0]quit[R1]interface Tunnel 0/0/1[R1-Tunnel0/0/1]tunnel-protocol gre[R1-Tunnel0/0/1]ip address 10.1.1.1 255.255.255.0[R1-Tunnel0/0/1]source 15.1.1.1[R1-Tunnel0/0/1]destination 45.1.1.4[R1-Tunnel0/0/1]quit[R1]ip route-static 0.0.0.0 0.0.0.0 15.1.1.5[R1]rip 1[R1-rip-1]version 2[R1-rip-1]undo summary[R1-rip-1]network 192.168.1.0[R1-rip-1]network 10.0.0.0[R1-rip-1]silent-interface Serial 4/0/0[R1-rip-1]quit[R1]acl number 2000[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255[R1-acl-basic-2000]quit[R1]interface Serial 4/0/0[R1-Serial4/0/0]nat outbound 2000[R1-Serial4/0/0]quit3、R3Huaweisystem-view[Huawei]sysname R2[R2]interface GigabitEthernet 0/0/0[R2-GigabitEthernet0/0/0]ip address 192.168.2.1 255.255.255.0[R2-GigabitEthernet0/0/0]quit[R2]interface Serial 4/0/0[R2-Serial4/0/0]link-protocol ppp[R2-Serial4/0/0]ip address 25.1.1.2 255.255.255.0[R2-Serial4/0/0]ppp chap user hua[R2-Serial4/0/0]ppp chap password cipher hua123[R2-Serial4/0/0]quit[R2]interface Tunnel 0/0/0[R2-Tunnel0/0/0]tunnel-protocol gre p2mp[R2-Tunnel0/0/0]ip address 10.1.2.2 255.255.255.0[R2-Tunnel0/0/0]source 25.1.1.2[R2-Tunnel0/0/0]nhrp network-id 100[R2-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register[R2-Tunnel0/0/0]quit[R2]ip route-static 0.0.0.0 0.0.0.0 25.1.1.5[R2]rip 1[R2-rip-1]version 2[R2-rip-1]undo summary[R2-rip-1]network 192.168.2.0[R2-rip-1]network 10.0.0.0[R2-rip-1]silent-interface Serial 4/0/0[R2-rip-1]quit[R2]acl number 2000[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255[R2-acl-basic-2000]quit[R2]interface Serial 4/0/0[R2-Serial4/0/0]nat outbound 2000[R2-Serial4/0/0]quit4、R3Huaweisystem-view[Huawei]sysname R3[R3]interface GigabitEthernet 0/0/0[R3-GigabitEthernet0/0/0]ip address 192.168.3.1 255.255.255.0[R3-GigabitEthernet0/0/0]quit[R3]interface Serial 4/0/0[R3-Serial4/0/0]link-protocol hdlc[R3-Serial4/0/0]ip address 35.1.1.3 255.255.255.0[R3-Serial4/0/0]quit[R3]interface Tunnel 0/0/0[R3-Tunnel0/0/0]tunnel-protocol gre p2mp[R3-Tunnel0/0/0]ip address 10.1.2.3 255.255.255.0[R3-Tunnel0/0/0]source 35.1.1.3[R3-Tunnel0/0/0]nhrp network-id 100[R3-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register[R3-Tunnel0/0/0]quit[R3]ip route-static 0.0.0.0 0.0.0.0 35.1.1.5[R3]rip 1[R3-rip-1]version 2[R3-rip-1]undo summary[R3-rip-1]network 192.168.3.0[R3-rip-1]network 10.0.0.0[R3-rip-1]silent-interface Serial 4/0/0[R3-rip-1]quit[R3]acl number 2000[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255[R3-acl-basic-2000]quit[R3]interface Serial 4/0/0[R3-Serial4/0/0]nat outbound 2000[R3-Serial4/0/0]quit5、R4Huaweisystem-view[Huawei]sysname R4[R4]interface GigabitEthernet 0/0/1[R4-GigabitEthernet0/0/1]ip address 192.168.4.1 255.255.255.0[R4-GigabitEthernet0/0/1]quit[R4]interface GigabitEthernet 0/0/0[R4-GigabitEthernet0/0/0]ip address 45.1.1.4 255.255.255.0[R4-GigabitEthernet0/0/0]quit[R4]interface Tunnel 0/0/1[R4-Tunnel0/0/1]tunnel-protocol gre[R4-Tunnel0/0/1]ip address 10.1.1.2 255.255.255.0[R4-Tunnel0/0/1]source 45.1.1.4[R4-Tunnel0/0/1]destination 15.1.1.1[R4-Tunnel0/0/1]quit[R4]ip route-static 0.0.0.0 0.0.0.0 45.1.1.5[R4]rip 1[R4-rip-1]version 2[R4-rip-1]undo summary[R4-rip-1]network 192.168.4.0[R4-rip-1]network 10.0.0.0[R4-rip-1]silent-interface GigabitEthernet 0/0/0[R4-rip-1]quit[R4]acl number 2000[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255[R4-acl-basic-2000]quit[R4]interface GigabitEthernet 0/0/0[R4-GigabitEthernet0/0/0]nat outbound 2000[R4-GigabitEthernet0/0/0]quit