该问题为华为的学习资料
1.首先把所有的PC机全部设置为DHCP
2.配置地址
3.ospf
4.dhcp
5.acl
AR1
dhcp en
interface GigabitEthernet0/0/0ip address 192.168.1.254 255.255.255.0 dhcp select global
interface GigabitEthernet0/0/1ip address 10.1.12.1 255.255.255.0 dhcp select global
ospf 1 router-id 1.1.1.1 area 0.0.0.1 network 10.1.12.1 0.0.0.0 network 192.168.1.254 0.0.0.0
ip pool SW1gateway-list 192.168.1.254 network 192.168.1.0 mask 255.255.255.0 excluded-ip-address 192.168.1.3 192.168.1.253 /设置不在DHCP分配范围之类的地址AR2
dhcp en
interface GigabitEthernet0/0/0ip address 192.168.2.254 255.255.255.0 dhcp select global
interface GigabitEthernet0/0/1ip address 10.1.12.2 255.255.255.0 dhcp select global
ospf 1 router-id 2.2.2.2area 0.0.0.1 network 10.1.12.2 0.0.0.0 network 192.168.2.254 0.0.0.0
ip pool SW2gateway-list 192.168.2.254 network 192.168.2.0 mask 255.255.255.0 LSW2
time-range testworkday 0:00 to 23:59 working-day /工作日
time-range testworksat 0:00 to 23:59 6 /周六整天
time-range testworksunam 0:00 to 8:59 0 /周日早晨
time-range testworksunpm 18:01 to 23:59 0 /周日晚上
acl number 3001rule 5 deny ip source 192.168.1.1 0 destination 192.168.2.252 0 time-range text
workdayrule 10 deny ip source 192.168.1.1 0 destination 192.168.2.252 0 time-range tex
tsatrule 15 deny ip source 192.168.1.1 0 destination 192.168.2.252 0 time-range tex
tsunamrule 20 deny ip source 192.168.1.1 0 destination 192.168.2.252 0 time-range tex
tsunpm
int g 0/0/2traffic-filter outbound acl 3001 /注意outbound是针对出,inbound是针对入
结果:
PC1无法ping通PC3,其他PC之间均是可以通信的
因个人能力有限,笔者发现,在使用acl时,不知在permit时间范围以外,pc1给pc3的报文是否是默认拒绝通过,还有待验证,
如有问题,可以使用更好的时间范围,或者多个时间范围的联合, 注意192.168.2.252是DHCP自动获取的地址
如有错误,还请指正