子网划分:
由实验要求图可知R1、R2、R4均需两个网段代表使用百兆和千兆时的不同环回,R5需要一个网段代表环回,同时为了路由表尽量少,因此只需将192.168.1.0/24分为8个网段:
192.168.1.0/27(主网段)
192.168.1.32/27(R1环回)
192.168.1.64/27(R1环回)
192.168.1.96/27(R2环回)
192.168.1.128/27(R2环回)
192.168.1.160/27(R4环回)
192.168.1.192/27(R4环回)
192.168.1.224/27(用于R3的DHCP配置)
其中192.168.1.0/27作为主网段,而子网段需要7个网段,对其进行子网划分:
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.28/30(保留)
实验步骤:
1.给路由器配置IP地址和环回
R1
<Huawei>sys
[Huawei]sys R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
[R1-GigabitEthernet0/0/1]int LoopBack 0
[R1-LoopBack0]ip address 192.168.1.33 27
[R1-LoopBack0]int LoopBack 1
[R1-LoopBack1]ip address 192.168.1.65 27
R2
<Huawei>sys
[Huawei]sys R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.1.9 30
[R2-GigabitEthernet0/0/0]int g 0/0/01
[R2-GigabitEthernet0/0/1]ip address 192.168.1.2 30
[R2-GigabitEthernet0/0/1]int LoopBack 0
[R2-LoopBack0]ip address 192.168.1.97 27
[R2-LoopBack0]int LoopBack 1
[R2-LoopBack1]ip address 192.168.1.129 27
R3
<Huawei>sys
[Huawei]sys R3
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.1.6 30
[R3-GigabitEthernet0/0/0]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
[R3-GigabitEthernet0/0/1]int g 0/0/2
[R3-GigabitEthernet0/0/2]ip address 192.168.1.225 27
R4
<Huawei>sys
[Huawei]sys R4
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.1.14 30
[R4-GigabitEthernet0/0/0]int g 0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.1.10 30
[R4-GigabitEthernet0/0/1]int g 0/0/2
[R4-GigabitEthernet0/0/2]ip address 192.168.1.21 30
[R4-GigabitEthernet0/0/2]int e 0/0/0
[R4-Ethernet0/0/0]ip address 192.168.1.17 30
[R4-Ethernet0/0/0]int loopback 0
[R4-LoopBack0]ip address 192.168.1.161 27
[R4-LoopBack0]int loopback1
[R4-LoopBack1]ip address 192.168.1.193 27
R5
<Huawei>sys
[Huawei]sys R5
[R5]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip address 56.1.1.1 24
[R5-GigabitEthernet0/0/0]int g 0/0/2
[R5-GigabitEthernet0/0/2]ip address 192.168.1.22 30
[R5-GigabitEthernet0/0/2]int e 0/0/0
[R5-Ethernet0/0/0]ip address 192.168.1.18 30
[R5-Ethernet0/0/0]int loopback0
[R5-LoopBack0]ip address 5.5.5.5 24
R6
<Huawei>sys
[Huawei]sys R6
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip address 56.1.1.2 24
[R6-GigabitEthernet0/0/0]int loopback0
[R6-LoopBack0]ip address 6.6.6.6 24
R3
[R3]dhcp enable
[R3]ip pool 1
[R3-ip-pool-1]network 192.168.1.224 mask 27
[R3-ip-pool-1]gateway-list 192.168.1.225
[R3-ip-pool-1]dns-list 8.8.8.8 8.8.4.4
[R3-ip-pool-1]int g 0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
2.配置静态路由和缺省
R1
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.2
[R1]ip route-static 0.0.0.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.128 27 192.168.1.2
[R1]ip route-static 192.168.1.160 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.192 27 192.168.1.6
[R1]ip route-static 192.168.1.224 27 192.168.1.6
[R1]ip route-static 192.168.1.32 27 NULL 0
[R1]ip route-static 192.168.1.64 27 NULL 0
R2
[R2]ip route-static 0.0.0.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.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.224 27 192.168.1.1
[R2]ip route-static 192.168.1.224 27 192.168.1.10
[R2]ip route-static 192.168.1.96 27 NULL 0
[R2]ip route-static 192.168.1.128 27 NULL 0
R3
[R3]ip route-static 0.0.0.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.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.96 27 192.168.1.5
[R3]ip route-static 192.168.1.128 27 192.168.1.14
R4
[R4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.22
[R4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.18 preference 61
[R4]ip route-static 192.168.1.96 27 192.168.1.9
[R4]ip route-static 192.168.1.128 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.32 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.224 27 192.168.1.13
[R4]ip route-static 192.168.1.160 27 NULL 0
[R4]ip route-static 192.168.1.192 27 NULL 0
[R4]ip route-static 192.168.1.24 30 NULL 0
[R4]ip route-static 192.168.1.28 30 NULL 0
R5
[R5]ip route-static 0.0.0.0 0.0.0.0 56.1.1.2
[R5]ip route-static 192.168.1.0 24 192.168.1.21
[R5]ip route-static 192.168.1.0 24 192.168.1.17 preference 61
3.R5配置NAT 及端口映射
R5
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/0
[R5-GigabitEthernet0/0/0]nat outbound 2000
端口映射
[R5-GigabitEthernet0/0/0]int g 0/0/1
[R5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 ins
ide 192.168.1.33 23
Are you sure to continue?[Y/N]:y
4.R1 配置登录账号和密码
R1
[R1]aaa
[R1-aaa]local-user root privilege level 3 password cipher root
[R1-aaa]local-user root service-type telnet
[R1-aaa]q
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa