组网建网实例----访问控制列表ACL+OSPF

网络拓扑图:

 

相关配置:
所有子网掩码:255.255.255.0
HostA: 10.1.1.1       GW: 10.1.1.2
HostB: 10.1.2.1       GW: 10.1.2.2
 
 
RouteA:
[RouteA]int e0
[RouteA-Ethernet0/0]ip addr 10.1.2.2 255.255.255.0
[RouteA-Ethernet0/0]undo shut
[RouteA-Ethernet0/0]int s0
[RouteA-Serial0/1]ip addr 10.1.3.1 255.255.255.0
[RouteA-Serial0/1]undo shut
[RouteA-Serial0/1]quit
[RouteA]ospf
[RouteA-ospf-1]area 0
[RouteA-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[RouteA-ospf-1-area-0.0.0.0]network 10.1.3.0 0.0.0.255
[RouteA-ospf-1-area-0.0.0.0]quit
[RouteA]acl 100
[RouteA-acl-100]rule deny source any destination any
[RouteA-acl-100]quit
[RouteA]firewall enable
[RouteA]firewall default enable
[RouteA]int e0
[RouteA-Ethernet0/0]firewall packet-filter 100 inbound
[RouteA-Ethernet0/0]quit
 
RouteB:
[RouteB]int e0
[RouteB-Ethernet0/0]ip addr 10.1.1.1 netmask 255.255.255.0
[RouteB-Ethernet0/0]undo shut
[RouteB-Ethernet0/0]int s0
[RouteB-Serial0/0]ip addr 10.1.3.1 netmask 255.255.255.0
[RouteB-Serial0/0]undo shut
[RouteB-Serial0/0]quit
[RouteB]ospf
[RouteB-ospf-1]area 0
[RouteB-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[RouteB-ospf-1-area-0.0.0.0]network 10.1.3.0 0.0.0.255
[RouteB-ospf-1-area-0.0.0.0]quit
[RouteB]acl 200
[RouteB-acl-200]rule permit source any destination any
[RouteB-acl-200]quit
[RouteB]firewall enable
[RouteB]firewall permit enable
[RouteB]int s0
[RouteB-Serial0/0]firewall packet-filter 200 outbound
[RouteB-Serial0/0]quit
[RouteB]
 
 
 
实验结果:
HostB ping HostA 不通

HostA ping HostB  

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值