结班实验

 

要求:
1.使用172.16.0.0/16划分网络
2.使用ospf协议合理规划区域保证更新安全
3.加快收敛速度
4.router1为dr,没有bdr
5.pc2345自动获取ip地址
pc1为外网pc要求可以互相访问
6.router7为运营商只能配置ip地址
7.pc1远程登陆router7,实际登陆router4
8.pc4可以ping通router6但不能登陆router6
9.pc3可以ping通pc5但pc5不能ping通pc3

 

1.根据图中可得,需要将172.16.0.0/16分为四个网段分别于area 0、area 1、area 2、area3

四是二的二次方,所以应向主机位由高位开始借两位,得到四个网段:

area 0:172.16.0.0/18

area 1:172.16.64.0/18

area 2:172.16.128.0/18

area 3:172.16.192.0/18

如图所示:

2.利用ospf协议使网络可达,并且要保证区域安全,应在区域内进行明文或密文认证。area 0密文认证;area 1、area 2、area 3明文认证

r1:

[r1]interface g0/0/0	                               //配置IP以及环回
[r1-GigabitEthernet0/0/0]ip address 172.16.64.2 18
[r1]interface g0/0/1	
[r1-GigabitEthernet0/0/1]ip address 172.16.0.1 18	
[r1]interface LoopBack 0	
[r1-LoopBack0]ip address 1.1.1.1 32


[r1]ospf 100 router-id 1.1.1.1                         //使用ospf协议宣告
[r1-ospf-100]area 1	
[r1-ospf-100-area-0.0.0.1]network 172.16.64.2 0.0.0.0
[r1-ospf-100]area 0	
[r1-ospf-100-area-0.0.0.0]network 172.16.0.1 0.0.0.0	
[r1-ospf-100-area-0.0.0.0]network 1.1.1.1 0.0.0.0


[r1]ospf 100                                      //在area 1进行明文认证,在area 0密文认证
[r1-ospf-100]area 1
[r1-ospf-100-area-0.0.0.1]authentication-mode simple cipher 123
[r1-ospf-100]area 0
[r1-ospf-100-area-0.0.0.0]authentication-mode simple cipher 456
[r1-ospf-100-area-0.0.0.0]authentication-mode md5
r2:

[r2]interface g0/0/0	                                  //配置IP以及环回地址
[r2-GigabitEthernet0/0/0]ip address 172.16.0.2 18
[r2]interface g0/0/1	
[r2-GigabitEthernet0/0/1]ip address 172.16.128.2 18	
[r2]interface LoopBack 0	
[r2-LoopBack0]ip address 2.2.2.2 32


[r2]ospf 100 router-id 2.2.2.2                             //使用ospf协议宣告
[r2-ospf-100]area 0	
[r2-ospf-100-area-0.0.0.0]network 172.16.0.2 0.0.0.0
[r2-ospf-100-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r2-ospf-100]area 2	
[r2-ospf-100-area-0.0.0.2]network 172.16.128.2 0.0.0.0


[r2]ospf 100                                                //在area 0进行密文认证
[r2-ospf-100]area 0
[r2-ospf-100-area-0.0.0.0]authentication-mode simple cipher 456
[r2-ospf-100-area-0.0.0.0]authentication-mode md5

[r2]ospf 100                                                  //在area 2进行明文认证
[r2-ospf-100]area 2	
[r2-ospf-100-area-0.0.0.2]authentication-mode simple cipher 789
r3:

[r3]interface g0/0/0	                                  //配置IP地址以及环回地址
[r3-GigabitEthernet0/0/0]ip address 172.16.0.3 18
[r3]interface g0/0/1	
[r3-GigabitEthernet0/0/1]ip address 172.16.192.1 18
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 3.3.3.3 32


[r3]ospf 100 router-id 3.3.3.3                           //使用ospf协议宣告
[r3-ospf-100]area 0	
[r3-ospf-100-area-0.0.0.0]network 172.16.0.3 0.0.0.0	
[r3-ospf-100-area-0.0.0.0]network 3.3.3.3 0.0.0.0	
[r3]ospf 100 router-id 3.3.3.3
[r3-ospf-100]area 3	
[r3-ospf-100-area-0.0.0.3]network 172.16.192.1 0.0.0.0


[r3]ospf 100                                              //在area 0进行密文认证
[r3-ospf-100]area 0	
[r3-ospf-100-area-0.0.0.0]authentication-mode simple cipher 456
[r3-ospf-100-area-0.0.0.0]authentication-mode md5


[r3]ospf 100                                              //在area 3进行明文认证
[r3-ospf-100]area 3	
[r3-ospf-100-area-0.0.0.3]authentication-mode simple cipher 147
r4:

[r4]interface g0/0/0	                                     //配置IP地址以及环回地址
[r4-GigabitEthernet0/0/0]ip address 172.16.192.2 18	
[r4]interface LoopBack 0	
[r4-LoopBack0]ip address 4.4.4.4 32


[r4]ospf 100 router-id 4.4.4.4                                 //使用ospf协议宣告
[r4-ospf-100]area 3	
[r4-ospf-100-area-0.0.0.3]network 0.0.0.0 255.255.255.255


[r4]ospf 100                                                   //在area 3进行明文认证
[r4-ospf-100]area 3
[r4-ospf-100-area-0.0.0.3]authentication-mode simple cipher 147
r6:

[r6]interface g0/0/0	                                      //配置IP地址以及环回地址
[r6-GigabitEthernet0/0/0]ip address 10.1.1.2 24
[r6]interface g0/0/1	
[r6-GigabitEthernet0/0/1]ip address 172.16.64.1 18	
[r6]interface LoopBack 0	
[r6-LoopBack0]ip address 6.6.6.6 32


[r6]ospf 100 router-id 6.6.6.6                                //使用ospf协议宣告
[r6-ospf-100]area 1	
[r6-ospf-100-area-0.0.0.1]network 0.0.0.0 255.255.255.255


[r6]ospf 100                                                  //在area 1进行明文认证
[r6-ospf-100]area 1	
[r6-ospf-100-area-0.0.0.1]authentication-mode simple cipher 123
r8:
                                              
[r8]interface g0/0/0	                                 //配置IP地址以及环回地址
[r8-GigabitEthernet0/0/0]ip address 172.16.128.1 18	
[r8]interface LoopBack 0	
[r8-LoopBack0]ip address 8.8.8.8 32


[r8]ospf 100 router-id 8.8.8.8                                //使用ospf协议宣告
[r8-ospf-100]area 2	
[r8-ospf-100-area-0.0.0.2]network 0.0.0.0 255.255.255.255

 
[r8]ospf 100                                                   //在area 2进行明文认证
[r8-ospf-100]area 2	
[r8-ospf-100-area-0.0.0.2]authentication-mode simple cipher 789

3.加快收敛速度,即加快ospf协议的收敛速度,就是减少hello包的发送间隔

r1:

[r1]interface g0/0/0                           //加快收敛速度
[r1-GigabitEthernet0/0/0]ospf timer hello 5
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]ospf timer hello 5
r2:

[r1]interface g0/0/0                               //加快收敛速度
[r1-GigabitEthernet0/0/0]ospf timer hello 5
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]ospf timer hello 5
r3:

[r3]interface g0/0/0                               //加快收敛速度
[r3-GigabitEthernet0/0/0]ospf timer hello 5
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]ospf timer hello 5
r4:
 
[r4]interface g0/0/0                              //加快收敛速度
[r4-GigabitEthernet0/0/0]ospf timer hello 5
r6:
 
[r6]interface g0/0/1	                             //加快收敛速度
[r6-GigabitEthernet0/0/1]ospf timer hello 5
r8:

[r8]interface g0/0/0                                //加快收敛速度
[r8-GigabitEthernet0/0/0]ospf timer hello 5

4.router1为dr,没有bdr。在area 1,使r6的优先级改为0,表示不参与选举,直接由任何角色变成drother;在area 0,使r2、r3的优先级为0,不参与选举,直接由任何角色变成drother

r6:

[r6]interface g0/0/1	                       //将r6的优先级改为0
[r6-GigabitEthernet0/0/1]ospf dr-priority 0
r2:

[r2]interface g0/0/0	                                //将r2的优先级改为0
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
r3:

[r3]interface g0/0/0	                           //将r3的优先级改为0
[r3-GigabitEthernet0/0/0]ospf dr-priority 0

在r1查看ospf,得到如图结果:

5.pc2345自动获取ip地址,开启dhcp池自动下放ip地址,由于只有一个接口,所以要利用虚拟子接口

LSW2:

[Huawei]vlan 2                      //创建vlan
[Huawei]vlan 3

	
[Huawei]interface e0/0/2	                   //划分vlan
[Huawei-Ethernet0/0/2]port link-type access 	
[Huawei-Ethernet0/0/2]port default vlan 2	
[Huawei]interface e0/0/3	
[Huawei-Ethernet0/0/3]port link-type access 	
[Huawei-Ethernet0/0/3]port default vlan 3

查看vlan,可知划分vlan成功

r8:
   
[r8]dhcp enable                                           //打开dhcp服务
[r8]interface g0/0/1.1	                                 //开启虚拟子接口
[r8-GigabitEthernet0/0/1.1]dot1q termination vid 2
[r8-GigabitEthernet0/0/1.1]ip address 192.168.1.1 24
[r8]ip pool 1                                            //创建dhcp池 1
[r8-ip-pool-1]network 192.168.1.0 mask 255.255.255.0
[r8-ip-pool-1]gateway-list 192.168.1.1	
[r8-ip-pool-1]dns-list 8.8.8.8
[r8]interface g0/0/1.1	                                  //调用dhcp池 1
[r8-GigabitEthernet0/0/1.1]dhcp select global 	
[r8-GigabitEthernet0/0/1.1]arp broadcast enable 	
[r8]interface g0/0/1.2                                     //开启虚拟子接口
[r8-GigabitEthernet0/0/1.2]dot1q termination vid 3	
[r8-GigabitEthernet0/0/1.2]ip address 192.168.2.1 24
[r8]ip pool 2                                               //创建dhcp池 2
[r8-ip-pool-2]network 192.168.2.0 mask 255.255.255.0	
[r8-ip-pool-2]gateway-list 192.168.2.1
[r8-ip-pool-2]dns-list 8.8.8.8 
[r8]interface g0/0/1.2	                                     //调用dchp池 2                             
[r8-GigabitEthernet0/0/1.2]dhcp select global 	
[r8-GigabitEthernet0/0/1.2]arp broadcast enable 
LSW2:

[Huawei]interface e0/0/1                          //起trunk
[Huawei-Ethernet0/0/1]port link-type trunk 	
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan   //允许所有vlan通过

在pc2上和pc3上勾选dhcp,并点击应用,如图

在命令行输入ipconfig可以得到

PC2、PC3自动获取了IP地址;

LSW3:

[Huawei]vlan 4              //创建vlan
[Huawei]vlan 5

	
[Huawei]interface 0/0/2	                          //划分vlan
[Huawei-Ethernet0/0/2]port link-type access 	
[Huawei-Ethernet0/0/2]port default vlan 4	
[Huawei]interface e0/0/3	
[Huawei-Ethernet0/0/3]port link-type access 	
[Huawei-Ethernet0/0/3]port default vlan 5

查看vlan可得到,如图所示:

r4:

[r4]dhcp enable                                          //开启dhcp服务
[r4]interface g0/0/1.1                                   //打开虚拟子接口
[r4-GigabitEthernet0/0/1.1]dot1q termination vid 4	
[r4-GigabitEthernet0/0/1.1]ip address 192.168.3.1 24
[r4]ip pool 3                                            //创建dhcp池 3
[r4-ip-pool-3]network 192.168.3.0 mask 255.255.255.0	
[r4-ip-pool-3]gateway-list 192.168.3.1
[r4-ip-pool-3]dns-list 8.8.8.8
[r4]interface g0/0/1.1	                                   //调用dhcp池 3
[r4-GigabitEthernet0/0/1.1]dhcp select global 	
[r4-GigabitEthernet0/0/1.1]arp broadcast enable 
[r4]interface g0/0/1.2                                     //打开虚拟子接口
[r4-GigabitEthernet0/0/1.2]dot1q termination vid 5	
[r4-GigabitEthernet0/0/1.2]ip address 192.168.4.1 24
[r4]ip pool 4	                                           //创建dhcp池 4
[r4-ip-pool-4]network 192.168.4.0 mask 255.255.255.0
[r4-ip-pool-4]gateway-list 192.168.4.1
[r4-ip-pool-4]dns-list 8.8.8.8
[r4]interface g0/0/1.2	                                    //调用dhcp池 4
[r4-GigabitEthernet0/0/1.2]dhcp select global 	
[r4-GigabitEthernet0/0/1.2]arp broadcast enable 
LSW3:

