一、拓扑
二、需求分析
子网划分
子网:192.168.1.0/27-----192.168.1.000 00000/27
6条骨干链路
192.168.1.000000 00/30-----192.168.1.0/30
192.168.1.000001 00/30-----192.168.1.4/30
192.168.1.000010 00/30-----192.168.1.8/30
192.168.1.000011 00/30-----192.168.1.12/30
192.168.1.000100 00/30-----192.168.1.16/30
192.168.1.000101 00/30-----192.168.1.20/30
192.168.1.000110 00/30-----192.168.1.24/30
192.168.1.000111 00/30-----192.168.1.28/30
=====>192.168.1.24/29------>dhcp
r1环回:192.168.1.32/28、192.168.1.48/28
r2环回:192.168.1.64/28、192.168.1.80/28
r3:192.168.1.24/29
r4环回:192.168.1.96/28、192.168.1.112/28
r5环回:192.168.1.128/27
r6环回:1.1.1.0/24
三、具体配置命令
r1的配置
IP配置
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[r1]interface GigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.5 30
创建虚拟接口用作环回接口:
[r1]interface LoopBack 1
[r1-LoopBack1]ip add 192.168.1.33 28
[r1]int LoopBack 2
[r1-LoopBack2]ip add 192.168.1.49 28
路由配置
r1自身有r1-r2、r1-r3、两个环回共四个直连路由,而全网共16条路由,所以r1需要配置12条路由,才能保证r1的网络能通。
[r1]ip route-static 192.168.1.8 30 192.168.1.2---到192.168.1.8/30的网段
[r1]ip route-static 192.168.1.16 30 192.168.1.2---到192.168.1.16/30的网段
[r1]ip route-static 192.168.1.64 27 192.168.1.2---到r2环回的汇总
[r1]ip route-static 192.168.1.96 27 192.168.1.2---到r4环回的汇总
[r1]ip route-static 192.168.1.128 27 192.168.1.2---到r5环回的汇总
[r1]ip route-static 192.168.1.12 30 192.168.1.6---到192.168.1.12/30的网段
[r1]ip route-static 192.168.1.24 29 192.168.1.6---到192.168.1.24/29的网段
[r1]ip route-static 192.168.1.20 30 192.168.1.2---到192.168.1.20/30的网段
缺省路由(等价路由):
[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
[r1]ip route-static 192.168.1.32 27 NULL 0
查看路由
r2的配置
IP配置
IP配置:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 30
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.9 30
创建虚拟接口用作环回接口:
[r2]int LoopBack 3
[r2-LoopBack3]ip add 192.168.1.65 28
[r2]int LoopBack 4
[r2-LoopBack4]ip add 192.168.1.81 28
路由配置
r2自身有r2-r1、r2-r4、两个环回共四个直连路由,而全网共16条路由,所以r2需要配置12条路由,才能保证r2的网络能通。
[r2]ip route-static 192.168.1.4 30 192.168.1.1---到192.168.1.4/30的网段
[r2]ip route-static 192.168.1.24 29 192.168.1.1---到192.168.1.24/29的网段
[r2]ip route-static 192.168.1.32 27 192.168.1.1---到r1环回的汇总
[r2]ip route-static 192.168.1.12 30 192.168.1.10---到192.168.1.12/30的网段
[r2]ip route-static 192.168.1.16 30 192.168.1.10---到192.168.1.16/30的网段
[r2]ip route-static 192.168.1.20 30 192.168.1.10---到192.168.1.20/30的网段
[r2]ip route-static 192.168.1.128 27 192.168.1.10---到r5环回的汇总
[r2]ip route-static 192.168.1.96 27 192.168.1.10---到r4环回的汇总
缺省路由(等价路由):
[r2]ip route-static 0.0.0.0 0 192.168.1.10
[r2]ip route-static 192.168.1.64 27 NULL 0
查看路由
r3的配置
IP配置
IP配置:
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.6 30
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.13 30
[r3]interface GigabitEthernet 0/0/2
[r3-GigabitEthernet0/0/2]ip add 192.168.1.25 29
r3作为DHCP服务器:
开启DHCP服务功能:
[r3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
创建IP地址池塘:
[r3]ip pool aaa
Info: It's successful to create an IP address pool.
配置可分配的IP地址网段:
[r3-ip-pool-aaa]network 192.168.1.24 mask 29
配置网关IP地址:
[r3-ip-pool-aaa]gateway-list 192.168.1.25
配置DNS服务器:
[r3-ip-pool-aaa]dns-list 8.8.8.8 114.114.114.114
在0/0/2接口开启DHCP接口服务:
[r3-GigabitEthernet0/0/2]dhcp select global
路由配置
r3自身有r3-r1、r3-r4和192.168.1.24/29网段三个直连路由,全而全网共16条路由,所以r3需要配置13条路由,才能保证r3的网络能通。
[r3]ip route-static 192.168.1.0 30 192.168.1.5
[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.8 30 192.168.1.14
[r3]ip route-static 192.168.1.96 27 192.168.1.14
[r3]ip route-static 192.168.1.16 30 192.168.1.14
[r3]ip route-static 192.168.1.20 30 192.168.1.14
[r3]ip route-static 192.168.1.128 27 192.168.1.14
缺省路由:
[r3]ip route-static 0.0.0.0 0 192.168.1.14
查看路由
r4的配置
IP配置
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.10 30
[r4]interface GigabitEthernet 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.14 30
[r4]interface GigabitEthernet 0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.17 30
[r4]interface GigabitEthernet 4/0/0
[r4-GigabitEthernet4/0/0]ip add 192.168.1.21 30
创建虚拟接口用作环回接口:
[r4]interface LoopBack 5
[r4-LoopBack5]ip add 192.168.1.97 28
[r4]interface LoopBack 6
[r4-LoopBack6]ip add 192.168.1.113 28
路由配置
r4自身有r4-r3、r4-r2、r4-r5和r4的环回共6个直连路由,全而全网共16条路由,所以r4需要配置10条路由,才能保证r4的网络能通。
[r4]ip route-static 192.168.1.0 30 192.168.1.9
[r4]ip route-static 192.168.1.64 29 192.168.1.9
[r4]ip route-static 192.168.1.32 27 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.13
[r4]ip route-static 192.168.1.24 29 192.168.1.13
[r4]ip route-static 192.168.1.128 27 192.168.1.18
[r4]ip route-static 192.168.1.128 27 192.168.1.22
缺省路由:
因为r4与r5之间存在浮动静态路由,故在配置IP时要将其中一条的优先级进行降级。
[r4]ip route-static 0.0.0.0 0 192.168.1.18
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 90 // 降低优先级至90
[r4]ip route-static 192.168.1.96 27 null 0
查看路由
r5的配置
IP配置
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.18 30
[r5]interface GigabitEthernet 0/0/1
[r5-GigabitEthernet0/0/1]ip add 12.0.0.1 24
[r5]interface GigabitEthernet 0/0/2
[r5-GigabitEthernet0/0/2]ip add 192.168.1.22 30
创建虚拟接口用作环回接口:
[r5]interface LoopBack 7
[r5-LoopBack7]ip add 192.168.1.129 27
路由配置
[r5]ip route-static 0.0.0.0 0 12.0.0.2
[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 90 // 降低优先级至90
[r5]ip route-static 192.168.1.128 27 null 0
设置ACL:
[r5]acl 2000
[r5-acl-basic-2000]rule 8 permit source 192.168.1.0 0.0.255.255
[r5]int g 0/0/2
[r5-GigabitEthernet0/0/2]nat outbound 2000
查看路由
r6的配置
IP配置
IP配置:
[r6]interface GigabitEthernet 0/0/0
[r6-GigabitEthernet0/0/0]ip add 12.0.0.2 24
创建虚拟接口用作环回接口:
[r6]interface LoopBack 8
[r6-LoopBack8]ip add 1.1.1.1 24
[r6]ip route-static 1.1.1.0 24 null 0
pc1
pc2
Telnet
R6 telnet R5的公有IP地址时,实际登陆到R1上;
![R6预R5实登R1]
[r1]aaa
[r1-aaa]local-user admin privilege level 15 password cipher 123456
[r1-aaa]local-user admin service-type telnet
[r1-aaa]q
[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aaa
r5:
[r5-GigabitEthernet0/0/2]nat server protocol tcp global current-interface 23 inside 192.168.1.1 23
Warning:The port 23 is well-known port. If you continue it may cause function fa
ilure.
Are you sure to continue?[Y/N]:y
四、验证
r1-r5都可以到达r6的环回