实验要求
1 R6为isp, 接口IP地址均为公有地址;该设备只能配置IP地址,之后不能冉对其进行其他任何配置;
2 R1-R5为局域网,私有IP地址192.168.1.0/24, 请合理分配;
3 R1, R2, R4,各有两个环回地址; R5; R6各有一个环回地址;所有路由器上环回均代表连接用户的接口;
4 R3下的两台Pc通过DHCP自动获取IP地址;
5选路最佳,路由表尽量小,避免环路;
6 R1-R5均可以访问R6的环回;
7 R6telnetR5的公有IP地址时,实际登陆到R1上;
8 R4与R5正常通过1000M链路,故障时通过100m链路;
第一步
首先我们按照要求进行子网划分
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(保留)
如下图所示
第二步给路由器配置接口ip和环回
r1
[Huawei]
[Huawei]sys name
[name]sys r1
[r1]
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
Jul 6 2022 15:01:31-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 g 0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
[r1-GigabitEthernet0/0/1]
Jul 6 2022 15:02:02-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]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
[r1-LoopBack1]
[r1-LoopBack1]
[r1-LoopBack1]
r2
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r2
[r2]
<r2>sys
Enter system view, return user view with Ctrl+Z.
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.9 30
Jul 6 2022 15:06:07-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 g 0/0/01
[r2-GigabitEthernet0/0/1]ip address 192.168.1.2 30
Jul 6 2022 15:06:33-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 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
[r2-LoopBack1]
r3
[r3]
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.6 30
Jul 6 2022 15:10:13-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 g 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
Jul 6 2022 15:10:28-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 g 0/0/2
[r3-GigabitEthernet0/0/2]ip address 192.168.1.225 27
Jul 6 2022 15:10:43-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]q
r4
[r4]
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.14 30
[r4-GigabitEthernet0/0/0]
Jul 6 2022 15:12:52-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 g 0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.1.10 30
Jul 6 2022 15:13:47-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 g 0/0/2
[r4-GigabitEthernet0/0/2]ip address 192.168.1.21 30
Jul 6 2022 15:14:04-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 g 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.17 30
[r4-GigabitEthernet0/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
[r4-LoopBack1]q
r6
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r6
[r6]
<r6>sys
Enter system view, return user view with Ctrl+Z.
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip address 56.1.1.2 24
Jul 6 2022 15:25:01-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 loopback0
[r6-LoopBack0]ip address 6.6.6.6 24
[r6-LoopBack0]
下面来配置r3的dhcp
[r3]
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r3]ip pool 1
Info: It's successful to create an IP address pool.
[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
[r3-GigabitEthernet0/0/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
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]int g 0/0/1
[r5-GigabitEthernet0/0/1]nat static protocol tcp global 202.10.10.3 23 inside 19
2.168.1.1 23
[r5-GigabitEthernet0/0/1]nat static protocol tcp global current-interface 23 i
nside 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
Info: The NAT in the network has existed.
Already existing configuration will be covered with current configure. [Y/N]:
y