[Huawei]interface e0/0/1                         //起trunk
[Huawei-Ethernet0/0/1]port link-type trunk 	
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all

在pc4上和pc5上勾选dhcp,并点击应用,如图

在命令行输入ipconfig可以得到

PC4、PC5自动获取了IP地址;

pc1为外网pc要求可以互相访问,上外网,应该在r6上下放nat,并且要下放缺省条目。下放后,r7的路由表中并没有各个pc以及路由器的路由条目,所以需要配置静态路由。这也才可以实现相互通信、相互访问

r6:

[r6]acl 2000	                              //下放nat
[r6-acl-basic-2000]rule permit source any
[r6]interface g0/0/0	
[r6-GigabitEthernet0/0/0]nat outbound 2000

	
[r6]ip route-static 0.0.0.0 0 10.1.1.1        //下放缺省
[r6]ospf 100	
[r6-ospf-100]default-route-advertise 
r7:

[r7]interface g0/0/0	                              //配置IP地址
[r7-GigabitEthernet0/0/0]ip address 11.1.1.1 24
[r7]interface g0/0/1	
[r7-GigabitEthernet0/0/1]ip address 10.1.1.1 24

 
[r7]ip route-static 172.16.64.0 18 10.1.1.2            //配置静态路由条目
[r7]ip route-static 172.16.0.0 18 10.1.1.2
[r7]ip route-static 172.16.128.0 18 10.1.1.2
[r7]ip route-static 192.168.1.0 24 10.1.1.2
[r7]ip route-static 192.168.2.0 24 10.1.1.2
[r7]ip route-static 192.168.3.0 24 10.1.1.2
[r7]ip route-static 192.168.4.0 24 10.1.1.2
[r7]ip route-static 172.16.192.0 18 10.1.1.2

PC1与PC2相互访问:

PC1与PC3相互访问:

PC1与PC4相互访问:

PC1与PC5相互访问:

6.router7为运营商只能配置ip地址

7.pc1远程登陆router7,实际登陆router4

r7:
 
[r7]aaa		                           //开放登陆
[r7-aaa]local-user 11 privilege level 15 password cipher 22
[r7]user-interface vty 0 4	
[r7-ui-vty0-4]authentication-mode aaa

[r7]interface g0/0/1                   //使pc1登陆r7时转接到r4
[r7-GigabitEthernet0/0/1]nat server protocol tcp global 11.1.1.3 23 inside 172.1
6.192.2 23                

8.pc4可以ping通router6但不能登陆router6

用pc4 ping r6

在靠近pc4的路由器r3用acl 3000干掉远程登陆

r3:

[r3]acl 3000
[r3-acl-adv-3000]rule deny tcp source 192.168.3.1 0.0.0.0 destination 172.16.64.1 0.0.
0.0 destination-port eq telnet 
[r3-acl-adv-3000]rule permit ip source any destination any 

[r3]interface g0/0/1	                    //调用
[r3-GigabitEthernet0/0/1]traffic-filter inbound acl 3000

9.pc3可以ping通pc5但pc5不能ping通pc3

PC3可以ping通PC5

PC5也可ping通PC3

r4:

[r4]acl 3000                               //干掉去掉的流量
[r4-acl-adv-3000]rule deny icmp source 192.168.4.1 0.0.0.0 destination 192.168.2
.1 0.0.0.0 icmp-type echo
[r4-acl-adv-3000]rule permit ip source any destination any
[r4]interface g0/0/1                       //调用
[r4-GigabitEthernet0/0/1]traffic-filter inbound 3000

利用acl3000干掉去的流量,PC5就无法ping通PC3

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值