hcia ospf acl综合练习

[r1]ospf 1 router-id 1.1.1.1	启用ospf
[r1-ospf-1]area 1	   划分区域
[r1-ospf-1-area-0.0.0.1]network 12.1.1.1  0.0.0.0   宣告网段
[r2]ospf 1 router-id 2.2.2.2	
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 12.1.1.2  0.0.0.0
[r2-ospf-1-area-0.0.0.1]network 23.1.1.1 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 23.1.1.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 123.1.1.1 0.0.0.0
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0	
[r4-ospf-1-area-0.0.0.0]network 123.1.1.2 0.0.0.0
[r4]interface LoopBack 0	
[r4-LoopBack0]ip address 4.4.4.4 32   配置环回地址
[r4-ospf-1]area  2	   划分区域
[r4-ospf-1-area-0.0.0.2]network 45.1.1.1 0.0.0.0
[r5]interface LoopBack 0	
[r5-LoopBack0]ip address 5.5.5.5 32
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 2
[r5-ospf-1-area-0.0.0.2]network 45.1.1.2 0.0.0.0
[r5-ospf-1-area-0.0.0.2]network 5.5.5.5 0.0.0.0
[r5-ospf-1-area-0.0.0.2]network 56.1.1.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 123.1.1.4 0.0.0.0
[r6]interface LoopBack 0
[r6-LoopBack0]ip address 6.6.6.6 32
[r6]ospf 1 router-id 6.6.6.6	
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]network 56.1.1.2 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 123.1.1.3 0.0.0.0
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ospf dr-priority 0 在接口修改r4的dr优先级,优先级为0,则不参加选举
[r6]interface g0/0/0	
[r6-GigabitEthernet0/0/0]ospf dr-priority 0
[r5]interface g0/0/2	
[r5-GigabitEthernet0/0/2]ospf dr-priority  0
加快收敛速度:
[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]interface g0/0/0
[r2-GigabitEthernet0/0/0]ospf timer hello 5
[r2]interface g0/0/1	
[r2-GigabitEthernet0/0/1]ospf timer hello  5
[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]interface g0/0/1
[r4-GigabitEthernet0/0/1]ospf timer hello 5
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ospf timer hello 5
[r5]interface g0/0/1
[r5-GigabitEthernet0/0/1]ospf timer hello 5
[r5]interface g0/0/2	
[r5-GigabitEthernet0/0/2]ospf timer hello 5
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ospf timer hello 5
[r6]interface g0/0/1
[r6-GigabitEthernet0/0/1]ospf timer hello 5
[r6]interface g0/0/0	
[r6-GigabitEthernet0/0/0]ospf timer hello 5
不宣告r4环回地址,实现全网可达:
[r4-ospf-1]default-route-advertise always 
 
