R1:
[R1]INT LoopBack 0
[R1-LoopBack0]ip add 192.168.1.33 28
[R1-LoopBack0]q
[R1]int lo1
[R1-LoopBack1]ip add 192.168.1.49 28
[R1-LoopBack1]q
R2:
[R2]int LoopBack 0
[R2-LoopBack0]ip add 192.168.1.65 28
[R2-LoopBack0]q
[R2]int LoopBack 1
[R2-LoopBack1]ip add 192.168.1.81 28
[R2-LoopBack1]q
R3:
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 192.168.1.97 27
Jan 1 2023 23:21:53-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state.
[R3-GigabitEthernet0/0/2]q
R4:
[R4]int LoopBack 0
[R4-LoopBack0]ip add 192.168.1.129 28
[R4-LoopBack0]q
[R4]int LoopBack 1
[R4-LoopBack1]ip add 192.168.1.145 28
[R4-LoopBack1]q
R5:
[R5]int lo0
[R5-LoopBack0]ip add 192.168.1.161 27
R6:
[R6]int lo0
[R6-LoopBack0]ip add 6.6.6.6 24
[R6-LoopBack0]q
DCHP自动分配IP
[R3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R3]ip pool q
Info: It's successful to create an IP address pool.
[R3-ip-pool-q]network 192.168.1.96 mask 27
[R3-ip-pool-q]gateway-list 192.168.1.97
[R3-ip-pool-q]dns-list 114.114.114.114 8.8.8.8
[R3-ip-pool-q]int g0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
路由配置
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.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.96 27 192.168.1.6
[R1]ip route-static 192.168.1.12 30 192.168.1.6
R2
[R2]ip route-static 0.0.0.0 0 192.168.1.10
[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
[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.10
R3
[R3]ip route-static 0.0.0.0 0 192.168.1.14
[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
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.64 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 61
[R4]ip route-static 192.168.1.64 27 192.168.1.9
[R4]ip route-static 192.168.1.96 27 192.168.1.13
[R4]ip route-static 192.168.1.0 27 192.168.1.9
[R4]undo ip route-static 192.168.1.0 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.4 30 192.168.1.13
[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
R5
[R5]ip route-static 0.0.0.0 0 56.1.1.2
[R5]ip route-static 192.168.1.32 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.128 27 192.168.1.17
[R5]ip route-static 192.168.1.0 27 192.168.1.17
[R5]undo ip route-static 192.168.1.0 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.0 255.255.255.252 192.168.1.21 p 61
[R5]ip route-static 192.168.1.4 255.255.255.252 192.168.1.21 p 61
[R5]ip route-static 192.168.1.8 255.255.255.252 192.168.1.21 p 61
[R5]ip route-static 192.168.1.12 255.255.255.252 192.168.1.21 p 61
[R5]ip route-static 192.168.1.32 255.255.255.224 192.168.1.21 p 61
[R5]ip route-static 192.168.1.64 255.255.255.224 192.168.1.21 p 61
[R5]ip route-static 192.168.1.96 255.255.255.224 192.168.1.21 p 61
[R5]ip route-static 192.168.1.128 255.255.255.224 192.168.1.21 p 61
NAT设置
[R5]acl 2000
[R5-acl-basic-2000]rule pe
[R5-acl-basic-2000]rule permit s
[R5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R5-acl-basic-2000]int g0/0/1
[R5-GigabitEthernet0/0/1]nat outb
[R5-GigabitEthernet0/0/1]nat outbound 2000
测试是否连通外网
设置空接口路由防环
R1:
[R1]ip route-static 192.168.1.32 27 NULL 0
R2:
[R2]ip route-static 192.168.1.64 27 NULL 0
R4:
[R4]ip route-static 192.168.1.128 27 NULL 0
创建用户:
[R1-aaa]local-user cao privilege level 15 password cipher 123456
Info: Add a new user.
[R1-aaa]loc
[R1-aaa]local-user cao se
[R1-aaa]local-user cao service-type te
[R1-aaa]local-user cao service-type telnet
[R1-aaa]q
[R1]user-int
[R1]user-interface v
[R1]user-interface vty 0 4
[R1-ui-vty0-4]auth
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]q
端口映射设置:
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]nat ser
[R5-GigabitEthernet0/0/1]nat server port
[R5-GigabitEthernet0/0/1]nat server pro
[R5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 inside 192.168.1.33 23
Warning:The port 23 is well-known port. If you continue it may cause function failure.
Are you sure to continue?[Y/N]:y
实验结果: