文章目录
配置如下网络
配置IP如下图
对AR1配置IP
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 1.1.1.1 24
[r1-GigabitEthernet0/0/0]int s 4/0/0
[r1-Serial4/0/0]ip add 15.0.0.1 24
对AR2配置IP
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 2.2.2.1 24
[r2-GigabitEthernet0/0/0]int s 4/0/0
[r2-Serial4/0/0]ip add 24.0.0.1 24
对AR3配置IP
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 3.3.3.1 24
[r3-GigabitEthernet0/0/0]int s 4/0/0
[r3-Serial4/0/0]ip add 35.0.0.1 24
对AR4配置IP
[r4]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add 4.4.4.1 24
[r4-GigabitEthernet0/0/1]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 45.0.0.1 24
对AR5配置IP
[r5]int s 3/0/0
[r5-Serial3/0/0]ip add 15.0.0.2 24
[r5-Serial3/0/0]int s 3/0/1
[r5-Serial3/0/1]ip add 25.0.0.2 24
[r5-Serial3/0/1]int s 4/0/0
[r5-Serial4/0/0]ip add 35.0.0.2 24
[r5-Serial4/0/0]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 45.0.0.2 24
# 配置环回地址
[r5]int l0
[r5-LoopBack0]ip add 5.5.5.5 24
配置缺省
AR1
[r1]ip route-static 0.0.0.0 0 15.0.0.2
AR2
[r2]ip route-static 0.0.0.0 0 25.0.0.2
AR3
[r3]ip route-static 0.0.0.0 0 35.0.0.2
AR4
[r4]ip route-static 0.0.0.0 0 45.0.0.2
R1和R5间使用PPP的PAP认证,R5为主认证方
在AR5上:
[r5]aaa
[r5-aaa]local-user bai password cipher 123456
Info: Add a new user.
[r5-aaa]local-user bai service-type ppp
[r5-aaa]int s 3/0/0
[r5-Serial3/0/0]ppp authentication-mode pap
在AR1上:
[r1]interface Serial 4/0/0
[r1-Serial4/0/0]ppp pap local-user bai password cipher 123456
R2于R5之间使用PPP的chap认证,R5为主认证方
在AR5上:
[r5-aaa]int s 3/0/1
[r5-Serial3/0/1]ppp authentication-mode chap
在AR2上:
[r2]interface s 4/0/0
[r2-Serial4/0/0]ppp chap password cipher 123456
R3于R5之间使用HDLC封装
在AR5上:
[r5]int s 4/0/0
[r5-Serial4/0/0]link-protocol hdlc
在AR3上:
[r3]int s 4/0/0
[r3-Serial4/0/0]link-protocol hdlc
R1/R2/R3构建一个MGRE环境,R1为中心站点
在AR1上:
[r1]int t 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
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
在AR2上
[r2]int t 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 Serial 4/0/0
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
在AR3上
[r3]int t 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 Serial 4/0/0
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
R1、R4间为点到点的GRE
在AR1上:
[r1]int t 0/0/1
[r1-Tunnel0/0/1]ip add 192.168.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.1
在AR4上:
[r4]int t 0/0/0
[r4-Tunnel0/0/0]ip add 192.168.6.2 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
整个私有网络基于RIP全网可达
在AR1上:
[r1]rip
[r1-rip-1]v 2
[r1-rip-1]network 1.0.0.0
[r1-rip-1]network 192.168.6.0
[r1-rip-1]network 192.168.5.0
[r1]int t 0/0/0
[r1-Tunnel0/0/0]undo rip split-horizon
在AR2上:
[r2]rip
[r2-rip-1] v 2
[r2-rip-1]network 2.0.0.0
[r2-rip-1]network 192.168.5.0
在AR3上:
[r3]rip
[r3-rip-1]v 2
[r3-rip-1]network 3.0.0.0
[r3-rip-1]network 192.168.5.0
在AR4上:
[r4]rip
[r4-rip-1]v 2
[r4-rip-1]network 4.0.0.0
[r4-rip-1]network 192.168.6.0
所有pc设置私有Ip为源IP,可以访问R5环回
在AR1上:
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 1.0.0.0 0.255.255.255
[r1-acl-basic-2000]int s 4/0/0
[r1-Serial4/0/0]nat outbound 2000
在AR2上:
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 2.0.0.0 0.255.255.255
[r1-acl-basic-2000]int s 4/0/0
[r1-Serial4/0/0]nat outbound 2000
在AR3上:
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 3.0.0.0 0.255.255.255
[r1-acl-basic-2000]int s 4/0/0
[r1-Serial4/0/0]nat outbound 2000
在AR4上:
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 4.0.0.0 0.255.255.255
[r1-acl-basic-2000]int g 0/0/0
[r1-Serial4/0/0]nat outbound 2000
可以ping通