配置IP的地址
[R1-GigabitEthernet0/0/0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0]int s4/0/0
[R1-Serial4/0/0]ip add 15.0.0.1 24[R2]int s 4/0/0
[R2-Serial4/0/0]ip add 25.0.0.1 24
[R2-Serial4/0/0]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.1 24[R3]int s 4/0/0
[R3-Serial4/0/0]ip add 35.0.0.1 24
[R3-Serial4/0/0]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.1 24[R4]int s 4/0/0
[R4-Serial4/0/0]ip add 45.0.0.1 24[R4-Serial4/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.4.1 24
[R5]int s 3/0/0
[R5-Serial3/0/0]ip add 15.0.0.2 24
[R5-Serial3/0/0]int s 4/0/0
[R5-Serial4/0/0]ip add 25.0.0.2 24
[R5-Serial4/0/0]int s 4/0/1
[R5-Serial4/0/1]ip add 45.0.0.2 24
[R5-Serial4/0/1]int s 3/0/1
[R5-Serial3/0/1]ip add 35.0.0.2 24[R5-Serial3/0/1]int l0
[R5-LoopBack0]ip add 5.5.5.5 24
R1和R5使用PAP认证,R5为主认证方
被认证方:
R1-Serial4/0/0]ppp pap local-user ywq password cipher 123456
主认证方
[R5-aaa]local-user ywq password cipher 123456
[R5-aaa]local-user ywq service-type ppp[R5-Serial3/0/0]ppp authentication-mode pap
R2和R5使用chap认证,R5主认证方
[R5-Serial4/0/0]aaa
[R5-aaa]local-user ywq password cipher 123456
[R5-aaa]local-user ywq service-type ppp[R5-aaa]int s 4/0/0
[R5-Serial4/0/0]ppp authentication-mode chap[R2]int s4/0/0
[R2-Serial4/0/0]ppp chap user ywq
[R2-Serial4/0/0]ppp chap password cipher 123456
R3和R5之间使用HDLC封装
[R3-Serial4/0/0]link-protocol hdlc
[R5-Serial3/0/1]link-protocol hdlc
R1/R2/R3构建MGRE环境,R1为hub
hub配置
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 192.168.5.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 15.0.0.1分支R2配置
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]ip add 192.168.5.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source s 4/0/0
[R2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register分支R3配置
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 192.168.5.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source s 4/0/0
[R3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
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 15.0.0.1
[R1-Tunnel0/0/0]destination 45.0.0.1[R4]interface Tunnel 0/0/0
[R4-Tunnel0/0/0]ip address 192.168.6.4 24
[R4-Tunnel0/0/0]tunnel-protocol gre
[R4-Tunnel0/0/0]source 45.0.0.1
[R4-Tunnel0/0/0]destination 15.0.0.1
配置缺省指向ISP
[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
[R4]ip route-static 0.0.0.0 0 45.0.0.2
[R3]ip route-static 0.0.0.0 0 35.0.0.
整个私有网络基于RIP全网可达
[R1]rip
[R1-rip-1]v 2
[R1-rip-1]undo summary
[R1-rip-1]network 192.168.5.0
[R1-rip-1]network 192.168.1.0[R1-rip-1]network 192.168.6.0
[R2-rip-1]v 2
[R2-rip-1]undo summary
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 192.168.5.0[R3]rip
[R3-rip-1]v 2
[R3-rip-1]undo summary
[R3-rip-1]network 192.168.3.0
[R3-rip-1]network 192.168.5.0[R4-rip-1]v 2
[R4-rip-1]undo summary
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 192.168.6.0
[R1-Tunnel0/0/0]nhrp entry multicast dynamic 中心站点开启伪广播
[R1-Tunnel0/0/0]nhrp redirect 在hub设备上 使能nhrp重定向报文
[R2-Tunnel0/0/0]nhrp shortcut开启spoke设备的nhrp重定向请求报文
[R3-Tunnel0/0/0]nhrp shortcut
[R1-Tunnel0/0/0]rip summary-address 192.168.0.0 255.255.248.0
R1/R2/R3的NHRP的映射表
PC测试环回5.5.5.5
1.抓取内网感兴趣流
[R1]acl 2001
[R1-acl-basic-2001]rule permit source 192.168.1.0 0.0.0.2552.将公网IP和ACL进行绑定
[R1-acl-basic-2001]int s 4/0/0
[R1-Serial4/0/0]nat outbound 2001注意:如果只有一个公网IP,我们这里不需要指定对应的公网IP地址,这里会默认把外网口IP地址作为转换的公网地址
R2/R3/R4操作性相似,省略
测试:ping