题目
拓扑图
环回配置
R1
< Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r1
[r1]int loo
[r1]int LoopBack 0
[r1-LoopBack0]ip add 192.168.1.33 28
[r1-LoopBack0]int LoopBack 1
[r1-LoopBack1]ip add 192.168.1.49 28
R2
< Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r2
[r2]int l
[r2]int LoopBack 0
[r2-LoopBack0]ip add 192.168.1.65 28
[r2-LoopBack0]int LoopBack 1
[r2-LoopBack1]ip add 192.168.1.81 28
[r2-LoopBack1]
R4
< Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r4
[r4]int l
[r4]int LoopBack 0
[r4-LoopBack0]ip add 192.168.1.129 28
[r4-LoopBack0]int LoopBack 1
[r4-LoopBack1]ip add 192.168.1.145 28
[r4-LoopBack1]
R5
< r5>sys
Enter system view, return user view with Ctrl+Z.
[r5]int loo
[r5]int LoopBack 0
[r5-LoopBack0]ip add 192.168.1.161 27
R6
< isp>sys
Enter system view, return user view with Ctrl+Z.
[isp]int l
[isp]int LoopBack 0
[isp-LoopBack0]ip add 1.1.1.1 24
R3利用dhcp自动配置地址
[ r3]dhcp ena
[r3]dhcp enable
[r3]ip pool aaa
Info: It’s successful to create an IP address pool.
[r3-ip-pool-aaa]netw
[r3-ip-pool-aaa]network 192.168.1.96 mask 27
[r3-ip-pool-aaa]gate
[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 g0/0/2
[r3-GigabitEthernet0/0/2]dhcp s
[r3-GigabitEthernet0/0/2]dhcp select g
[r3-GigabitEthernet0/0/2]dhcp select global
[r3-GigabitEthernet0/0/2]
别忘了调整主机配置,如图
查看IP是否自动配置
IP地址
R1
[ r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
Aug 1 2023 20:24:36-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-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.5 30
Aug 1 2023 20:24:44-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]
R2
[ r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 30
Aug 1 2023 20:25:34-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 add 192.168.1.9 30
[r2-GigabitEthernet0/0/1]
Aug 1 2023 20:25:51-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]
R3
< r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.13 30
Aug 1 2023 20:26:46-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 add 192.168.1.6 30
Aug 1 2023 20:27:02-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 g0/0/2
[r3-GigabitEthernet0/0/2]ip add 192.168.1.97 27
[r3-GigabitEthernet0/0/2]
Aug 1 2023 20:27:35-08:00 r3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r3-GigabitEthernet0/0/2]
R4
< r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.10 30
Aug 2 2023 10:31:56-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 add 192.168.1.14 30
Aug 2 2023 10:32:04-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 add 192.168.1.21 30
Aug 2 2023 10:32:19-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 e4/0/0
[r4-Ethernet4/0/0]ip add 192.168.1.17 30
[r4-Ethernet4/0/0]
R5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.22 30
Aug 2 2023 10:33:13-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 e4/0/0
[r5-Ethernet4/0/0]ip add 192.168.1.18 30
Aug 2 2023 10:33:31-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface Ethernet4/0/0 has entered the UP state.
[r5-Ethernet4/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 12.0.0.1 24
[r5-GigabitEthernet0/0/1]
Aug 2 2023 10:34:30-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]
R6
[ isp]int g0/0/0
[isp-GigabitEthernet0/0/0]ip add 12.0.0.2 24
Aug 1 2023 20:35:40-08:00 isp %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[isp-GigabitEthernet0/0/0]
全网可达
R1
[r1]ip rou
[r1]ip route
[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.64 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.12 30 192.168.1.6
[r1]ip route-static 192.168.1.96 27 192.168.1.6
R2
[r2]ip rou
[r2]ip route
[r2]ip route-static 0.0.0.0 0 192.168.1.10
[r2]ip rou
[r2]ip route
[r2]ip route-static 192.168.1.96 27 192.168.1.13
[r2]ip route-static 192.168.1.96 27 192.168.1.6
[r2]undo ip route-static 192.168.1.96 27 192.168.1.6
[r2]ip route-static 192.168.1.96 27 192.168.1.1
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.4 30 192.168.1.1
R3
[r3]ip rou
[r3]ip route
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r3]ip rou
[r3]ip route
[r3]ip route-static 192.168.1.64 27 192.168.1.14
[r3]ip route-static 192.168.1.64 27 192.168.1.5
[r3]ip route-static 192.168.1.32 27 192.168.1.5
[r3]ip route-static 192.168.1.0 30 192.168.1.5
R4
[r4]ip rou
[r4]ip route
[r4]ip route-static 0.0.0.0 0 192.168.1.22
[r4]ip route-static 0.0.0.0 0 192.168.1.18 pre 61
[r4]ip rou
[r4]ip route
[r4]ip route-static 192.168.1.64 27 192.168.1.9
[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.96 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.0 30 192.168.1.9
R5
[r5]ip rou
[r5]ip route
[r5]ip route-static 0.0.0.0 0 12.0.0.2
[r5]ip rou
[r5]ip route
[r5]ip route-static 192.168.1.128 27 192.168.1.21
[r5]ip rou
[r5]ip route
[r5]ip route-static 192.168.1.8 30 192.168.1.21
[r5]ip route-static 192.168.1.0 30 192.168.1.21
[r5]ip route-static 192.168.1.4 30 192.168.1.21
[r5]ip route-static 192.168.1.12 30 192.168.1.21
[r5]ip route-static 192.168.1.96 27 192.168.1.21
[r5]ip route-static 192.168.1.64 27 192.168.1.21
[r5]ip route-static 192.168.1.32 27 192.168.1.21
[r5]ip route-static 192.168.1.8 30 192.168.1.21 pr 61
Info: Succeeded in modifying route.
[r5]ip route-static 192.168.1.0 30 192.168.1.21 pr 61
Info: Succeeded in modifying route.
[r5]ip route-static 192.168.1.4 30 192.168.1.21 pr 61
Info: Succeeded in modifying route.
[r5]ip route-static 192.168.1.12 30 192.168.1.21 pr 61
Info: Succeeded in modifying route.
[r5]ip route-static 192.168.1.96 27 192.168.1.21 pr 61
Info: Succeeded in modifying route.
[r5]ip route-static 192.168.1.64 27 192.168.1.21 pr 61
Info: Succeeded in modifying route.
[r5]ip route-static 192.168.1.32 27 192.168.1.21 pr 61
Info: Succeeded in modifying route.
[r5]ip route-static 192.168.1.128 27 192.168.1.21 pr 61
Info: Succeeded in modifying route.
nat实现全网可达
R5
[r5]acl 2000
[r5-acl-basic-2000]rule per
[r5-acl-basic-2000]rule permit sou
[r5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]q
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]nat out
[r5-GigabitEthernet0/0/1]nat outbound 2000
防环
R1
[r1]ip rou
[r1]ip route
[r1]ip route-static 192.168.1.32 27 nu
[r1]ip route-static 192.168.1.32 27 NULL 0
R2
[r2]ip rou
[r2]ip route
[r2]ip route-static 192.168.1.64 27 nu
[r2]ip route-static 192.168.1.64 27 NULL 0
R4
[r4]ip route
[r4]ip route-static 192.168.1.128 27 nu
[r4]ip route-static 192.168.1.128 27 NULL 0
telnet登录
R1
[r1]aaa
[r1-aaa]local-use
[r1-aaa]local-user chs pr
[r1-aaa]local-user chs privilege lev
[r1-aaa]local-user chs privilege level 15 pass
[r1-aaa]local-user chs privilege level 15 password ci
[r1-aaa]local-user chs privilege level 15 password cipher 123456
Info: Add a new user.
[r1-aaa]local-u
[r1-aaa]local-user chs ser
[r1-aaa]local-user chs service-type tel
[r1-aaa]local-user chs service-type telnet
[r1-aaa]q
[r1]user
[r1]user-int
[r1]user-interface vty 0 4
[r1-ui-vty0-4]au
[r1-ui-vty0-4]authentication-mode aaa
R5
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]nat ser
[r5-GigabitEthernet0/0/1]nat server pr
[r5-GigabitEthernet0/0/1]nat server protocol tcp g
[r5-GigabitEthernet0/0/1]nat server protocol tcp global cu
[r5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 ins
ide 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
[r5-GigabitEthernet0/0/1]
验证,如图
实验成功