拓扑图
实验需求在这里插入图片描述
1、整张网络使用192.168.1.0/24网段进行划分
2、R1、R2、R3、R4均有两个环回来模拟用户网段
3、R5使用DHCP为PC分配IP地址
4、R2、R3、R4、R5开启Telnet功能;账号密码:admin/admin;
并且使用R1进行Telnet测试登录其他设备
5.完成所有路由器的静态路由配置,要求使用最简化路由表的方式
6、全网可达
需求分析
*1.全网同一网段,因此需要划分IP,并将相应IP对应设备进行分配。
2.配置缺省路由,实现全网通,并测试
3.防环,做黑洞路由配置
4.配置浮动静态路由
基础配置
端口配置
先配置ar1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.1.9 30
//创建环回接口
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.33 28
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.1.49 28
然后ar2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.1.5 30
//创建环回接口
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.1.65 28
[r2]interface LoopBack 1
[r2-LoopBack1]ip address 192.168.1.81 28
随后ar3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.10 30
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.14 30
//创建环回接口
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.1.97 28
[r3]interface LoopBack 1
[r3-LoopBack1]ip address 192.168.1.113 28
ar4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.6 30
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.1.13 30
[r4]int g0/0/2
[r4-GigabitEthernet0/0/2]ip address 192.168.1.21 30
[r4]int g4/0/0
[r4-GigabitEthernet4/0/0]ip address 192.168.1.17 30
//创建环回接口
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 192.168.1.129 28
[r4]interface LoopBack 1
[r4-LoopBack1]ip address 192.168.1.145 28
ar5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip address 192.168.1.22 30
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]ip address 192.168.1.18 30
[r5]int g0/0/2
[r5-GigabitEthernet0/0/2]ip address 192.168.1.25 30
手工静态补齐路由表
ar1
AR1-->AR4
[r1]ip route-static 192.168.1.4 30 192.168.1.2
[r1]ip route-static 192.168.1.12 30 192.168.1.10 ---- 负载均衡
AR1--->AR2环回
[r1]ip route-static 192.168.1.64 27 192.168.1.2
AR1-->AR3环回
[r1]ip route-static 192.168.1.96 27 192.168.1.10
ar2
AR2--->AR3
[r2]ip route-static 192.168.1.8 30 192.168.1.1
[r2]ip route-static 192.168.1.12 30 192.18.1.6 --- 负载均衡
AR2-->AR1环回
[r2]ip route-static 192.168.1.32 27 192.168.1.1
AR2-->AR4环回
[r2]ip route-static 192.168.1.128 27 192.168.1.6
AR2-->AR3环回
[r2]ip route-static 192.168.1.96 27 192.168.1.6
[r2]ip route-static 192.168.1.96 27 192.168.1.1---负载均衡
ar3
AR3--->AR2
[r3]ip route-static 192.168.1.0 30 192.168.1.9
[r3]ip route-static 192.168.1.4 30 192.168.1.13--- 负载均衡
AR3--->AR1环回
[r3]ip route-static 192.168.1.32 27 192.168.1.9
AR3---> AR2环回
[r3]ip route-static 192.168.1.64 27 192.168.1.9
[r3]ip route-static 192.168.1.64 27 192.168.1.13 ---负载均衡
ar4
AR4--->AR2
[r3]ip route-static 192.168.1.0 30 192.168.1.5
[r3]ip route-static 192.168.1.4 30 192.168.1.14--- 负载均衡
AR4-->AR1环回
[r4]ip route-static 192.168.1.32 27 192.168.1.5
[r4]ip route-static 192.168.1.32 27 192.168.1.14----负载均衡
AR4-->AR2环回
[r4]ip route-static 192.168.1.64 27 192.168.1.5
AR4-->AR3环回
[r4]ip route-static 192.168.1.64 27 192.168.1.14
浮动静态路由
[r4]ip route-static 192.168.1.160 27 192.168.1.18
[r4]ip route-static 192.168.1.160 27 192.168.1.22 preference 61
ar5
浮动静态路由
[r5]ip route-static 192.168.1.0 24 192.168.1.17
[r5]ip route-static 192.168.1.0 24 192.168.1.21 preference 61
缺省路由配置
[r1]ip route-static 0.0.0.0 0 192.168.1.2
[r1]ip route-static 0.0.0.0 0 192.168.1.10
[r2]ip route-static 0.0.0.0 0 192.168.1.6
[r3]ip route-static 0.0.0.0 0 192.168.1.13
防环,黑洞路由配置
[r1]ip route-static 192.168.1.64 27 NULL 0
[r1]ip route-static 192.168.1.96 27 NULL 0
[r2]ip route-static 192.168.1.32 27 NULL 0
[r2]ip route-static 192.168.1.96 27 NULL 0
[r2]ip route-static 192.168.1.128 27 NULL 0
[r3]ip route-static 192.168.1.32 27 NULL 0
[r3]ip route-static 192.168.1.64 27 NULL 0
[r4]ip route-static 192.168.1.32 27 NULL 0
[r4]ip route-static 192.168.1.96 27 NULL 0
[r4]ip route-static 192.168.1.64 27 NULL 0
[r5]ip route-static 192.168.1.0 24 NULL 0
Telnet远程登录
ar2
[r2]user-interface vty 0 4
[r2-ui-vty0-4]authentication-mode aaa
[r2]aaa
[r2-aaa]local-user admin password cipher admin
[r2-aaa]local-user admin privilege level 15
[r2-aaa]local-user admin service-type telnet
ar3
[r3]user-interface vty 0 4
[r3-ui-vty0-4]authentication-mode aaa
[r3]aaa
[r3-aaa]local-user admin password cipher admin
[r3-aaa]local-user admin privilege level 15
[r3-aaa]local-user admin service-type telnet
ar4
[r4]user-interface vty 0 4
[r4-ui-vty0-4]authentication-mode aaa
[r4]aaa
[r4-aaa]local-user admin password cipher admin
[r4-aaa]local-user admin privilege level 15
[r4-aaa]local-user admin service-type telnet
ar1登录端
<r1>telnet 192.168.1.2
Press CTRL_] to quit telnet mode
Trying 192.168.1.2 ...
Connected to 192.168.1.2 ...
Login authentication
Username:admin
Password:
通过DHCP给PC端分配地址
ar5
[r5]dhcp enable
[r5]ip pool hym
[r5-ip-pool-hym]network 192.168.1.160 mask 27
[r5-ip-pool-hym]gateway-list 192.168.1.161
[r5-ip-pool-hym]dns-list 8.8.8.8
[r5]interface GigabitEthernet 0/0/2
[r5-GigabitEthernet0/0/2]dhcp select global
pc
结果
测试是否设备之间全部联通,可通过ping指令进行测试—以AR1为例
查看配置的静态路由表
display ip routing-table protocol static