動態ACL配置


工作原理:

在用戶被認證之後,路由器會自動關閉telnet會話,並將一個動態訪問表項置於某個訪問表中,以允許源地址爲認證用戶工作站地址的報文通過。

代碼:


R1(config)#hostname PC  

PC(config)#no ip routing

PC(config)#ip default-gateway 192.168.1.1              

PC(config)#interface ethernet 0/0

PC(config-if)#ip address 192.168.1.2 255.255.255.0

PC(config-if)#no shutdown

PC#

R2(config)#interface ethernet 0/0

R2(config-if)#ip add 192.168.1.1 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#interface ethernet 0/0          

R2(config)#interface ethernet 0/1

R2(config-if)#ip add 192.168.2.1 255.255.255.0

R2(config-if)#no shutdown                    

R2(config-if)#^Z

R2(config)#username chy pa

R2(config)#username chy password 0 chy

R2(config)#username admin password 0 admin

R2(config)#line vty 0 4

R2(config-line)#login local

R2(config-line)#exit

R2(config)#access-list 100 permit tcp any 192.168.1.1 0.0.0.255 eq telnet (反掩碼)

R2(config)#access-list 100 dynamic chy  timeout 15 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255  

R2(config)#username chy autocommand access-enable host time 10(手動輸入)

R2(config)#interface ethernet 0/0

R2(config-if)#ip access-group 100 in

R2(config-if)#

配置好後查看ACL列表



在pc(R1)上pingR2

用chy用戶telnetR2的e0/0(192.168.1.1),運行後會秒退。

再次查看ACL列表


再次pingR2


其中admin用戶爲管理員帳號,可實際telnet管理R2。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章