一、GRE/MGRE综合实验:
二、PC的IP配置
①PC1 IP:192.168.1.1 子网掩码:255.255.255.0 网关:192.168.1.254
②PC2 IP:192.168.2.1 子网掩码:255.255.255.0 网关:192.168.2.254
③PC3 IP:192.168.3.1 子网掩码:255.255.255.0 网关:192.168.3.254
④PC4 IP:192.168.4.1 子网掩码:255.255.255.0 网关:192.168.4.254
三、实验配置命令:
①配置IP
【r1】
<Huawei>system-view
[r1]sysname r1
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.254 24
[r1]interface Serial 4/0/0
[r1-Serial4/0/0]ip address 15.1.1.1 24
【r2】
<Huawei>system-view
[Huawei]sysname r2
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.2.254 24
[r2]interface Serial 4/0/0
[r2-Serial4/0/0]ip address 25.1.1.2 24
【r3】
<Huawei>system-view
[Huawei]sysname r3
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.3.254 24
[r3]interface Serial 4/0/0
[r3-Serial4/0/0]ip address 35.1.1.3 24
【r4】
<Huawei>system-view
[Huawei]sysname r4
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.4.254 24
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip address 45.1.1.4 24
【r5】
<Huawei>system-view
[Huawei]sysname r5
[r5]interface Serial 4/0/0
[r5-Serial4/0/0]ip address 15.1.1.5 24
[r5]interface Serial 3/0/1
[r5-Serial3/0/1]ip address 25.1.1.5 24
[r5]interface Serial 4/0/1
[r5-Serial4/0/1]ip address 35.1.1.5 24
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip address 45.1.1.5 24
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 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
ping测试:
③【r1】和【r5】之间使用ppp验证,r5为主验证方:
【r1】:
[r1]interface Serial 4/0/0
[r1-Serial4/0/0]ppp pap local-user wangdaye password cipher wdy12345
【r5】:
[r5]aaa
[r5-aaa]local-user wangdaye password cipher wdy12345
[r5-aaa]local-user wangdaye service-type ppp
[r5]interface Serial 4/0/0
[r5-Serial4/0/0]ppp authentication-mode pap
④r2与r5之间使用ppp的chap认证,r5为主验证方
【r2】:
[r5-Serial3/0/1]ppp chap user zhangdaye
[r5-Serial3/0/1]ppp chap password cipher zdy12345
【r5】:
[r5]aaa
[r5-aaa]local-user zhangdaye password cipher zdy12345
[r5-aaa]local-user zhangdaye service-type ppp
[r5]interface Serial 3/0/1
⑤r3与r5之间使用hdlc封装:
【r3】
[r3]interface Serial 4/0/0
[r3-Serial4/0/0]link-protocol hdlc
ping测试
⑥r1、r2、r3构建一个mgre环境,r1为中心站点。
【r1】:
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 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]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]undo rip split-horizon
【r2】:
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip address 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]undo rip split-horizon
【r3】:
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 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 entry 10.1.2.1 15.1.1.1 register
[r3-Tunnel0/0/0]undo rip split-horizon
⑦r1、r4之间为点到点的gre
【r1】:
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]ip address 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]interface Tunnel 0/0/1
[r4-Tunnel0/0/1]ip address 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
⑧整个私有网络基于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
【r2】:
[r2]rip 1
[r2-rip-1]version 2
[r2-rip-1]network 192.168.2.0
[r2-rip-1]network 10.0.0.0
【r3】:
[r3]rip 1
[r3-rip-1]version 2
[r3-rip-1]network 192.168.3.0
[r3-rip-1]network 10.0.0.0
【r4】:
[r4]rip 1
[r4-rip-1]version 2
[r4-rip-1]network 192.168.4.0
[r4-rip-1]network 10.0.0.0
⑨所有pc设置私有IP为源IP,可以访问r5环回,到达全网通
【r1】:
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1]interface Serial 4/0/0
[r1-Serial4/0/0]nat outbound 2000
【r2】:
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[r2]interface Serial 4/0/0
[r2-Serial4/0/0]nat outbound 2000
【r3】:
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[r3]interface Serial 4/0/0
[r3-Serial4/0/0]nat outbound 2000
【r4】:
[r4]acl 2000
[r4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]nat outbound 2000
ping测试: