例图:
需求:
1.整张网络使用192.168.1.0/24网段进行划分
2.R1、R2、R3、R4均有两个环回来模拟用户网段
3.R5使用DHCP为PC分配IP地址
4.R2、R3、R4、R5开启Telnet功能;账号密码:admin/admin
5. 完成所有路由器的静态路由配置,要求使用最简化路由表的方式
6.全网可达
分析:
1.划分网段
2.配IP
3.配DHCP
4.Telnet
5.配路由:未知网段/汇总网段
6.缺省路由
7.空接口路由
8.浮动静志路由
过程:
1.划分网段
2.配IP
[Huawei]sy r1
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip add
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
Jul 23 2024 21:06:08-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]q
[r1]interface GigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
Jul 23 2024 21:06:46-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]q
[r1]int LoopBack 0
[r1-LoopBack0]ip address 192.168.1.33 28
[r1-LoopBack0]q
[r1]int LoopBack 1
[r1-LoopBack1]ip address 192.168.1.49 28
[r1-LoopBack1]
[Huawei]sy r2
[r2]interface g
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
[r2-GigabitEthernet0/0/0]
Jul 23 2024 21:11:24-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]q
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.1.9 30
Jul 23 2024 21:12:06-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]q
[r2]int LoopBack 0
[r2-LoopBack0]ip address 192.168.1.65 28
[r2-LoopBack0]int l 1
[r2-LoopBack1]ip add
[r2-LoopBack1]ip address 192.168.1.81 28
[r2-LoopBack1]
[Huawei]sy r3
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.13 30
Jul 23 2024 21:45:13-08:00 r3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.6 30
Jul 23 2024 21:44:53-08:00 r3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]q
[r3]int l 0
[r3-LoopBack0]ip add 192.168.1.97 28
[r3-LoopBack0]q
[r3]int l 1
[r3-LoopBack1]ip add 192.168.1.113 28
[r3-LoopBack1]
[Huawei]sy r4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.10 30
Jul 23 2024 21:17:55-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.14 30
Jul 23 2024 21:18:35-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int g 0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.17 30
Jul 23 2024 21:19:18-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]int g 4/0/0
[r4-GigabitEthernet4/0/0]ip add 192.168.1.21 30
Jul 23 2024 21:19:59-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r4-GigabitEthernet4/0/0]q
[r4]int l 0
[r4-LoopBack0]ip add 192.168.1.129 28
[r4-LoopBack0]int l 1
[r4-LoopBack1]ip add 192.168.1.145 28
[r4-LoopBack1]
[Huawei]sy r5
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.18 30
Jul 23 2024 21:23:09-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]int g 0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.1.22 30
Jul 23 2024 21:23:46-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5-GigabitEthernet0/0/1]int g 0/0/2
[r5-GigabitEthernet0/0/2]ip add 192.168.1.161 27
[r5-GigabitEthernet0/0/2]
Jul 23 2024 21:25:20-08:00 r5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r5-GigabitEthernet0/0/2]
3.配DHCP
[r5]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r5]ip pool xiao
Info: It's successful to create an IP address pool.
[r5-ip-pool-xiao]network 192.168.1.160 mask 27
[r5-ip-pool-xiao]gateway-list 192.168.1.161
[r5-ip-pool-xiao]dns-list 8.8.8.8
[r5-ip-pool-xiao]q
[r5]int g 0/0/2
[r5-GigabitEthernet0/0/2]dhcp select global
[r5-GigabitEthernet0/0/2]
结果:
4.Telnet
[r2]user-interface vty 0 4
[r2-ui-vty0-4]authentication-mode aaa
[r2-ui-vty0-4]q
[r2-aaa]local-user admin password cipher admin privilege level 15
[r2-aaa]local-user admin service-type telnet
[r2-aaa]
[r3]user-interface vty 0 4
[[r3-ui-vty0-4]authentication-mode aaa
[r3-ui-vty0-4]q
[r3-aaa]local-user admin password cipher admin privilege level 15
[r3-aaa]local-user admin service-type telnet
[r3-aaa]
[r4]user-interface vty 0 4
[r4-ui-vty0-4]authentication-mode aaa
[r4-ui-vty0-4]q
[r4]aaa
[r4-aaa]local-user admin password cipher admin privilege level 15
[r4-aaa]local-user admin service-type telnet
[r4-aaa]
[r5]user-interface vty 0 4
[r5-ui-vty0-4]authentication-mode aaa
[r5-ui-vty0-4]q
[r5]aaa
[r5-aaa]local-user admin password cipher admin privilege level 15
[r5-aaa]local-user admin service-type telnet
[r5-aaa]
结果:
5.缺省路由
[r2]ip route-static 0.0.0.0 0 192.168.1.10
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r4]ip route-static 0.0.0.0 0 192.168.1.18
6.配路由:未知网段/汇总网段
[r5]ip route-static 192.168.1.4 30 192.168.1.17
[r5]ip route-static 192.168.1.8 30 192.168.1.17
[r5]ip route-static 192.168.1.12 30 192.168.1.17
[r5]ip route-static 192.168.1.32 27 192.168.1.17
[r5]ip route-static 192.168.1.64 27 192.168.1.17
[r5]ip route-static 192.168.1.96 27 192.168.1.17
r5]ip route-static 192.168.1.128 27 192.168.1.17
[r5]
有重复,删去多余
[r1]undo ip route-static 192.168.1.128 27 192.168.1.2
[r1]undo ip route-static 192.168.1.128 27 192.168.1.6
[r2]undo ip route-static 192.168.1.128 27 192.168.1.10
[r3]undo ip route-static 192.168.1.128 27 192.168.1.14
7.空接口路由
[r1]ip route-static 192.168.1.32 27 NULL 0
[r2]ip route-static 192.168.1.64 27 NULL 0
[r3]ip route-static 192.168.1.96 27 NULL 0
[r4]ip route-static 192.168.1.128 27 NULL 0
8.浮动静志路由
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 70
[r5]ip route-static 192.168.1.0 30 192.168.1.21 pre 70
[r5]ip route-static 192.168.1.4 30 192.168.1.21 pre 70
[r5]ip route-static 192.168.1.8 30 192.168.1.21 pre 70
[r5]ip route-static 192.168.1.12 30 192.168.1.21 pre 70
[r5]ip route-static 192.168.1.32 27 192.168.1.21 pre 70
[r5]ip route-static 192.168.1.64 27 192.168.1.21 pre 70
[r5]ip route-static 192.168.1.96 27 192.168.1.21 pre 70
[r5]ip route-static 192.168.1.128 27 192.168.1.21 pre 70
测试
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]shutdown
Jul 24 2024 00:07:02-08:00 r5 %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEthern
et0/0/0 has turned into DOWN state.
[r5-GigabitEthernet0/0/0]
[r5-GigabitEthernet0/0/0]
Jul 24 2024 00:07:02-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the DOWN state.
[r5-GigabitEthernet0/0/0]