1.将192.168.1.0/24划分为8个网段
R1 | 192.168.1. 96/27、192.168.1.32/27、192.168.1.8/30、192.168.1.4/30、192.168.1.12/30、192.168.1.128/27、192.168.1.16/30、192.168.1.20/30、192.168.1.160/27 |
R2 | 192.168.1.4/30、192.168.1.64/27、192.168.1.128/27、192.168.1.12/30、192.168.1.32/27、192.168.1.16/30、192.168.1.20/30、192.168.1.160/27 |
R3 | 192.168.1.64/27、192.168.1.0/30、192.168.1.96/27、192.168.1.8/30、192.168.1.128/27、192.168.1.16/30、192.168.1.20/30 |
R4 | 192.168.1.0/30、192.168.1.64/27、192.168.1.4/30、192.168.1.32/27、192.168.1.160/27 |
R5 | 192.168.1.64/27、192.168.1.0/30、192.168.1.4/30、192.168.1.32/27、192.168.1.96/27、192.168.1.8/30、192.168.1.12/30、192.168.1.128/27 |
2.配置IP地址
AR1
0/0/1接口:192.168.1.1/30
0/0/0接口:192.168.1.5/30
环回1:192.168.1.65/28
环回2:192.168.1.81/28
AR2:
0/0/0接口:192.168.1.2/30
0/0/1接口:192.168.1.9/30
环回1:192.168.1.97/28
环回2:192.168.1.113/28
AR3:
0/0/1接口:192.168.1.6/30
0/0/2接口:192.168.1.13/30
AR4:
0/0/0接口:192.168.1.10/30
0/0/1接口:192.168.1.14/30
0/0/2接口:192.168.1.17/30
4/0/0接口:192.168.1.21/30
环回1:192.168.1.129/28
环回2:192.168.1.145/28
AR5:
0/0/1接口:192.168.1.18/30
0/0/0接口:12.0.0.1/24
0/0/2接口:192.168.1.22/30
环回1:192.168.1.161/27
R6:
0/0/0接口:12.0.0.2/24
环回1:1.1.1.1/24
3.验证连通性
R1
[r1]ping 192.168.1.2
PING 192.168.1.2: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.2: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 192.168.1.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.2: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.1.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/22/30 ms
[r1]ping 192.168.1.6
PING 192.168.1.6: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.6: bytes=56 Sequence=1 ttl=255 time=70 ms
Reply from 192.168.1.6: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.6: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.1.6: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 192.168.1.6: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.6 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/28/70 ms
R2
[r2]ping 192.168.1.10
PING 192.168.1.10: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.10: bytes=56 Sequence=1 ttl=255 time=70 ms
Reply from 192.168.1.10: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.10: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.1.10: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.1.10: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.10 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/32/70 ms
R3
[r3]ping 192.168.1.14
PING 192.168.1.14: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.14: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 192.168.1.14: bytes=56 Sequence=2 ttl=255 time=1 ms
Reply from 192.168.1.14: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.1.14: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.1.14: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 192.168.1.14 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/20/30 ms
R4
[r4]ping 192.168.1.18
PING 192.168.1.18: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.18: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 192.168.1.18: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 192.168.1.18: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.1.18: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.1.18: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.18 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/34/60 ms
[r4]ping 192.168.1.22
PING 192.168.1.22: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.22: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 192.168.1.22: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.22: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.1.22: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.1.22: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.22 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/22/30 ms
R5
[r5]ping 12.0.0.2
PING 12.0.0.2: 56 data bytes, press CTRL_C to break
Reply from 12.0.0.2: bytes=56 Sequence=1 ttl=255 time=80 ms
Reply from 12.0.0.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 12.0.0.2: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 12.0.0.2: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 12.0.0.2: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 12.0.0.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/38/80 ms
4.DHCP获取IP地址
[r3]dhcp enable
[r3]ip pool aa
[r3-ip-pool-aa]network 192.168.1.32 mask 27
[r3-ip-pool-aa]gateway-list 192.168.1.33
[r3-ip-pool-aa]dns-list 114.114.114.114 8.8.8.8
[r3-ip-pool-aa]q
[r3-GigabitEthernet0/0/0]ip add 192.168.1.33 27
[r3-GigabitEthernet0/0/0]dhcp select global
验证 PC端获取IP地址情况
PC1
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe27:4242
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.62
Subnet mask.......................: 255.255.255.224
Gateway...........................: 192.168.1.33
Physical address..................: 54-89-98-27-42-42
DNS server........................: 114.114.114.114
8.8.8.8
PC2
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fed0:283f
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.61
Subnet mask.......................: 255.255.255.224
Gateway...........................: 192.168.1.33
Physical address..................: 54-89-98-D0-28-3F
DNS server........................: 114.114.114.114
8.8.8.8
5.添加路由表
R1
[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.96 27 192.168.1.2
[r1]ip route-static 192.168.1.8 30 192.168.1.2
[r1]ip route-static 192.168.1.32 27 192.168.1.6
[r1]ip route-static 192.168.1.12 30 192.168.1.6
R2
[r2]ip route-static 192.168.1.64 27 192.168.1.1
[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.32 27 192.168.1.10
R3
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r3]ip route-static 192.168.1.64 27 192.168.1.5
[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.96 27 192.168.1.5
[r3]ip route-static 192.168.1.96 27 192.168.1.14
R4
[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 70
[r4]ip route-static 192.168.1.96 27 192.168.1.9
[r4]ip route-static 192.168.1.0 30 192.168.1.9
[r4]ip route-static 192.168.1.64 27 192.168.1.9
[r4]ip route-static 192.168.1.64 27 192.168.1.13
[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
R5
r5]ip route-static 192.168.1.0 24 192.168.1.17
[r5]ip route-static 192.168.1.0 24 GigabitEthernet 0/0/0 192.168.1.21
[r5]acl 2000
[r5-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]q
[r5]int g 0/0/2
[r5-GigabitEthernet0/0/2]nat outbound 2000
添加空接口
[r1]ip route-static 192.168.1.64 27 n 0
[r2]ip route-static 192.168.1.96 27 NULL 0
[r3]ip route-static 192.168.1.32 27 NULL 0
[r4]ip route-static 192.168.1.128 27 NULL 0
[r5]ip route-static 192.168.1.160 27 NULL 0
验证路由配置情况
<r1>ping 1.1.1.1
PING 1.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=252 time=60 ms
Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=252 time=40 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=252 time=50 ms
Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=252 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=252 time=30 ms
--- 1.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/42/60 ms
PC>ping 1.1.1.1
Ping 1.1.1.1: 32 data bytes, Press Ctrl_C to break
From 1.1.1.1: bytes=32 seq=1 ttl=252 time=63 ms
From 1.1.1.1: bytes=32 seq=2 ttl=252 time=62 ms
From 1.1.1.1: bytes=32 seq=3 ttl=252 time=47 ms
From 1.1.1.1: bytes=32 seq=4 ttl=252 time=47 ms
From 1.1.1.1: bytes=32 seq=5 ttl=252 time=63 ms
--- 1.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/56/63 ms
6.R6 telnet R5的IP地址时,实际登录R1
R1
[r1]aaa
[r1-aaa]local-user yh privilege level 15 password cipher 123456
[r1-aaa]local-user yh service-type telnet
[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aaa
R5
[r5]int g 0/0/2
[r5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 inside 192.168.1.5 23
Are you sure to continue?[Y/N]:y