基於時間的訪問控制列表

拓撲:
 
 
要求: 創建基於時間的ACL。使得在某個時間段內 r1 和 r2 能夠正常通訊。具體實驗要求看下面。
 
首先完成基本配置:
 
r1:
 
r1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
r1(config)#inter e0/0
r1(config-if)#ip add 192.168.12.1 255.255.255.0
r1(config-if)#no shu
r1(config-if)#exit
r1(config)#ip route 0.0.0.0 0.0.0.0 e0/0 192.168.12.2
r1(config)#end
r1#
*Mar  1 01:12:12.919: %SYS-5-CONFIG_I: Configured from console by console
r1#wr
Building configuration...
[OK]
r1#
 
r2:
 
r2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
r2(config)#int e0/0
r2(config-if)#ip add 192.168.12.2 255.255.255.0
r2(config-if)#no shu
r2(config-if)#exit
r2(config)#int e0/1
r2(config-if)#ip add 192.168.23.2 255.255.255.0
r2(config-if)#no shu
r2(config-if)#exi
r2(config-if)#exit
r2(config)#end
r2#wr
Building configuration...
*Mar  1 00:12:34.483: %SYS-5-CONFIG_I: Configured from console by console[OK]
r2#
 
 
r3:
 
r3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
r3(config)#int e0/1
r3(config-if)#ip add 192.168.23.3 255.255.255.0
r3(config-if)#no shu
r3(config-if)#exit
r3(config)#ip route 0.0.0.0 0.0.0.0 e0/1 192.168.23.2
r3(config)#end
r3#wr
Building configuration...
*Mar  1 00:13:38.063: %SYS-5-CONFIG_I: Configured from console by console[OK]
r3#
 
然後測試網絡連通性:
 
r1#ping 192.168.23.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/45/84 ms
r1#
 
r1 和 r3 可以正常訪問 。
 
查看 r2 的時間:
 
r2#show clock
*00:16:31.627 UTC Fri Mar 1 2002
r2#
 
我們要求在時間段 00:00 到 00:30 之間 r1 和 r3 能夠通訊,其他時間不能通訊。
 
我們在 r2 上面做基於時間的訪問控制列表:
 
r2#conf t
r2(config)#time-range acl_time //創建名稱爲acl_time的時間段
r2(config-time-range)#absolute start 00:00 1 mar 2002 end 00:30 1 mar 2002
r2(config)#ip access-list extended 101  //創建擴展ACL
r2(config-ext-nacl)#permit ip host 192.168.12.1 host 192.168.23.3 time-range acl_time
r2(config-ext-nacl)#exit
r2(config)#interface e0/0
r2(config-if)#ip access-group 101 in 
//在接口上面引用
r2(config-if)#end
r2#
*Mar  1 00:24:15.867: %SYS-5-CONFIG_I: Configured from console by console
r2#
 
完成後在 r1 上面測試:
 
r1#ping 192.168.23.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/56/152 ms
r1#
 
在這個時間段內 r1 和 r3 能夠通訊。
 
這個時候我們在 r1 上面用擴展的 PING 測試,同時我們更改 r2 的時間,使得其不在這個時間段內:
 
r1#ping
Protocol [ip]:
Target IP address: 192.168.23.3
Repeat count [5]: 10000
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 10000, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!U.U.U.U.U.U.U.U.U.!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!
Success rate is 87 percent (134/153), round-trip min/avg/max = 8/31/104 ms
r1#
r1#
 
在上面的 PING 測試過程中我兩次更改了 r2 的時間:
 
r2#clock set 00:50:00 1 mar 2002
r2#
Mar  1 00:50:00.003: %SYS-6-CLOCKUPDATE: System clock has been updated from 00:20:34 UTC Fri Mar 1 2002 to 00:50:00 UTC Fri Mar 1 2002, configured from console by console.
r2#
r2#
r2#
r2#
r2#clock set 00:10:00 1 mar 2002
r2#
Mar  1 00:10:00.000: %SYS-6-CLOCKUPDATE: System clock has been updated from 00:50:17 UTC Fri Mar 1 2002 to 00:10:00 UTC Fri Mar 1 2002, configured from console by console.
r2#
 
可以很清晰的看得見如果 r2 的時間不再 00:00 - 00:30 時間段內的時候 r1 和 r2 不能正常通訊。
 
總結:
 
上面的誓言只是很簡單的測試,我們實際應用還可以做基於端口和時間的訪問控制列表,滿足我們日常網絡管理的需要。
 
本實驗平臺基於 DynamipsGUI 2.83 未註冊版,感謝小凡
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章