配置IP地址如下图所示
第一步:配置R1和R5之间的PPP的PAP认证
其中r5为认证则r1为被认证
[r5]aaa
[r5-aaa]local-user wjf password cipher 123456
[r5-aaa]local-user wjf service-type ppp
[r5]int 3/0/0
[r5-Serial3/0/0]ppp authentication-mode pap
[r1] int s 4/0/0
[r1-Serial4/0/0]ppp pap local-user wjf password cipher 123456
第二步:配置R2和R5之间的PPP的PAP认证
其中r5为认证则r2为被认证
[r5]aaa
[r5-aaa]local-user wjf2 password cipher 654321
[r5-aaa]local-user wjf2 service-type ppp
[r5]int s 3/0/1
[r5-Serial3/0/1]ppp authentication-mode chap
[r2]int s 4/0/0
[r2-Serial4/0/0]ppp chap user wjf2
[r1-Serial3/0/1]ppp chap password cipher 654321
第三步:配置R3和R5之间的HDLC封装
[r5]int s 4/0/0
[r5-Serial4/0/0]ip address 12.0.2.2 24
[r5-Serial4/0/0]link-protocol hdlc
[r3]int s 4/0/0
[3-Serial4/0/0]ip address 12.0.2.1 24
[r3-Serial4/0/0]link-protocol hdlc
第四步:配置R1/R2/R3之间的MGRE环境,且为shortcut
R1 --HUB 配置(应在Tunnel0/0/0情况下输入nhrp redirect命令用来开启重定向功能。默认情况为未启动)
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 192.168.5.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 12.0.0.1
[r1]ip route-static 192.168.2.0 24 192.168.5.2
[r1]ip route-static 192.168.3.0 24 192.168.5.3
[r1-Tunnel0/0/0]nhrp redirect
第五步:R2--spoke配置
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip address 192.168.5.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source int s 4/0/0
[r2-Tunnel0/0/0]nhrp entry 192.168.5.1 12.0.0.1 register
[r2]ip route-static 192.168.1.0 24 192.168.5.1
[r2]ip route-static 192.168.3.0 24 192.168.5.1
[r2-Tunnel0/0/0]nhrp shortcut ----使能shortcut功能
R3--spoke配置
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 192.168.5.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source int s 4/0/0
[r3-Tunnel0/0/0]nhrp entry 192.168.5.1 12.0.0.1 register
[r3]ip route-static 192.168.1.0 24 192.168.5.1
[r3]ip route-static 192.168.3.0 24 192.168.5.1
[r3-Tunnel0/0/0]nhrp shortcut ----使能shortcut功能
第六步:R1和R4的GRE配置
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/0]ip address 192.168.6.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre
[r1-Tunnel0/0/0]source 12.0.0.1
[r1-Tunnel0/0/0]destination 12.0.4.1
[r1]ip route-static 192.168.4.0 24 192.168.6.2
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ip address 192.168.6.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre
[r4-Tunnel0/0/0]source 12.0.0.1
[r4-Tunnel0/0/0]destination 12.0.4.1
[r4]ip route-static 192.168.1.0 24 192.168.6.1
第七步:NAT配置
[r1]ip route-static 0.0.0.0 0 12.0.0.2
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1]int s 4/0/0
[r1-Serial4/0/0]nat outbound 2000
[r2]ip route-static 0.0.0.0 0 12.0.1.2
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[r2]int s 4/0/0
[r2-Serial4/0/0]nat outbound 2000
[r3]ip route-static 0.0.0.0 0 12.0.3.2
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[r3]int s 4/0/0
[r3-Serial4/0/0]nat outbound 2000
[r4]ip route-static 0.0.0.0 0 12.0.4.2
[r4]acl 2000
[r4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[r4]int s 4/0/0
[r4-Serial4/0/0]nat outbound 2000
最后pin检验