R5的IP地址配置
[ISP]int s3/0/0
[ISP-Serial3/0/0]ip add 15.0.0.2 24
[ISP-Serial3/0/0]int s3/0/1
[ISP-Serial3/0/1]ip add 25.0.0.2 24
[ISP-Serial3/0/1]int s4/0/0
[ISP-Serial4/0/0]ip add 35.0.0.2 24
[ISP-Serial4/0/0]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 45.0.0.2 24
[ISP]int l0
[ISP-LoopBack0]ip add 5.5.5.5 24
R1的IP地址配置
[R1]int s4/0/0
[R1-Serial4/0/0]ip add 15.0.0.1 24
[R1-Serial4/0/0]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
R2的IP地址配置
[R2]int s 4/0/0
[R2-Serial4/0/0]ip add 25.0.0.1 24
[R2-Serial4/0/0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.2 24
R3的IP地址配置
[R3]int s4/0/0
[R3-Serial4/0/0]ip add 35.0.0.1 24
[R3-Serial4/0/0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.3 24
R4的IP地址配置
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 45.0.0.1 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.4.4 24
R1和R5之间使用PPP的PAP认证,R5为主认证方
主认证方R5:
[ISP]aaa
[ISP-aaa]local-user admin password cipher 123456
[ISP-aaa]local-user admin service-type ppp
[ISP-aaa]int s3/0/0
[ISP-Serial3/0/0]ppp authentication-mode pap
被认证方R1:
[R1]int s4/0/0
[R1-Serial4/0/0]ppp pap local-user admin password cipher 123456
R2和R5之间使用PPP的chap认证,R5为主认证方
主认证方R5:
[ISP]aaa
[ISP-aaa]local-user admin password cipher 123456
[ISP-aaa]local-user admin service-type ppp
[ISP-aaa]int s3/0/1
[ISP-Serial3/0/1]ppp authentication-mode chap
被认证方R2:
[R2]int s4/0/0
[R2-Serial4/0/0]ppp chap user admin
[R2-Serial4/0/0]ppp chap password cipher 123456
R3于R5之间使用HDLC封装
[R3]int s4/0/0
[R3-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N] :y
[ISP]int s4/0/0
[ISP-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N] :y
各路由器缺省指向R5
[R1]ip route-static 0.0.0.0 0 15.0.0.2
[R2]ip route-static 0.0.0.0 0 25.0.0.2
[R3]ip route-static 0.0.0.0 0 35.0.0.2
[R4]ip route-static 0.0.0.0 0 45.0.0.2
R1/R2/R3构建一个MGRE环境,R1为中心站点
R1中心设备:
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 5.5.5.1 24 [
R1-Tunnel0/0/0]tunnel-protocol gre p2mp [
R1-Tunnel0/0/0]source 15.0.0.1
[R1-Tunnel0/0/0]nhrp network-id 100
分支设备,以R2为例
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]ip address 5.5.5.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source Serial 4/0/0
[R2-Tunnel0/0/0]nhrp network-id 100
[R2-Tunnel0/0/0]nhrp entry 5.5.5.1 15.0.0.1 register
R1、R4间为点到点的GRE
[R4]interface t0/0/0
[R4-Tunnel0/0/0]ip add 5.5.5.4 24
[R4-Tunnel0/0/0]tunnel-protocol gre
[R4-Tunnel0/0/0]source 45.0.0.2
[R4-Tunnel0/0/0]destination 15.0.0.1
[R1-Tunnel0/0/0]int t 0/0/1
[R1-Tunnel0/0/1]ip add 6.6.6.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre
[R1-Tunnel0/0/1]source 15.0.0.1
[R1-Tunnel0/0/1]destination 45.0.0.2
整个网路基于RIP全网可达
以R1和R2为例
[R1]rip
[R1-rip-1]version 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 5.0.0.0
[R1-rip-1]network 6.0.0.0
[R2]rip
[R2-rip-1]v 2
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 5.0.0.0
只有中心获取到了分支的路由信息,而分支没有获取到。解决办法就是在中心上开启伪广播
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
中心开启伪广播后,分支只能收到中心的路由信息,但没有分支的,原因是RIP的水平分割机制,所有要关闭水平机制
[R1-Tunnel0/0/0]undo rip split-horizon
所有PC设置私有IP为源IP,可以访问R5环回
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]int s4/0/0
[R1-Serial4/0/0]nat outbound 2000
R2~R4同理