题目参考:
实验步骤:
第一步:地址规划拓扑设计,配置IP地址
R1配置:
<Huawei>system-view
[Huawei]sy R1
[R1]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0/1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]q
R2配置:
<Huawei>SY
[Huawei]SY R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 23.1.1.1 24
[R2-GigabitEthernet0/0/1]q
R3配置:
<R3>sy
Enter system view, return user view with Ctrl+Z.
[R3]sy R3
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[R3-GigabitEthernet0/0/0]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 32.1.1.1 24
R4配置:
<R4>sy
[R4]sy R4
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 32.1.1.2 24
[R4-GigabitEthernet0/0/0]int g 0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.1.1 24
第二步:公网路由配置,因上课时使用过OSPF,因此此时使用RIP
R2配置:
[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 23.0.0.0
R3配置:
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]network 23.0.0.0
[R3-rip-1]network 32.0.0.0
第三步:配置网内缺省路由
R1配置:
[R1]ip route-static 0.0.0.0 0 12.1.1.2
R4配置:
[R4]ip route-static 0.0.0.0 0 32.1.1.1
第四步:配置NAT
R1配置:
[R1]acl 2000
[R1-acl-basic-2000]rule 1 permit source any
[R1-acl-basic-2000]q
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000
R4配置:
[R4]acl 2000
[R4-acl-basic-2000]rule 1 permit source any
[R4-acl-basic-2000]q
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]nat outbound 2000
第五步:配置GRE
R1配置:
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]source 12.1.1.1
[R1-Tunnel0/0/0]destination 32.1.1.2
[R1]int Tunnel 0/0/0 创建隧道口
[R1-Tunnel0/0/0]tunnel-protocol gre 定义封装方式为gre
[R1-Tunnel0/0/0]ip add 10.1.1.1 24 配置隧道IP地址
[R1-Tunnel0/0/0]source 12.1.1.1 定义封装源
[R1-Tunnel0/0/0]destination 32.1.1.2 定义封装内容目标
R4配置:
[R4]int Tunnel 0/0/0
[R4-Tunnel0/0/0]tunnel-protocol gre
[R4-Tunnel0/0/0]ip add 10.1.1.2 24
[R4-Tunnel0/0/0]source 32.1.1.2
[R4-Tunnel0/0/0]destination 12.1.1.1
第六步:书写静态路由指向隧道
[R1]ip route-static 192.168.1.0 24 Tunnel 0/0/0
[R4]ip route-static 192.168.2.0 24 Tunnel 0/0/0
第七步:测试
PC>ping 192.168.2.2Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.2: bytes=32 seq=2 ttl=126 time=47 ms
From 192.168.2.2: bytes=32 seq=3 ttl=126 time=31 ms
From 192.168.2.2: bytes=32 seq=4 ttl=126 time=31 ms
From 192.168.2.2: bytes=32 seq=5 ttl=126 time=47 ms--- 192.168.2.2 ping statistics ---5 packet(s) transmitted4 packet(s) received20.00% packet lossround-trip min/avg/max = 0/39/47 ms
第八步:抓包测试