本文实验参考来源:《华为HCIA-Datacom认证实验指南》
▲需要领取本书资源,评论区告诉我
① 默认路由的使用场合;
② 默认路由的配置
实验拓扑如图4-4所示
缺省路由
(1)配置网络连通性
R1的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[R1-GigabitEthernet0/0/0]undo shutdown
[R1-GigabitEthernet0/0/0]quit
R2的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
[Huawei]sysname R2
[R2]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/1]undo shutdown
[R2-GigabitEthernet0/0/1]quit
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 23.1.1.2 24
[R2-GigabitEthernet0/0/0]undo shutdown
[R2-GigabitEthernet0/0/0]quit
[R2]interface g0/0/2
[R2-GigabitEthernet0/0/2]ip address 24.1.1.2 24
[R2-GigabitEthernet0/0/2]undo shutdown
[R2-GigabitEthernet0/0/2]quit
R3的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
[Huawei]sysname R3
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 23.1.1.3 24
[R3-GigabitEthernet0/0/1]undo shutdown
[R3-GigabitEthernet0/0/1]quit
R4的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
[Huawei]sysname R4
[R4]interface g0/0/1
[R4-GigabitEthernet0/0/1]ip address 24.1.1.4 24
[R4-GigabitEthernet0/0/1]undo shutdown
[R4-GigabitEthernet0/0/1]quit
(2)配置静态路由
R1的配置
[R1]ip route-static 0.0.0.0 0.0.0.0 12.1.1.2 //配置缺省路由到任何网段下一跳为12.1.1.2
【技术要点】
在本实验中,如果我们使用静态路由,那么我们要配置两条静态路由,具体配置如下:
[R1]ip route-static 23.1.1.0 255.255.255.0 12.1.1.2
[R1]ip route-static 24.1.1.0 255.255.255.0 12.1.1.2
读者想一想,如果有1000条路由,我们的配置是不是特别复杂,所以针对于下一跳相同的多条静态路由读者可以使用缺省路由来简化配置。
R3的配置
[R3]ip route-static 12.1.1.0 255.255.255.0 23.1.1.2
R4的配置
[R4]ip route-static 12.1.1.0 255.255.255.0 24.1.1.2
查看R1的路由表
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 12.1.1.2 GigabitEthernet0/0/0
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet0/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
通过查看R1的路由表,读者可以看到一条缺省路由,虽然简化了配置,读者测试一下网络连通性。
R1访问R3
[R1]ping 23.1.1.3
PING 23.1.1.3: 56 data bytes, press CTRL_C to break
Reply from 23.1.1.3: bytes=56 Sequence=1 ttl=254 time=100 ms
Reply from 23.1.1.3: bytes=56 Sequence=2 ttl=254 time=60 ms
Reply from 23.1.1.3: bytes=56 Sequence=3 ttl=254 time=50 ms
Reply from 23.1.1.3: bytes=56 Sequence=4 ttl=254 time=70 ms
Reply from 23.1.1.3: bytes=56 Sequence=5 ttl=254 time=80 ms
--- 23.1.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/72/100 ms
R1访问R4
[R1]ping 24.1.1.4
PING 24.1.1.4: 56 data bytes, press CTRL_C to break
Reply from 24.1.1.4: bytes=56 Sequence=1 ttl=254 time=60 ms
Reply from 24.1.1.4: bytes=56 Sequence=2 ttl=254 time=90 ms
Reply from 24.1.1.4: bytes=56 Sequence=3 ttl=254 time=60 ms
Reply from 24.1.1.4: bytes=56 Sequence=4 ttl=254 time=80 ms
Reply from 24.1.1.4: bytes=56 Sequence=5 ttl=254 time=80 ms
--- 24.1.1.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 60/74/90 ms
通过测试读者可以看到,缺省路由虽然简化了配置,但是不影响访问,所以读者以后在遇到类似的拓扑可以考虑使用缺省路由。
更多本书实验练习:
↓需要实验拓扑练习的朋友,可以关注+点赞后领取↓
版权说明:如非注明,本站文章均为 扬州驻场服务-网络设备调试-监控维修-南京泽同信息科技有限公司 原创,转载请注明出处和附带本文链接。
请在这里放置你的在线分享代码