1.实验要求
1.R2为ISP,其中只能配置IP地址
2.R1-R2之间为HDLC封装
3.R2-R3之间为ppp封装,pap认证,R2为主认证方
4.R2-R4之间为ppp封装,chap认证,R2为主认证方
5.R1、R2、R3构建MGRE环境,仅R1 IP地址固定
6.内网使用RIP获取路由,所有PC可以互相访问,并且可访问R2的环回
2.拓扑结构 3.实验过程
在本实验中R2为网络服务提供商,先对其进行配置,对个接口的封装类型以及IP地址进行配置,在配置缺省路由使公网互通,再创建R1、R3、R4mgre环境,最后进行rip配置。
1.配置路由设备
R2:
1.配置R2的接口ip以及接口封装类型
<Huawei>sys
[Huawei]sysname R2
[R2]interface Serial 3/0/0
[R2-Serial3/0/0]link-protocol hdlc//将该接口封装成hdlc(华为设备默认封装为ppp)
[R2-Serial3/0/0]ip address 12.1.1.2 24//配置该接口IP地址
[R2-Serial3/0/0]q
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 2.2.2.2 24//配置环回接口
[R2]interface Serial 3/0/1//华为设备默认封装为ppp所有该接口不需要改封装
[R2-Serial3/0/1]ip address 23.1.1.2 24//配置该接口IP地址
[R2-Serial3/0/1]q
[R2]aaa //启动认证服务 华为设备间配置认证后需要将接口状态关闭后再重新开启
[R2-aaa]local-user pl password cipher 123456 //定义用户名为pl 密码为123456
[R2-aaa]local-user pl service-type ppp //定义该认证用于ppp
[R2]interface Serial 3/0/1
[R2-Serial3/0/1]ppp authentication-mode pap//要求该接口进行pap认证
[R2]interface Serial 4/0/0
[R2-Serial4/0/0]ip address 24.1.1.2 24
[R2-Serial4/0/0]ppp authentication-mode chap
[R2]aaa
[R2-aaa]local-user pl2 password cipher 654321//设置第二个认证账号
[R2-aaa]local-user pl2 service-type ppp
[R2-Serial3/0/1]shutdown
[R2-Serial3/0/1]undo shutdown //华为设备启动后做完认证需要将该接口状态重启才能有效
[R2-Serial4/0/0]shutdown
[R2-Serial4/0/0]undo shutdown
R1:
1.配置R1的接口ip以及接口封装类型
<Huawei>sys
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0/0]q
[R1]interface Serial 4/0/0
[R1-Serial4/0/0]ip address 12.1.1.1 24
[R1-Serial4/0/0]link-protocol hdlc
2.配置缺省路由访问使公网互通
[R1]ip route-static 0.0.0.0 0 12.1.1.2//配置缺省路由使公网互通
3.配置nat使pc能上网
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]interface Serial 4/0/0
[R1-Serial4/0/0]nat outbound 2000
4.R1、R3、R4创建mgre,R1的接口IP固定
[R1]interface Tunnel 0/0/0 //创建虚拟接口
[R1-Tunnel0/0/0]ip address 192.168.4.1 24//配置该接口的IP
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp //对该虚拟接口发出的包添加新的包头,使其通过真实的物理接口进行发送
[R1-Tunnel0/0/0]source 12.1.1.1 //新包头中的源IP(因为该IP固定)
[R1-Tunnel0/0/0]nhrp entry multicast dynamic //新包头中的目标IP通过nhrp服务器自动获取,R1为nhrp的服务端,(nhrp:下一跳自动发现协议)
[R1-Tunnel0/0/0]nhrp network-id 100 //服务半径
5.配置rip使全网可达
[R1]rip 1 //启动rip1
[R1-rip-1]version 2 //定义rip为版本2
[R1-rip-1]network 192.168.1.0 //宣告网段
[R1-rip-1]network 192.168.4.0
由于R3和R4均在R1处注册的,R3、R4与R1存在伪广播,但R3与R4无伪广播,R3与R4无rip沟通
[R1-Tunnel0/0/0]undo rip split-horizon //关闭该接口的水平分割,使R3和R4能获得对方的路由
R3:
1.配置R3的接口ip以及接口认证
<Huawei>sys
[Huawei]sysname R3
[R3]interface Serial 4/0/0
[R3-Serial4/0/0]ip address 23.1.1.1 24
[R3]interface Serial 4/0/0
[R3-Serial4/0/0]ppp pap local-user pl password cipher 123456//对该接口进行pap认证使其能访问R2
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.2.1 24
2.配置缺省路由访问使公网互通
[R3]ip route-static 0.0.0.0 0 23.1.1.2//配置缺省路由使公网互通
3.配置nat使pc能上网
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]interface Serial 4/0/0
[R1-Serial4/0/0]nat outbound 2000
4.R1、R3、R4创建mgre,R1的接口IP固定
[R3]interface Tunnel 0/0/0 //创建虚拟接口
[R3-Tunnel0/0/0]ip address 192.168.4.3 24 //配置该接口的IP
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp //对该虚拟接口发出的包添加新的包头,使其通过真实的物理接口进行发送
[R3-Tunnel0/0/0]source Serial 4/0/0 //新包头的源IP(由于该接口IP可变,因此通过源接口获取源IP)
[R3-Tunnel0/0/0]nhrp entry 192.168.4.1 12.1.1.1 register //目标IP通过nhrp服务端R1进行注册
[R3-Tunnel0/0/0]nhrp network-id 100
5.配置rip使全网可达
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]network 192.168.2.0
[R3-rip-1]network 192.168.4.0
R4:
1.配置R2的接口ip以及接口认证
<Huawei>sys
[Huawei]sysname R4
[R4]interface s4/0/0
[R4-Serial4/0/0]ip address 24.1.1.1 24
[R4-Serial4/0/0]ppp chap user pl2 //对该接口进行chap认证使其能访问R2
[R4-Serial4/0/0]ppp chap password cipher 654321
[R4]interface g0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.3.1 24
2.配置缺省路由访问使公网互通
[R4]ip route-static 0.0.0.0 0 24.1.1.2
3.配置nat使pc能上网
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]interface Serial 4/0/0
[R1-Serial4/0/0]nat outbound 2000
4.R1、R3、R4创建mgre,R1的接口IP固定
[R3]interface Tunnel 0/0/0 //创建虚拟接口
[R3-Tunnel0/0/0]ip address 192.168.4.4 24 //配置该接口的IP
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp //对该虚拟接口发出的包添加新的包头,使其通过真实的物理接口进行发送
[R3-Tunnel0/0/0]source Serial 4/0/0 //新包头的源IP(由于该接口IP可变,因此通过源接口获取源IP)
[R3-Tunnel0/0/0]nhrp entry 192.168.4.1 12.1.1.1 register //目标IP通过nhrp服务端R1进行注册
[R3-Tunnel0/0/0]nhrp network-id 100
5.配置rip使全网可达
[R4]rip 1
[R4-rip-1]version 2
[R4-rip-1]network 192.168.3.0
[R4-rip-1]network 192.168.4.0
PC1、PC2、PC3:
4.实验测试
1.公网互通
2. R2与R1、R3、R4连接口的封装与认证
3.mgre构建后,R1,R2,R3通过tunnel口发出的包的目标IP
4.R1、R3、R4的路由表
5.全网可达