一、给R1-R7配置IP地址和环回地址,并检查配置结果
1,R1
[Huawei]int loopback0
[Huawei-LoopBack0]ip add 1.1.1.1 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 14.1.1.1 24
2,R2
[Huawei]int loopback0
[Huawei-LoopBack0]ip add 2.2.2.2 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 23.1.1.1 24
3,R3
[Huawei]int loopback0
[Huawei-LoopBack0]ip add 3.3.3.3 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 34.1.1.1 24
4,R4
[Huawei]int loopback0
[Huawei-LoopBack0]ip add 4.4.4.4 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 14.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 34.1.1.2 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 45.1.1.1 24
[Huawei-GigabitEthernet0/0/2]int g0/0/3
[Huawei-GigabitEthernet0/0/3]ip add 46.1.1.1 24
5,R5
[Huawei]int loopback0
[Huawei-LoopBack0]ip add 5.5.5.5 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 45.1.1.2 24
6,R6
[Huawei]int loopback0
[Huawei-LoopBack0]ip add 6.6.6.6 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 46.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 67.1.1.1 24
7,R7
[Huawei]int loopback0
[Huawei-LoopBack0]ip add 7.7.7.7 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 67.1.1.2 24
<Huawei>display ip interface brief
—检查
二、R1上创建三个环回,并检查
[Huawei]int loopback 1
[Huawei-LoopBack1]ip add 172.16.1.1 24
[Huawei-LoopBack1]int loopback 2
[Huawei-LoopBack2]ip add 172.16.2.1 24
[Huawei-LoopBack2]int loopback3
[Huawei-LoopBack3]ip add 172.16.3.1 24
三、在R1-R5运行RIPV2
R1
[r1]rip 100(给出一个进程号)
[r1-rip-100]version 2(给出一个版本号)
#路由通告
[r1-rip-100]network 1.0.0.0(R1的环回)
[r1-rip-100]network 12.0.0.0
[r1-rip-100]network 14.0.0.0
[r1-rip-100]network 172.16.0.0
R2
[r2]rip 100
[r2-rip-100]version 2
[r2-rip-100]network 2.0.0.0
[r2-rip-100]network 12.0.0.0
[r2-rip-100]network 23.0.0.0
R3
[r3]rip 100
[r3-rip-100]version 2
[r3-rip-100]network 3.0.0.0
[r3-rip-100]network 23.0.0.0
[r3-rip-100]network 34.0.0.0
R4
[r4]rip 100
[r4-rip-100]version 2
[r4-rip-100]network 4.0.0.0
[r4-rip-100]network 14.0.0.0
[r4-rip-100]network 34.0.0.0
[r4-rip-100]network 45.0.0.0
[r4-rip-100]network 46.0.0.0R5
[r5]rip 100
[r5-rip-100]version 2
[r5-rip-100]network 45.0.0.0
四、在R6-R7上运行RIPV1
R6
[r6]rip 100
[r6-rip-100]version 1
[r6-rip-100]network 6.0.0.0
[r6-rip-100]network 46.0.0.0
[r6-rip-100]network 67.0.0.0
R7
[r7]rip 100
[r7-rip-100]version 1
[r7-rip-100]network 7.0.0.0
[r7-rip-100]network 67.0.0.0
在R1-R7查看各自rip路由表(看ripv1与ripv2是否互相学习到路由):
<r1>display ip ro pro rip
R3通过R2访问R1的环回
五、减少路由条目数量
1、手工汇总
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]rip summary-address 172.16.0.0 255.255.252.0(路由汇总)
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]rip summary-address 172.16.0.0 255.255.252.0(路由汇总)
2、同时为了避免汇总产生路由黑洞带来的路由环路的影响,写一条汇总指向null0
[r1]rip 100
[r1-rip-100]timers rip 15 60 100
[r1]display rip 100
3、加快网络收敛,更改计时器,在R1上做收敛
[r1]rip 100
[r1-rip-100]timers rip 15 60 100
[r1]display rip 100
六、R5创建一个环回模拟运营商,5.5.5.5不能通告
1、在内网边界路由r4上写一条指向r5的缺省,并且下放该缺省:
R4:[r4]ip route-static 0.0.0.0 0.0.0.0 45.1.1.2
[r4]rip 100
[r4-rip-100]version 2
[r4-rip-100]default-route originate—下放缺省
2、再在r4上做一对多nat,使得内网可以访问外网
R4:[r4]acl 2002
[r4-acl-basic-2002]rule 5 permit source any
[r4-acl-basic-2002]interface g0/0/2
[r4-GigabitEthernet0/0/2]nat outbound 2002
七、R1 telnet R2环回实际telnet 到R7上(涉及NAT地址转换)
1、在R2和R7上开启Telnet
R2[r2]user-interface vty 0 4
[r2-ui-vty0-4]set authentication password cipher cisco
R7[r7]user-interface vty 0 4
[r7-ui-vty0-4]set authentication password cipher cisco
2、从outside访问inside改变目标地址,从inside访问outside改变源地址,改变目标地址发包方向为1-2-3-4-6-7,将目标7.7.7.7改成从R2右侧通过
R2[r2]acl 2000
[r2-acl-basic-2000]rule permit source 7.0.0.0 0
[r2-acl-basic-2000]int g0/0/1
[r2-GigabitEthernet0/0/1]rip metricin 2000 4
3、回包时源为7.7.7.7,目标为12.1.1.0,要保证源访问目标时为7-6-4-3-2-1,此时源访问目标时有两条路径,一条为7-6-4-3-2-1,另一条为7-6-4-1,改之前默认走7-6-4-1,因此要将7-6-4-1这条路的度量值改大,这样就会走7-6-4-3-2-1
R4[r4]dis acl 2001
[r4]acl 2001
[r4-acl-basic-2001]rule permit source 12.1.1.0 0
[r4-acl-basic-2001]int g0/0/0
[r4-GigabitEthernet0/0/1]rip metricin 2001 4---入方向
4,在任意路由器测试telnet(这里用R3测试)
R3
[r3]telent 7.7.7.7 (测试)
成功
R3
[r3]telent 2.2.2.2(测试)
成功
6、在R1上实现实验要求
R1
< R1>
< R1>Telent 2.2.2.2
password:cisco
< R7>
成功
八、R6-R7不能学习到达R1换回路由
[r6]dis acl all
Total nonempty ACL number is 0
[r6]acl 2000
[r6-acl-basic-2000]rule deny source 1.1.1.0 0.0.0.255(过滤)
[r6-acl-basic-2000]rule deny source 172.16.0.0 0.0.0.255(过滤)
[r6-acl-basic-2000]rule permit source any(放行其他)
[r6-acl-basic-2000]q
[r6]rip 100
[r6-rip-100]filter-policy 2000 import g0/0/0---调用acl2000从入方向过滤R1的两个环回路由
[r6-rip-100]q
[r6]q
<r6>display ip ro pro rip
九、全网可达
查看R1-R7的rip路由表:dis ip routing-table protoco rip
(查看是否有缺省路由)
各个路由器随机互Ping:
R1
[r1]ping 5.5.5.5
R6
[r6]ping 1.1.1.1