一、实验拓扑及要求
二、实验步骤
1、划分网段
骨干链路:192.168.1.0/27
R1-R2: 192.168.1.0/30
R1-R3: 192.168.1.4/30
R2-R4: 192.168.1.8/30
R3-R4: 192.168.1.12/30
R4-R5: 192.168.1.16/30
R5-R4: 192.168.1.20/30
R5-R6:12.0.0.0/24
r1环回:192.168.1.32/27
L1:192.168.1.32/28
L2:192.168.1.48/28
r2环回: 192.168.1.64/27
L1:192.168.1.64/28
L2:192.168.1.80/28
r3:192.168.1.96/27
r4环回: 192.168.1.128/27
L1:192.168.1.128/28
L2:192.168.1.144/28
r5环回:192.168.1.160/27
r6环回:1.0.0.0/24
2、配置接口ip
r1
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 255.255.255.252
Mar 19 2024 11:10:05-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip ad 192.168.1.5 255.255.255.252
Mar 19 2024 11:11:57-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
[r1-GigabitEthernet0/0/1]int loopback0
[r1-LoopBack0]ip ad 192.168.1.33 255.255.255.240
[r1-LoopBack0]int loopback1
r2
r2-GigabitEthernet0/0/0]ip ad 192.168.1.2 255.255.255.252
Mar 19 2024 11:30:18-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]int g0/0/1
[r2-GigabitEthernet0/0/1]ip ad 192.168.1.9 255.255.255.252
Mar 19 2024 11:30:59-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]int loopb0
[r2-LoopBack0]ip ad 192.168.1.65 255.255.255.240
[r2-LoopBack0]int loopb1
[r2-LoopBack1]ip ad 192.168.1.49 255.255.255.240
r3
[r3-GigabitEthernet0/0/0]ip ad 192.168.1.6 255.255.255.252
Mar 19 2024 11:25:12-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip ad 192.168.1.13 255.255.255.252
Mar 19 2024 11:26:05-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]int loopback0
[r3-GigabitEthernet0/0/2]ip ad 192.168.1.97 255.255.255.192
Mar 19 2024 21:14:07-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
r4
[r4-GigabitEthernet0/0/0]ip ad 192.168.1.10 255.255.255.252
[r4-GigabitEthernet0/0/0]
Mar 19 2024 11:39:26-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 g0/0/1
[r4-GigabitEthernet0/0/1]ip ad 192.168.1.14 255.255.255.252
Mar 19 2024 11:39:58-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 g0/0/2
[r4-GigabitEthernet0/0/2]ip ad 192.168.1.17 255.255.255.252
[r4-GigabitEthernet0/0/2]
Mar 19 2024 11:40:50-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 g4/0/0
[r4-GigabitEthernet4/0/0]ip ad 192.168.1.21 255.255.255.252
[r4-GigabitEthernet4/0/0]
Mar 19 2024 11:41:23-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]int loopb0
[r4-LoopBack0]ip ad 192.168.1.129 255.255.255.240
[r4-LoopBack0]int loopb1
[r4-LoopBack1]ip ad 192.168.1.145 255.255.255.240
r5
[r5-GigabitEthernet0/0/0]ip ad 192.168.1.22 255.255.255.252
Mar 19 2024 12:12:00-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 g0/0/2
[r5-GigabitEthernet0/0/2]ip ad 192.168.1.18 255.255.255.252
Mar 19 2024 12:13:06-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r5-GigabitEthernet0/0/2]int g0/0/1
[r5-GigabitEthernet0/0/1]ip ad 12.0.0.1 255.255.255.0
[r5-GigabitEthernet0/0/1]
Mar 19 2024 12:14:02-08:00 r5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5-GigabitEthernet0/0/1]int loopb0
[r5-LoopBack0]ip ad 192.168.1.161 255.255.255.192
r6
[r6-GigabitEthernet0/0/0]ip ad 12.0.0.2 255.255.255.0
[r6-GigabitEthernet0/0/0]
Mar 19 2024 12:17:08-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r6-GigabitEthernet0/0/0]int loopb0
[r6-LoopBack0]ip ad 1.0.0.1 255.255.255.0
3、配置静态路由
①路由汇总,减少静态配置以及环路
②缺省路由:防止黑洞,使内网ping通
r1
[r1]ip route-static 192.168.1.0 27 192.168.1.2
[r1]ip route-static 192.168.1.0 27 192.168.1.6
[r1]ip route-static 192.168.1.32 27 NULL0(避免产生环路)
[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
[r2]ip route-static 192.168.1.0 30 192.168.1.1
[r2]ip route-static 192.168.1.0 30 192.168.1.10
[r2]ip route-static 192.168.1.64 27 NULL0
[r2]ip route-static 0.0.0.0 0 192.168.1.1
[r2]ip route-static 0.0.0.0 0 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.0 30 192.168.1.14
[r3]ip route-static 192.168.1.96 27 NULL0
[r3]ip route-static 0.0.0.0 0 192.168.1.5
[r3]ip route-static 0.0.0.0 0 192.168.1.14
r4
[r4]ip route-static 192.178.1.0 30 192.168.1.9
[r4]ip route-static 192.178.1.0 30 192.168.1.13
[r4]ip route-static 192.168.1.128 27 NULL0
[r4]ip route-static 0.0.0.0 0 192.168.1.13
[r4]ip route-static 0.0.0.0 0 192.168.1.9
[r4]ping 192.168.1.1
PING 192.168.1.1: 56 data bytes, press CTRL_C to break
Request time out
Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/27/30 ms
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
Mar 20 2024 21:29:23-08:00 r4 %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEthern
et0/0/2 has turned into DOWN state.
[r4-GigabitEthernet0/0/2]shdown
Mar 20 2024 21:29:23-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the DOWN state.
r5
[r5]ip route-static 192.168.1.0 30 192.168.1.17
[r5]ip route-static 192.168.1.0 30 192.168.1.21
[[R5]ip route-static 192.168.1.0 30 192.168.1.17
[R5]ip route-static 192.168.1.0 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.160 27 NULL0
4、配置r3的DHCP(实现内网通)
[r3]dhcp en
[r3]dhcp enable
[r3]ip pool aaa
[r3-ip-pool-aaa]network 192.168.1.96 mask 27
[r3-ip-pool-aaa]gateway-list 192.168.1.97
[r3-ip-pool-aaa]dns-list 114.114.114.114 8.8.8.8
[r3-ip-pool-aaa]q
[r3]int g 0/0/2
[r3-GigabitEthernet0/0/2]dhcp select global
PC通过DHCP自动获取IP地址
检查
5、配置NAT
[r5]acl 2000
[r5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]int g0/0/2
[r5-GigabitEthernet0/0/2]nat outbound 2000
检测R1 ping R6
[R1]ping1.0.0.1
PING 1.0.0.1:56 data bytes,press CTRL c to break
Reply from 1.0.0.1:bytes=56 Sequence=1 tt1=252 time=40 ms
Reply from 1.0.0.1:bytes=56 Sequence=2 ttl=252 time=40 ms
Reply from 1.0.0.1:bytes=56 Sequence=3 ttl=252 time=30 ms
Reply from 1.0.0.1:bytes=56 Sequence=4 ttl=252 time=40 ms
Reply from 1.0.0.1:bytes=56 Sequence=5 tt1=252 time=50 ms
6、配置远程登录
配置用户信息
[r1-aaa]local-user haha password cipher xixi privilege level 15
Info: Add a new user.
[r1-aaa]local-user haha service-type telnet
配置虚拟通道
[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aaa
在r5上配置nat server
[r5-GigabitEthernet0/0/2]nat server protocol tcp global current-interface 23 ins
ide 192.68.1.1 23
7、修改路线优先级
(详细步骤见3)
[r5]ip route-static 192.168.1.0 30 192.168.1.21 preference 61