- 实验拓扑和要求
实验思路
- 按如图所示的网段进行IP规划及配置
- 在R5上先创建一个用户,然后设置该用户的服务类型为ppp,然后进入s4/0/1接口配置ppp的认证类型为pap协议,主认证方完成配置后在被人正方配置所验证的用户的 用户名和密码
- R2与R5之间进行ppp认证的chap协议的验证,在主认证方只需修改协议类型,在被认证方在进行认证配置时需要将用户名和密码需分开进行配置。
- 在R3和R5之间的接口分别将链路类型修改为HDLC
- 实现公网通:分别在R1 R2 R3 R4上分别配置一条缺省路由,下一跳指向公网的出口可实现公网通
- 在R1 R2 R3上分别建立三个隧道,并按照图示网段信息配置分别配置各个隧道的IP地址以及隧道的协议为 gre p2mp,然后分别在这三台路由器上配置隧道的源地址为公网的入口地址,之后在中心站点R1上创建NHRP,并分别在其他各站点上创建NHRP并配置中心站点的隧道地址和公网入口地址
- 在R1 R2 R3 R4这四台路由器配置Rip动态路由,并在R1上开启伪广播并在隧道上关闭RIP的水平分割让R2和R3获取到NHRP表中的路由信息。
- 实验配置和结果
1、R5为ISP,只能进行IP地址配置,其所有地址均配为公有IP地址。
进行IP配置
配置所有设备接口的IP地址:
pc1:
pc2:
pc3:
pc4:
R1
<Huawei>sys
[Huawei]sysname R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0]q
[R1]int Serial 4/0/0
[R1-Serial4/0/0]ip add 15.1.1.1 24
[R1-Serial4/0/0]q
R2:
<Huawei>sys
[Huawei]sysname R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.254 24
[R2-GigabitEthernet0/0/0]q
[R2]int Serial 4/0/0
[R2-Serial4/0/0]ip add 25.1.1.2 24
[R2-Serial4/0/0]q
R3:
<Huawei>sys
[Huawei]sysname R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.254 24
[R3-GigabitEthernet0/0/0]q
[R3]int Serial 4/0/0
[R3-Serial4/0/0]ip add 35.1.1.3 24
[R3-Serial4/0/0]q
R4:
<Huawei>sys
[Huawei]sysname R4
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 45.1.1.4 24
[R4-GigabitEthernet0/0/0]int g 0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.4.254 24
[R4-GigabitEthernet0/0/1]q
R5:
<Huawei>sys
[Huawei]sysname R5
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.1.1.5 24
[R5-GigabitEthernet0/0/0]q
[R5]int Serial 4/0/1
[R5-Serial4/0/1]ip add 15.1.1.5 24
[R5-Serial4/0/1]q
[R5]int Serial 3/0/1
[R5-Serial3/0/1]ip add 25.1.1.5 24
[R5-Serial3/0/1]q
[R5]int Serial 4/0/0
[R5-Serial4/0/0]ip add 35.1.1.5 24
[R5-Serial4/0/0]q
[R5]int l0
[R5-LoopBack0]ip add 5.5.5.5 24
配置私网与公网缺省路由使得公网可通:
R1:
[R1]ip route-static 0.0.0.0 0 15.1.1.5
R2:
[R2]ip route-static 0.0.0.0 0 25.1.1.5
R3:
[R3]ip route-static 0.0.0.0 0 35.1.1.5
R4:
[R4]ip route-static 0.0.0.0 0 45.1.1.5
2、(1)R1和R5间使用PPP的PAP认证,R5为主认证方。
R5(主验证方):
[R5]aaa
[R5-aaa]local-user yb password cipher 123456
[R5-aaa]local-user yb service-type ppp
[R5-aaa]q
[R5]int Serial 4/0/1
[R5-Serial4/0/1]ppp authentication-mode pap
[R5-Serial4/0/1]q
R1(被验证方):
[R1-Serial4/0/0]ppp pap local-user yb password cipher 123456
[R1-Serial4/0/0]shutdown
[R1-Serial4/0/0]undo shutdown
(2)R2与R5之间使用ppp的CHAP认证,R5为主认证方。
R5(主验证方):
[R5-aaa]aaa
[R5-aaa]local-user yb password cipher 123456
[R5-aaa]local-user yb service-type ppp
[R5-aaa]q
[R5]int Serial 3/0/1
[R5-Serial3/0/1]ppp authentication-mode chap
[R5-Serial3/0/1]q
R2(被验证方):
[R2-Serial4/0/0]ppp chap user yb
[R2-Serial4/0/0]ppp chap password cipher123456
[R2-Serial4/0/0]undo shutdown
[R2-Serial4/0/0]shutdown
(3)R3与R5之间使用HDLC封装。
R5:
[R5-Serial4/0/0]link-protocol hdlc
R3:
[R3-Serial4/0/0]link-protocol hdlc
3、(1)R1、R2、R3构建一个MGRE环境,R1为中心站点,
MGRE VPN:10.1.2.0/24
GRE VPN:10.1.1.0/24
R1:
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.2.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 15.1.1.1
[R1-Tunnel0/0/0]nhrp network-id 100
[R1-Tunnel0/0/0]q
R2:
[R2]int Tunnel 0/0/0
[R2-Tunnel0/0/0]ip add 10.1.2.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 10.1.2.1 15.1.1.1 register
[R2-Tunnel0/0/0]q
R3:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 10.1.2.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 10.1.2.1 15.1.1.1 register
[R3-Tunnel0/0/0]q
(2)R1、R4间为点到点的GRE。
R1;
[R1]int Tunnel 0/0/1
[R1-Tunnel0/0/1]ip add 10.1.1.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre
[R1-Tunnel0/0/1]source 15.1.1.1
[R1-Tunnel0/0/1]destination 45.1.1.4
R4:
[R4]int Tunnel 0/0/1
[R4-Tunnel0/0/1]ip add 10.1.1.4 24
[R4-Tunnel0/0/1]tunnel-protocol gre
[R4-Tunnel0/0/1]source 45.1.1.4
[R4-Tunnel0/0/1]destination 15.1.1.1
4、整个私有网络基于RIP全网可达。
配置路由协议(RIP)传递两端私网路由
R1:
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 10.0.0.0
[R1-rip-1]undo summary
[R1-rip-1]q
查看路由表中的rip信息
[R1]dis ip routing-table protocol rip
[R1]int Serial 4/0/0
[R1-Serial4/0/0]undo rip split-horizon
[R1]int tunnel 0/0/0
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
R2:
[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]undo summary
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 10.0.0.0
[R2-rip-1]q
[R2]dis ip routing-table protocol rip
[R2]int t0/0/0
[R2-Tunnel0/0/0]undo rip split-horizon
[R2-Tunnel0/0/0]q
R3:
[R3]rip 1
[R3-rip-1]v 2
[R3-rip-1]undo summary
[R3-rip-1]network 192.168.3.0
[R3-rip-1]network 10.0.0.0
[R3-rip-1]q
[R3]dis ip routing-table protocol rip
[R3]int t0/0/0
[R3-Tunnel0/0/0]undo rip sp
[R3-Tunnel0/0/0]undo rip split-horizon
[R3-Tunnel0/0/0]q
R4:
[R4]rip 1
[R4-rip-1]v 2
[R4-rip-1]undo summary
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 10.0.0.0
[R4-rip-1]q
5、所有PC设置私有IP为源IP,可以访问R5环回,实现全网通。
R1—R5配置NAT协议(easy IP)实现全网可通
R1:
<R1>sys
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]int Serial 4/0/0
[R1-Serial4/0/0]nat outbound 2000
[R1-Serial4/0/0]q
[R1]
R2:
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R2-acl-basic-2000]q
[R2]int Serial 4/0/0
[R2-Serial4/0/0]nat outbound 2000
[R2-Serial4/0/0]q
[R2]
R3:
<R3>sys
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R3-acl-basic-2000]q
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R3-Serial4/0/0]q
[R3]
R4:
<R4>sys
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[R4-acl-basic-2000]q
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]nat outbound 2000
[R4-GigabitEthernet0/0/0]q
[R4]
测试