目标实现:
2、首先进行子网划分
基于192.168.1.0 24划分
‘一共7个路由器需要7个网段还有7个主干网
192.168.1.0/24 ----用于骨干
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----R5环回 192.168.1.160/27
192.168.1.192 /27
192.168.1.224 /27
骨干网络划分:
由于骨干网络总共6个网段,需要把192.168.1.0/27划分为192.168.1.0/30等8个网段
192.168.1.0/27 借3位
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.24/30
192.168.1.1.28/30
2、将其他路由器和主干ip配置完成实现第三个目标
r1:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
[r1-GigabitEthernet0/0/0]q
[r1]interface GigabitEthernet 0/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-LoopBack0]q
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.1.49 28
r2:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
[r2-GigabitEthernet0/0/0]q
[r2]interface GigabitEthernet 0/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-LoopBack0]q
[r2]interface LoopBack 1
[r2-LoopBack1]ip address 192.168.1.81 28
r3:
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.10 30
[r3-GigabitEthernet0/0/0]q
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
[r3]interface GigabitEthernet 0/0/2
[r3-GigabitEthernet0/0/2]ip address 192.168.1.97 27
r4:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.14 30
[r4-GigabitEthernet0/0/0]int gi 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.6 30
[r4-GigabitEthernet0/0/1]int gi 0/0/2
[r4-GigabitEthernet0/0/2]ip address 192.168.1.17 30
[r4-GigabitEthernet0/0/2]int gi 4/0/0
[r4-GigabitEthernet4/0/0]ip add 192.168.1.21 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
r5:
[r5-GigabitEthernet0/0/0]ip address 192.168.1.22 30
[r5]interface GigabitEthernet 0/0/1
[r5-GigabitEthernet0/0/1]ip address 192.168.1.26 30
[r5]interface GigabitEthernet 0/0/2
[r5-GigabitEthernet0/0/2]ip address 192.168.1.29 30
[r5-GigabitEthernet0/0/2]ip address 56.1.1.1 24
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 192.168.1.161 27
r6:
[r6-GigabitEthernet0/0/0]ip address 56.1.1.2 24
[r6]interface LoopBack 0
[r6-LoopBack0]ip address 6.6.6.6 24
3、实现第4个目标r3下的用户可以自动获取ip
[r3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r3]ip pool r3
Info: It's successful to create an IP address pool.
[r3-ip-pool-r3]network 192.168.1.96 mask 27
[r3-ip-pool-r3]gateway-list 192.168.1.97
[r3-ip-pool-r3]dns-list 144.144.144.144 8.8.8.8
[r3-ip-pool-r3]int g 0/0/2
[r3-GigabitEthernet0/0/2]dhcp select global
检测:
pc1:
pc2:
4、这里直接实现路由,本应该先使用静态实现全网可达但是这里如果先使用缺省路由可以在后面写静态路由时减少需要写的条目(这里也直接完成了最后一个要求 浮动静态路由)
[r5]ip route-static 0.0.0.0 0 56.1.1.2
[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 61
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r2]ip route-static 0.0.0.0 0 192.168.1.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.10
5、然后将每个路由器的路由表上未知的网段进行手动添加
r1:
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[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
[r1]ip route-static 192.168.1.96 27 192.168.1.10
r2:
[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.6
[r2]ip route-static 192.168.1.8 30 192.168.1.1
[r2]ip route-static 192.168.1.12 30 192.168.1.6
r3:
[r3]ip route-static 192.168.1.32 27 192.168.1.9
[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.14
[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.14
r4:
[r4]ip route-static 192.168.1.0 30 192.168.1.5
[r4]ip route-static 192.168.1.64 27 192.168.1.5
[r4]ip route-static 192.168.1.96 27 192.168.1.13
[r4]ip route-static 192.168.1.32 27 192.168.1.13
[r4]ip route-static 192.168.1.32 27 192.168.1.5
[r4]ip route-static 192.168.1.8 30 192.168.1.13
r5:
[r5]ip route-static 192.168.1.128 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.32 27 192.168.1.17
[r5]ip route-static 192.168.1.0 30 192.168.1.17
[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.128 27 192.168.1.21 p 61
[r5]ip route-static 192.168.1.64 27 192.168.1.21 p 61
[r5]ip route-static 192.168.1.96 27 192.168.1.21 p 61
[r5]ip route-static 192.168.1.32 27 192.168.1.21 p 61
[r5]ip route-static 192.168.1.0 30 192.168.1.21 p 61
[r5]ip route-static 192.168.1.4 30 192.168.1.21 p 61
[r5]ip route-static 192.168.1.8 30 192.168.1.21 p 61
6、要实现r1-r5的环回可以访问r6的环回要是用nat技术实现公网和私有网络的连通
[r5]acl 2000
[r5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]int g 0/0/2
[r5-GigabitEthernet0/0/2]nat outbound 2000
测试:r1ping r6的环回
7、为了防止环路需要在每个汇总网段写空接口
[r1]ip route-static 192.168.1.32 27 NULL 0
[r2]ip route-static 192.168.1.64 27 NULL 0
[r4]ip route-static 192.168.1.128 27 NULL 0
8、刚刚已经完成了浮动静态路由
测试:
关闭前:
关闭后:
9、最后实现
首先在r1上开启telnet功能并且创建用户账号密码:
[r1]aaa
[r1-aaa]local-user yps privilege level 15 password cipher 123456
Info: Add a new user.
[r1-aaa]local-user yps service-type telnet
[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aaa
然后在r5上做一个端口映射到r1的talnet
[r5-GigabitEthernet0/0/2]nat server protocol tcp global current-interface 23 ins
ide 192.168.1.33 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
测试: