目录
1.IP地址的规划
2.拓扑结构的搭建
3.IP地址的配置
4.R1和R2之间的HDLC封装
5.R2和R3之间的PPP封装,pap认证;R2和R4之间的chap认证
6.R1、R3、R4构建MGRE环境
7.使用动态路由协议RIP
8.测试—实现全网可达
实验要求
AR1到AR2之间的网段为12.1.1.0/24
AR2到AR3之间的网段为12.1.2.0/24
AR2到AR3之间的网段为12.1.3.0/24
AR2上的环回网段为1.1.1.1/24
R1、R2、R3构建MGRE,用的网段为10.1.1.0/24
AR1的代码如下:
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[r1-GigabitEthernet0/0/0]q
[r1]interface s4/0/0
[r1-Serial4/0/0]ip address 12.1.1.1 24
[r1-Serial4/0/0]q
AR2的代码如下:
[ISP]interface Serial 4/0/0
[ISP-Serial4/0/0]ip address 12.1.1.2 24
[ISP-Serial4/0/0]interface Serial 3/0/0
[ISP-Serial3/0/0]ip address 12.1.2.1 24
[ISP-Serial3/0/0]interface Serial 3/0/1
[ISP-Serial3/0/1]ip address 12.1.3.1 24
[ISP-Serial3/0/1]q
[ISP]interface LoopBack 0
[ISP-LoopBack0]ip address 1.1.1.1 24
[ISP-LoopBack0]q
AR3的代码如下:
[r3]interface Serial 4/0/0
[r3-Serial4/0/0]ip address 12.1.2.2 24
[r3-Serial4/0/0]q
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.2.1 24
AR4的代码如下:
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.3.1 24
[r4-GigabitEthernet0/0/0]q
[r4]interface s4/0/0
[r4-Serial4/0/0]ip address 12.1.3.2 24
[r4-Serial4/0/0]q
AR1和AR2代码如下:
[r1]interface Serial 4/0/0
[r1-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
[ISP]interface 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
R2的代码如下:
[ISP]aaa
[ISP-aaa]local-user tengxun password cipher 666666
[ISP-aaa]local-user tengxun service-type ppp
[ISP-aaa]int
[ISP-aaa]q
[ISP]interface Serial 3/0/0
[ISP-Serial3/0/0]link-protocol ppp
[ISP-Serial3/0/0]ppp authentication-mode pap
[ISP-Serial3/0/0]q
[ISP]interface Serial 3/0/1
[ISP-Serial3/0/1]link-protocol ppp
[ISP-Serial3/0/1]ppp authentication-mode chap
[ISP-Serial3/0/1]q
R3、R4的代码如下:
[r3]interface Serial 4/0/0
[r3-Serial4/0/0]link-protocol ppp
[r3-Serial4/0/0]ppp pap local-user tengxun password cipher 666666
[r3-Serial4/0/0]q
[r4]interface Serial 4/0/0
[r4-Serial4/0/0]link-protocol ppp
[r4-Serial4/0/0]ppp chap user tengxun
[r4-Serial4/0/0]ppp chap password cipher 666666
[r4-Serial4/0/0]q
R1、R3、R4进行缺省路由的配置和nat认证,代码如下:
[r1]ip route-static 0.0.0.0 0 12.1.1.2
[r1]acl 2000
[r1-acl-basic-2000]rule 1 permit source any
[r1-acl-basic-2000]q
[r1]interface s4/0/0
[r1-Serial4/0/0]nat outbound 2000
[r1-Serial4/0/0]q
[r3]ip route-static 0.0.0.0 0 12.1.2.1
[r3]acl 2000
[r3-acl-basic-2000]rule 1 permit source any
[r3-acl-basic-2000]q
[r3]interface s4/0/0
[r3-Serial4/0/0]nat outbound 2000
[r3-Serial4/0/0]q
[r4]ip route-static 0.0.0.0 0 12.1.3.1
[r4]acl 2000
[r4-acl-basic-2000]rule 1 permit source any
[r4-acl-basic-2000]q
[r4]interface s4/0/0
[r4-Serial4/0/0]nat outbound 2000
[r4-Serial4/0/0]q
将R1设为中心站点
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 12.1.1.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]q
分支站点为R3和R4
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 10.1.1.2 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source s4/0/0
[r3-Tunnel0/0/0]nhrp entry 10.1.1.1 12.1.1.1 register
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]q
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ip address 10.1.1.3 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source s4/0/0
[r4-Tunnel0/0/0]nhrp entry 10.1.1.1 12.1.1.1 register
[r4-Tunnel0/0/0]nhrp network-id 100
[r4-Tunnel0/0/0]q
AR1、AR3、AR4的代码如下:
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 10.0.0.0
[r1-rip-1]network 192.168.1.0
[r1-rip-1]q
[r3]rip 1
[r3-rip-1]version 2
[r3-rip-1]network 10.0.0.0
[r3-rip-1]network 192.168.2.0
[r3-rip-1]q
[r4]rip 1
[r4-rip-1]version 2
[r4-rip-1]network 10.0.0.0
[r4-rip-1]network 192.168.3.0
[r4-rip-1]q
R3和R4的路由表不完整
关闭RIP的水平分割
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]undo rip split-horizon
[r1-Tunnel0/0/0]q
关闭后获得完整路由表
PC1 ping R2环回、PC2和PC3
PCpingPC3