[sw1]vlan 2	   在交换机上添加vlan
[sw1]vlan 3
[sw1]interface e0/0/2	进入接口
[sw1-Ethernet0/0/2]port link-type access  将接口模式改为接入模式
[sw1-Ethernet0/0/2]port default vlan 2    将vlan 2 划入该接口
[sw1]interface e0/0/3
[sw1-Ethernet0/0/3]port link-type access 
[sw1-Ethernet0/0/3]port default vlan 3
[sw1]interface e0/0/1	
[sw1-Ethernet0/0/1]port link-type trunk  启用trunk干道
[sw1-Ethernet0/0/1]port trunk allow-pass vlan all 允许所有vlan通过
[r1]interface g0/0/1.1   创建虚拟子接口
[r1-GigabitEthernet0/0/1.1]ip address 192.168.1.1 24  给虚拟子接口配置IP地址
[r1]interface g0/0/1.2	
[r1-GigabitEthernet0/0/1.2]ip address 192.168.2.1 24
[r1]dhcp enable   启用DHCP服务
[r1]ip pool 1     创建地址池
Info: It's successful to create an IP address pool.	
[r1-ip-pool-1]network 192.168.1.0  mask 255.255.255.0	 宣告要下放地址的网段
[r1-ip-pool-1]gateway-list 192.168.1.1	                 配置网关
[r1-ip-pool-1]dns-list 8.8.8.8 114.114.114.114	         配置dns服务
[r1]interface g0/0/1.1	    进入该接口
[r1-GigabitEthernet0/0/1.1]dhcp select global  在该接口启用全局dhcp
[r1]ip  pool 2
Info: It's successful to create an IP address pool.
[r1-ip-pool-2]network 192.168.2.0 mask 255.255.255.0	
[r1-ip-pool-2]gateway-list 192.168.2.1 	
[r1-ip-pool-2]dns-list 8.8.8.8  114.114.114.114
[r1]interface g0/0/1.2	
[r1-GigabitEthernet0/0/1.2]dhcp select global
[r1-GigabitEthernet0/0/1.1]dot1q termination vid 2  在该接口启用trunk干道的dot1q封装模式
[r1-GigabitEthernet0/0/1.2]dot1q termination vid 3
[sw2]vlan 2
[sw2]vlan 3
[sw2]interface e0/0/2
[sw2-Ethernet0/0/2]port link-type access 	
[sw2-Ethernet0/0/2]port default vlan 2
[sw2]interface e0/0/3	
[sw2-Ethernet0/0/3]port link-type access 	
[sw2-Ethernet0/0/3]port default vlan 3
[sw2]interface e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk 
[sw2-Ethernet0/0/1]port trunk allow-pass vlan all
[r2-GigabitEthernet0/0/2.1]dot1q termination vid 2
[r2-GigabitEthernet0/0/2.2]dot1q termination vid 3
area 1使用明文加密:
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ospf authentication-mode simple cipher 123
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ospf authentication-mode simple cipher 123
[r2]interface g0/0/1	
[r2-GigabitEthernet0/0/1]ospf authentication-mode simple cipher 123
[r3]interface g0/0/0	
[r3-GigabitEthernet0/0/0]ospf authentication-mode simple cipher 123
area 2使用密文加密:
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ospf authentication-mode simple cipher 123	
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 
[r5]interface g0/0/1
[r5-GigabitEthernet0/0/1]ospf authentication-mode simple cipher 123
[r5-GigabitEthernet0/0/1]ospf authentication-mode md5
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ospf authentication-mode simple cipher 123
[r5-GigabitEthernet0/0/0]ospf authentication-mode md5
[r5]interface g0/0/0	
[r5-GigabitEthernet0/0/0]ospf authentication-mode simple cipher 123
[r5-GigabitEthernet0/0/0]ospf authentication-mode md5
汇总网段,减少路由条目:在边界路由器上汇总
[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]abr-summary 192.168.0.0 255.255.252.0
[r3]ospf 1
[r3-ospf-1]area 1	
[r3-ospf-1-area-0.0.0.1]abr-summary 172.16.0.0  255.255.252.0
在子接口启用arp广播功能:
[r1]interface g0/0/1.1	
[r1-GigabitEthernet0/0/1.1]arp broadcast enable 
[r1]interface g0/0/1.2	
[r1-GigabitEthernet0/0/1.2]arp broadcast enable
[r2]interface g0/0/2.1	
[r2-GigabitEthernet0/0/2.1]arp broadcast  enable 
[r2]interface g0/0/2.2	
[r2-GigabitEthernet0/0/2.2]arp broadcast enable
宣告汇总后的网段:
[r1]ospf 1 router-id 1.1.1.1	
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]network 192.168.0.0  0.0.255.255
[r2]ospf 1 router-id 2.2.2.2	
[r2-ospf-1]area 1	
[r2-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
用acl指令完成pc1 不能 ping pc4
[r1]acl 3000  高级acl
[r1-acl-adv-3000]rule deny icmp source 192.168.1.254 0.0.0.0 destination 172.16.
1.254 0.0.0.0
[r1-GigabitEthernet0/0/0.1]traffic-filter outbound acl 3000 在虚拟子接口激活高级acl
在r4上开启远程登录功能:
[r4]user-interface vty 0 4	
[r4-ui-vty0-4]authentication-mode password 
Please configure the login password (maximum length 16):1232
用高级acl完成r1不能远程登录r4,高级acl检查源目IP地址及上层协议,所以,在r3上写高级acl
[r2]acl 3000 在靠近源的地方r2上操作
[r2-acl-adv-3000]rule  deny tcp source 12.1.1.1 0.0.0.0 destination 123.1.1.2 0.
0.0.0 destination-port eq 23
[r2-GigabitEthernet0/0/0]traffic-filter intbound acl 3000


ospf协议配置好后,测试是否全网可达 

 

完成r1为r3456中的dr,没有bdr, 查看ospf邻居表

 

 测试pc1能否ping pc4

 用acl完成pc1不能ping pc4

 

r1可以远程登录r4 

 

用acl完成r1不能telnet r4,但是能ping r4

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
HCIA OSPF协议是指华为认证的HCIA-OSPF考试中涉及的OSPF协议。OSPF(Open Shortest Path First)是一种基于链路状态路由算法的内部网关协议(IGP),用于在一个自治系统(AS)内部进行路由选择。OSPF协议使用IP协议,端口号为89,协议优先级为110。在IPv4协议中,OSPF使用的是OSPF Version 2(RFC2328),而在IPv6协议中使用的是OSPF Version 3(RFC2740)。在配置OSPF协议时,可以通过指定router-id来标识路由器的唯一标识,使用命令"ospf 1 router-id 1.1.1.1"来设置OSPF进程号为1,router-id为1.1.1.1。通过命令"area 0.0.0.0"可以将路由器加入到区域0中,通过命令"network 12.1.1.0 0.0.0.255"和"network 13.1.1.0 0.0.0.0"可以将相应的网络段的LSA信息宣告进OSPF网络中。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* *2* [HCIA~OSPF基础](https://blog.csdn.net/m0_45912044/article/details/123481259)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [[Hcia]No.11 OSPF协议(一)](https://blog.csdn.net/qq_40787900/article/details/123928643)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值