一、 拓扑图及需求
需求:
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.使用R1进行Telnet测试登录其他设备。
6.完成所有路由器的静态路由配置,要求使用最简化路由表的方式。
7.全网可达。
二、需求分析
1.根据需求1,进行网段划分。
2.配置手工IP地址。
3.配置R5 DHCP服务,为PC分配IP地址。
4.开启R2-R5的Telnet功能,使PC可以远程登录。
5.配置路由:未知网段/汇总网段。
6.配置缺省路由。
7.空接口路由。
8.浮动静态路由
三、配置过程
1.根据需求1,进行网段划分。由拓扑图可知,至少需要7个网段。
192.168.1.0/27----骨干
192.168.1.0/30
192.168.1.4/30
192.168.1.8/30
192.168.1.12/30
192.168.1.16/30
192.168.1.20/30
-------------------------------
192.168.1.32/27---R1环回
192.168.1.32/28
192.168.1.48/28
192.168.1.64/27---R2环回
192.168.1.64/28
192.168.1.80/28
192.168.1.96/27---R3环回
192.168.1.96/28
192.168.1.112/28
192.168.1.128/27---R4环回
192.168.1.128/28
192.168.1.144/28
-------------------------------
192.168.1.160/27
2.配置如图手工IP地址。
R1
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
[r1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
[r1-LoopBack0]ip address 192.168.1.33 28
[r1-LoopBack1]ip address 192.168.1.49 28
R2
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
[r2-GigabitEthernet0/0/1]ip address 192.168.1.9 30
[r2-LoopBack0]ip address 192.168.1.65 28
[r2-LoopBack1]ip address 192.168.1.81 28
R3
[r3-GigabitEthernet0/0/0]ip address 192.168.1.6 30
[r3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
[r3-LoopBack0]ip address 192.168.1.97 28
[r3-LoopBack1]ip address 192.168.1.113 28
R4
[r4-GigabitEthernet0/0/0]ip address 192.168.1.10 30
[r4-GigabitEthernet0/0/1]ip address 192.168.1.14 30
[r4-GigabitEthernet0/0/2]ip address 192.168.1.17 30
[r4-GigabitEthernet4/0/0]ip address 192.168.1.21 30
[r4-LoopBack0]ip address 192.168.1.129 28
[r4-LoopBack1]ip address 192.168.1.145 28
R5
[r5-GigabitEthernet0/0/0]ip address 192.168.1.18 30
[r5-GigabitEthernet0/0/1]ip address 192.168.1.22 30
[r5-GigabitEthernet0/0/2]ip address 192.168.1.161 27
3.配置R5 DHCP服务,为PC自动分配IP地址
开启DHCP服务,创建IP池塘aa,分配网段,网关信息,设置排除IP,并将aa池塘应用到对应接口。
[r5]dhcp enable
[r5]ip pool aa
[r5-ip-pool-aa]network 192.168.1.160 mask 27
[r5-ip-pool-aa]gateway-list 192.168.1.161
[r5-GigabitEthernet0/0/2]dhcp select global
4.开启R2-R5的Telnet服务,供PC远程登录
R2
[r2]user-interface vty 0 4
[r2-ui-vty0-4]authentication-mode aaa
r2-aaa]local-user admin password cipher admin privilege level 15
[r2-aaa]local-user admin service-type telnet
R3
[r3]user-interface vty 0 4
[r3-ui-vty0-4]authentication-mode aaa
[r3-aaa]local-user admin password cipher admin privilege level 15
[r3-aaa]local-user admin service-type telnet
R4
[r4]user-interface vty 0 4
[r4-ui-vty0-4]authentication-mode aaa
[r4-ui-vty0-4]aaa
[r4-aaa]local-user admin password cipher admin privilege level 15
[r4-aaa]local-user admin service-type telnet
R5
[r5]user-interface vty 0 4
[r5-ui-vty0-4]authentication-mode aaa
[r5-ui-vty0-4]aaa
[r5-aaa]local-user admin password cipher admin privilege level 15
[r5-aaa]local-user admin service-type telnet
5.配置所有路由器的静态路由
R1
[r1]ip route-static 192.168.1.8 30 192.168.1.2
[r1]ip route-static 192.168.1.12 30 192.168.1.6
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r1]ip route-static 192.168.1.96 27 192.168.1.6
[r1]ip route-static 192.168.1.128 27 192.168.1.2
[r1]ip route-static 192.168.1.128 27 192.168.1.6
R2
[r2]ip route-static 192.168.1.4 30 192.168.1.1
[r2]ip route-static 192.168.1.12 30 192.168.1.10
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.10
[r2]ip route-static 192.168.1.128 27 192.168.1.10
R3
[r3]ip route-static 192.168.1.0 30 192.168.1.5
[r3]ip route-static 192.168.1.8 30 192.168.1.14
[r3]ip route-static 192.168.1.32 27 192.168.1.5
[r3]ip route-static 192.168.1.64 27 192.168.1.5
[r3]ip route-static 192.168.1.64 27 192.168.1.14
[r3]ip route-static 192.168.1.128 27 192.168.1.14
R4
[r4]ip route-static 192.168.1.0 30 192.168.1.9
[r4]ip route-static 192.168.1.4 30 192.168.1.13
[r4]ip route-static 192.168.1.32 27 192.168.1.9
[r4]ip route-static 192.168.1.32 27 192.168.1.13
[r4]ip route-static 192.168.1.64 27 192.168.1.9
[r4]ip route-static 192.168.1.96 27 192.168.1.13
R5
[r5]ip route-static 192.168.1.32 27 192.168.1.129
[r5]ip route-static 192.168.1.0 27 192.168.1.129
[r5]ip route-static 192.168.1.64 27 192.168.1.129
[r5]ip route-static 192.168.1.96 27 192.168.1.129
[r5]ip route-static 192.168.1.96 27 192.168.1.161
[r5]ip route-static 192.168.1.64 27 192.168.1.161
[r5]ip route-static 192.168.1.0 27 192.168.1.161
[r5]ip route-static 192.168.1.32 27 192.168.1.161
6.配置缺省路由
[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.6
[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
ip route-static 192.168.1.0 30 192.168.1.17
ip route-static 192.168.1.4 30 192.168.1.17
ip route-static 192.168.1.8 30 192.168.1.17
ip route-static 192.168.1.32 27 192.168.1.17
ip route-static 192.168.1.64 27 192.168.1.17
ip route-static 192.168.1.96 27 192.168.1.17
ip route-static 192.168.1.128 27 192.168.1.17
优化路由表
[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.配置空接口路由
[r2]ip route-static 192.168.1.64 27 NULL 0
[r1]ip route-static 192.168.1.32 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 61
ip route-static 192.168.1.0 30 192.168.1.21 pre 61
ip route-static 192.168.1.4 30 192.168.1.21 pre 61
ip route-static 192.168.1.8 30 192.168.1.21 pre 61
ip route-static 192.168.1.12 30 192.168.1.21 pre 61
ip route-static 192.168.1.32 27 192.168.1.21 pre 61
ip route-static 192.168.1.64 27 192.168.1.21 pre 61
ip route-static 192.168.1.96 27 192.168.1.21 pre 61
ip route-static 192.168.1.128 27 192.168.1.21 pre 61
测试
[r5-GigabitEthernet0/0/0]shutdown
此时,静态路由已被启动
试验完成