一、拓扑图
二、需求
1、R5为ISP,只能进行IP地址配置,其所有地址均配为公有I地址;
2、R1和R5间使用PPP的PAP认证,R5为主认证方,
R2与R5之间使用ppp的CHAP认证,R5为主认证方;
R3与R5之间使用HDLc封装;
3、R1、R2、R3构建一个MGRE环境,R1为中心站点,
R1、R4间为点到点的GRE;
4、整个私有网络基本RIP全网可达;
5.所有Pc设置私有IP为源IP,可以访问R5环回。
三、分析
1、配置IP地址
2、配置静态路由使得公网全网通。
3、配置PPP的PAP 认证,R5为主认证方。
步骤1:在R5上,开启aaa模式,创建用户名、密码,设置权限
步骤2:在R5上,设置为PPP协议,进入物理接口设置PPP的认证模式为PAP
步骤3:在R1上,进入物理接口,配置相同的用户名及密码。
4、配置PPP的CHAP 认证,R5为主认证方。
步骤1:在R5上,开启aaa模式,创建用户名、密码,设置权限
步骤2:在R5上,设置为PPP协议,进入物理接口设置PPP的认证模式为CHAP
步骤3:在R1上,进入物理接口,配置相同的用户名及密码。
5、配置HDLC封装
两边都进入接口,修改接口类型为 hdlc
6、配置MGRE,R1为中心站点
步骤1:创建隧道接口,配置IP地址,封装方式设置为MGRE(gre p2mp),配置隧道对应物理接口的源IP地址。
步骤2:在R1上配置中心站点,宣告NHRP域,在R2、R3上配置分支站点,并向中心站点注册自身的隧道接口信息。
步骤3:配置RIP动态路由,宣告隧道网段和私网网段,使得可达全网可达。
7、配置GRE,R1为中心站点
步骤1:创建隧道接口,配置IP地址,封装方式设置为GRE(gre),配置隧道对应物理接口的源IP地址和目标隧道封装的物理接口的IP地址。
步骤2:配置RIP动态路由,宣告隧道网段和私网网段,使得可达全网可达。
8、配置EASY IP使得所有PC都可访问公网,访问ISP的环回。
步骤1:配置缺省路由,全网可达,配置ACL,将私网的信息过滤抓包出来
步骤2:在接口下,同意放行ACL,私网PC可访问公网ISP环回内容。
四、步骤
1、配置IP地址
PC:
路由器:
R1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0]q
[R1]int Serial 4/0/0
[R1-Serial4/0/0]ip add 15.1.1.1 24
[R1-Serial4/0/0]q
R2:
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.254 24
[R2-GigabitEthernet0/0/0]q
[R2]int Serial 4/0/0
[R2-Serial4/0/0]ip add 25.1.1.2 24
[R2-Serial4/0/0]q
R3:
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.254 24
[R3-GigabitEthernet0/0/0]q
[R3]int Serial 4/0/0
[R3-Serial4/0/0]ip add 35.1.1.3 24
[R3-Serial4/0/0]q
R4:
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.4.254 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 45.1.1.4 24
[R4-GigabitEthernet0/0/1]q
[R4]
ISP:
[ISP]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 45.1.1.5 24
[ISP-GigabitEthernet0/0/0]q
[ISP]int Serial 4/0/0
[ISP-Serial4/0/0]ip add 35.1.1.5 24
[ISP-Serial4/0/0]
[ISP-Serial4/0/0]int Serial 3/0/0
[ISP-Serial3/0/0]ip add 25.1.1.5 24
[ISP-Serial3/0/0]
[ISP-Serial3/0/0]int Serial 4/0/1
[ISP-Serial4/0/1]ip add 15.1.1.5 24
[ISP-Serial4/0/1]
[ISP-Serial4/0/1]q
[ISP]int l0
[ISP-LoopBack0]ip add 5.5.5.5 24
[ISP-LoopBack0]q
配置结果:
2、配置静态路由,使得公网通。
[R1]ip route-static 0.0.0.0 0 15.1.1.5
[R2]ip route-static 0.0.0.0 0 25.1.1.5
[R3]ip route-static 0.0.0.0 0 35.1.1.5
[R4]ip route-static 0.0.0.0 0 45.1.1.5
测试:
3、在R1、R5上配置PPP的PAP 认证,R5为主认证方。
主认证方R5:在aaa模式下,创建用户,说明协议为ppp协议,在接口下说明pap验证。
[ISP]aaa
[ISP-aaa]local-user xixi password cipher xixi123 privilege level 15
Info: Add a new user.
[ISP-aaa]local-user xixi service-type ppp
[ISP-aaa]q
[ISP]int Serial 4/0/1
[ISP-Serial4/0/1]ppp authentication-mode pap
[ISP-Serial4/0/1]q
[ISP]
被认证方R1:在接口下,配置相同的认证用户名和密码
[R1]int Serial 4/0/0
[R1-Serial4/0/0]ppp pa local-user xixi password cipher xixi123
4、在R2、R5上配置PPP的CHAP认证,R5为主认证方
主认证方R5:在aaa模式下,创建用户,说明协议为ppp协议,在接口下说明chap验证。
[ISP]aaa
[ISP-aaa]local-user haha password cipher haha123 privilege level 15
Info: Add a new user.
[ISP-aaa]local-user haha service-type ppp
[ISP-aaa]q
[ISP]int Serial 3/0/0
[ISP-Serial3/0/0]ppp authentication-mode chap
[ISP-Serial3/0/0]q
[ISP]
被认证方R2:在接口下,配置相同的认证用户名和密码
[R2]int Serial 4/0/0
[R2-Serial4/0/0]ppp chap user haha
[R2-Serial4/0/0]ppp chap password cipher haha123
[R2-Serial4/0/0]q
[R2]
5、 在R3、R5上配置HDLC封装
[ISP]int Serial 4/0/0
[ISP-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
[ISP-Serial4/0/0]
[R3]int Serial 4/0/0
[R3-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
[R3-Serial4/0/0]
配置结果;
R3:
ISP:
6、在R1~R3上配置MGRE,R1为中心站点
步骤1:创建隧道接口,配置IP地址,选择封装类型MGRP,配置源IP地址(隧道口对应的真实的物理口IP地址)
R1:
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.2.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 15.1.1.1
Jul 26 2025 15:10:12-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
R2:
[R2]int Tunnel 0/0/0
[R2-Tunnel0/0/0]ip add 10.1.2.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source Serial 4/0/0
Jul 26 2025 15:15:31-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R2-Tunnel0/0/0]
R3:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 10.1.2.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source Serial 4/0/0
Jul 26 2025 15:17:30-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R3-Tunnel0/0/0]
步骤2:配置nhrp域,在R2、R3上将自身信息注册到中心站点R1上(中心隧道IP地址,中心隧道对应的物理口IP地址)
[R1-Tunnel0/0/0]nhrp network-id 100
[R2-Tunnel0/0/0]nhrp network-id 100
[R2-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register
查看配置结果:
测试:
步骤3:配置RIP,选择v2版本,关闭自动汇总,宣告网段(主网段,不是子网段)
R1:
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]undo summary
[R1-rip-1]network 10.0.0.0
R2:
[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]
R3:
[R3]rip 1
[R3-rip-1]v 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]
查询RIP配置结果:
R1
R2
R3:
在R1接口上关闭RIP水平分割,在中心上开启伪广播。
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
[R1-Tunnel0/0/0]undo rip split-horizon
[R1-Tunnel0/0/0]q
[R1]
R2、R3上关闭RIP水平分割
[R2-Tunnel0/0/0]undo rip split-horizon
[R3-Tunnel0/0/0]undo rip split-horizon
测试R1~R3可达
关闭RIP水平分割后R1路由表信息:
7、配置GRE,R1为中心站点
步骤1:创建隧道接口,配置IP地址,选择封装类型GRP,配置源目IP地址(隧道口对应的真实的物理口IP地址)
R1:
[R1]int Tunnel 0/0/1
[R1-Tunnel0/0/1]ip add 10.1.1.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre
[R1-Tunnel0/0/1]source 15.1.1.1
[R1-Tunnel0/0/1]destination 45.1.1.4
Jul 26 2025 16:12:31-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
[R1-Tunnel0/0/1]
R4:
[R4]int Tunnel 0/0/1
[R4-Tunnel0/0/1]ip add 10.1.1.2 24
[R4-Tunnel0/0/1]tunnel-protocol gre
[R4-Tunnel0/0/1]source 45.1.1.4
[R4-Tunnel0/0/1]destination 15.1.1.1
Jul 26 2025 16:19:27-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
[R4-Tunnel0/0/1]
测试配置:
步骤2:配置RIP,选择v2版本,关闭自动汇总,宣告网段(主网段,不是子网段)
R1配置MGRE时已经配置了RIP。
R4:
[R4]rip 1
[R4-rip-1]v 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]
配置结果:
9、配置EASY IP ,使得PC可以访问公网ISP的环回
步骤1:配置ACL
公网已全网可达。
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
步骤2:在接口nat下发ACL
[R1]int Serial 4/0/0
[R1-Serial4/0/0]nat outbound 2000
[R2]int Serial 4/0/0
[R2-Serial4/0/0]nat outbound 2000
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]nat outbound 2000
测试: