一、实验拓扑
二、实验要求
1、R6为ISP,接口IP地址均为公有地址,该设备只能配置IP地址,之后不能再对其进行任何配置;
2、R1-R5为局域网,私有IP地址192.168.1.0/24,请合理分配;
3、R1、R2、R4,各有两个环回IP地址;R5,R6各有一个环回地址;所有路由器上环回均代表连接用户的接口;
4、R3下面的两台PC通过DHCP自动获取IP地址;
5、选路最佳,路由表尽量小,避免环路;
6、R1-R5均可以访问R6的环回;
7、R6 telnet R5的公有地址时,实际登录到R1上;
8、R4与R5正常通过1000M链路,故障时通过100m链路;
三、实验思路
1.IP地址划分
汇总网段:192.168.1.0/24
由已知,共需要划分14个子网段,划分如下:
192.168.1.0/27——作为骨干链路,划出6个网段:
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.32/27——作为R1的环回网段,划出2个环回网段:
192.168.1.32/28 192.168.1.48/28
192.168.1.64/27——作为R2的环回网段,划出2个环回网段:
192.168.1.64/28 192.168.1.80/28
192.168.1.128/27——作为R4的环回网段,划出2个环回网段:
192.168.1.128/28 192.168.1.144/28
192.168.1.96/27——作为R3下面的网段
192.168.1.160/27——作为R5的环回网段,划出一个环回子网段:
192.168.160/28
2.配置IP地址
给路由器每个接口在相应网段配置IP地址:
直连网段IP:int g0/0/?
Ip address 192.168.1.?
给环回网段接口配置IP地址:
Int L1/L2
Ip address 192.168.1.?
3.设置DHCP自动获取IP地址
打开DHCP服务:dhcp enable
创建地址池:ip pool aa
Network 192.168.1.96 mask 27
Gateway-list 192.168.1.96
Dns-list 114.114.114.114 8.8.8.8
进入接口开启DHCP功能:ip address 192.168.1.96 27
Dhcp select global
4.缺省路由
为避免环路、路由条目过于繁多,配置缺省路由
Ip route-static 0.0.0.0 192.168.1.2
5、私网访问公网IP
在边缘路由器——R5上进行配置
使用acl控制流量
Acl 2000
Rule 5 permit source 192.168.1.0 0.0.0.255
进入接口:nat outbound 2000
6、telent远程登录
在R1上开启telent服务并设置密码123456,以及允许同时登入的设备数
Aaa
Local-user zlm privilege level 15 password cipher 123456
Local-user zlm service-type telent
User-interface vty 0 4
Authentication-mode aaa
在R5上开启telent登录
进入接口
Nat server protocol tcp global current-interface 23 inside 192.168.1.1 23
7、R4与R5正常通过1000M链路,故障时通过100m链路;
降低100M的链路优先值:
R4-R5:Ip route-satic 0.0.0.0 0 192.168.1.21 preference 65
R5-R4:Ip route-satic 192.168.1.0 24 192.168.1.22 preference 65
四、实验步骤
1.配置IP地址
R1
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0] ip address 192.168.1.1 30
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.5 30
R2
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.2 30
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.9 30
R3
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.6 30
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.13 30
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 192.168.1.97 27
R4
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.10 30
[Huawei-GigabitEthernet0/0/0] int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.14 30
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 192.168.1.17 30
[Huawei-GigabitEthernet0/0/2]int g0/0/3
[Huawei-GigabitEthernet0/0/3]ip address 192.168.1.21 30
R5
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.18 30
[Huawei-GigabitEthernet0/0/2]ip address 192.168.1.22 30
[Huawei-GigabitEthernet0/0/1]ip address 12.0.0.1 24
R6
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 12.0.0.2 24
2.配置环回路由和静态
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 192.168.1.33 28
[R1-LoopBack0]interface LoopBack 1
[R1-LoopBack1]ip address 192.168.1.49 28
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 192.168.1.65 28
[R2-LoopBack0]interface LoopBack 1
[R2-LoopBack1]ip address 192.168.1.81 28
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 192.168.1.129 28
[R4-LoopBack0]interface LoopBack 1
[R4-LoopBack1]ip address 192.168.1.145 28
[R5]interface LoopBack 0
[R5-LoopBack0]ip address 192.168.1.161 28
[R6]interface LoopBack 0
[R6-LoopBack0]ip address 1.1.1.1 24
R1
[r1]ip route-static 192.168.1.4 30 192.168.1.2
[r1]ip route-static 192.168.1.64 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.128 27 192.168.1.10
[r1]ip route-static 192.168.1.16 30 192.168.1.10
[r1]ip route-static 192.168.1.16 30 192.168.1.2
[r1]ip route-static 192.168.1.20 30 192.168.1.2
[r1]ip route-static 192.168.1.20 30 192.168.1.10
[r1]ip route-static 192.168.1.160 27 192.168.1.10
[r1]ip route-static 192.168.1.160 27 192.168.1.2
R2
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.8 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.6
[r2]ip route-static 192.168.1.128 27 192.168.1.6
[r2]ip route-static 192.168.1.16 30 192.168.1.6
[r2]ip route-static 192.168.1.20 30 192.168.1.6
[r2]ip route-static 192.168.1.160 27 192.168.1.6
R3
[r3]ip route-static 192.168.1.32 27 192.168.1.9
[r3]ip route-static 192.168.1.0 30 192.168.1.9
[r3]ip route-static 192.168.1.64 27 192.168.1.9
[r3]ip route-static 192.168.1.64 27 192.168.1.14
[r3]ip route-static 192.168.1.4 30 192.168.1.14
[r3]ip route-static 192.168.1.128 27 192.168.1.14
[r3]ip route-static 192.168.1.16 30 192.168.1.14
[r3]ip route-static 192.168.1.20 30 192.168.1.14
[r3]ip route-static 192.168.1.160 27 192.168.1.14
R4
[r4]ip route-static 192.168.1.160 27 192.168.1.18
[r4]ip route-static 192.168.1.160 27 192.168.1.22
[r4]ip route-static 192.168.1.96 27 192.168.1.13
[r4]ip route-static 192.168.1.8 30 192.168.1.13
[r4]ip route-static 192.168.1.32 27 192.168.1.13
[r4]ip route-static 192.168.1.32 27 192.168.1.5
[r4]ip route-static 192.168.1.0 30 192.168.1.5
[r4]ip route-static 192.168.1.64 27 192.168.1.5
R5
[r5]ip route-static 1.1.1.0 24 12.0.0.2
[r5]ip route-static 192.168.1.128 27 192.168.1.17
[r5]ip route-static 192.168.1.128 27 192.168.1.21
[r5]ip route-static 192.168.1.4 30 192.168.1.21
[r5]ip route-static 192.168.1.4 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.12 30 192.168.1.121
[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.96 27 192.168.1.17
[r5]ip route-static 192.168.1.8 30 192.168.1.17
[r5]ip route-static 192.168.1.8 30 192.168.1.21
[r5]ip route-static 192.168.1.32 27 192.168.1.21
[r5]ip route-static 192.168.1.32 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.0 30 192.168.1.21
[r5]ip route-static 192.168.1.64 27 192.168.1.21
[r5]ip route-static 192.168.1.64 27 192.168.1.17
3.DHCP自动获取
[R3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R3]ip pool aa
Info:It's successful to create an IP address pool.
[R3-ip-pool-aa]net
[R3-ip-pool-aa]network 192.168.1.96 mask 27
[R3-ip-pool-aa]gateway-list 192.168.1.97
[R3-ip-pool-aa]int g0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
4.避免环路,做缺省路由
[r1]ip route-static 192.168.1.32 27 NULL 0
[r2]ip route-static 192.168.1.64 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]ip route-static 0.0.0.0 0 192.168.1.2
[r1]ip route-static 0.0.0.0 0 192.168.1.10
[r2]ip route-static 0.0.0.0 0 192.168.1.6
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r4]ip route-static 0.0.0.0 0 192.168.1.18
[r5]ip route-static 0.0.0.0 0 12.0.0.2
5.R1-R5均可访问R6,设置acl
[r5]acl 2000
[r5-acl-basic-2000]rul
[r5-acl-basic-2000]rule 10 per
[r5-acl-basic-2000]rule 10 permit so
[r5-acl-basic-2000]rule 10 permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]int g0/0/1
[r5-GigabitEthernet0/0/1]nat ou
[r5-GigabitEthernet0/0/1]nat outbound 2000
6.telent远程登录
[r1]aaa
[r1-aaa]lo
[r1-aaa]local-user adm
[r1-aaa]local-user admin p
[r1-aaa]local-user admin pr
[r1-aaa]local-user zlm privilege le
[r1-aaa]local-user zlm privilege level 15 pa
[r1-aaa]local-user zlm privilege level 15 password ci
[r1-aaa]local-user zlm privilege level 15 password cipher 123456
Info: Add a new user.
[r1-aaa]loc
[r1-aaa]local-user zlm se
[r1-aaa]local-user zlm service-type t
[r1-aaa]local-user zlm service-type telnet
[r1-aaa]u
[r1-aaa]us
[r1-aaa]user-i
[r1-aaa]user-interface vty 0 4
[r1-ui-vty0-4]au
[r1-ui-vty0-4]authentication-mode aaa
[r1-ui-vty0-4]int g0/0/1
[r1-GigabitEthernet0/0/1]nat se
[r1-GigabitEthernet0/0/1]nat server pr
[r1-GigabitEthernet0/0/1]nat server protocol t
[r1-GigabitEthernet0/0/1]nat server protocol tcp g
[r1-GigabitEthernet0/0/1]nat server protocol tcp global c
[r1-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 ins
[r1-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 inside 192.168.1.1 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
[r1-GigabitEthernet0/0/1]q
[r1]q
7.设置R4-R5的链路优先级提高100Mb链路的优先级:
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
[r4]ip route-static 192.168.1.160 27 192.168.1.22 preference 61
Info: Succeeded in modifying route.
[r5]ip route-static 192.168.1.0 24 192.168.1.21 preference 61
Info: Succeeded in modifying route.
五、实验结果
R5 ping R1
Pc1 ping R6