LAB – Cấu hình Dynamic Access-List
Mô tả
Cấu hình Dynamic ACL, đảm bảo rằng PC2 phải được xác thực trước khi được phép truy cập tài nguyên trên PC1.
Cấu hình
Tạo thông tin người dùng:
GATEWAY(config)#username vnpro password 123
Cấu hình Dynamic ACL theo người dùng:
GATEWAY(config)#username vnpro autocommand access-enable
Kết hợp ACL với Dynamic ACL:
GATEWAY(config)#access-list 100 permit tcp any host 192.168.2.1 eq 23
Cấu hình Dynamic ACL:
GATEWAY(config)#access-list 100 dynamic DYNACL permit ip any host 192.168.1.2
GATEWAY(config)#access-list 100 deny ip any any
Lưu ý: Chỉ có một Dynamic ACL được tạo.
Cấu hình login trên VTY:
GATEWAY(config)#line vty 0 4
GATEWAY(config-line)#login local
Gán ACL vào cổng
GATEWAY(config)#interface fa0/1
GATEWAY(config-if)#ip access-group 100 in
Cấu hình đầy đủ
GATEWAY#sh run
Building configuration...
Current configuration : 1113 bytes
!
hostname GATEWAY
!
username vnpro password 0 123
username vnpro autocommand access-enable
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.2.1 255.255.255.0
ip access-group 100 in
duplex auto
speed auto
!
access-list 100 permit tcp any host 192.168.2.1 eq telnet
access-list 100 dynamic DYNACL permit ip any host 192.168.1.2
access-list 100 deny ip any any
!
line con 0
exec-timeout 0 0
line aux 0
line vty 0 4
login local
!
scheduler allocate 20000 1000
!
end
GATEWAY#
Kiểm tra
Khi chưa thực hiện xác thực ACL sẽ không được active, việc truy cập sẽ không thành công.
Hình 2.52.
GATEWAY#sh access-lists
Extended IP access list 100
10 permit tcp any host 192.168.2.1 eq telnet
20 Dynamic DYNACL permit ip any host 192.168.1.2
30 deny ip any any (12 matches)
Thực hiện bước xác thực, thông qua việc thực hiện lệnhtelnet vào GATEWAY (192.168.2.1).
Hình 2.53.
ACL được tạo ra.
Hình 2.54.
GATEWAY#sh access-lists
Extended IP access list 100
10 permit tcp any host 192.168.2.1 eq telnet (63 matches)
20 Dynamic DYNACL permit ip any host 192.168.1.2
permit ip any host 192.168.1.2 (4 matches)
30 deny ip any any (12 matches)
Tuy nhiên trong trường hợp này địa chỉ nguồn là any, nên có thể dẫn đến những lỗ hổng bảo mật.
GATEWAY(config)#username vnpro autocommand access-enable host
Với dòng lệnh này địa chỉ của thiết bị được xác thực sẽ được cho phép.
GATEWAY#sh access-lists
Extended IP access list 100
10 permit tcp any host 192.168.2.1 eq telnet (279 matches)
20 Dynamic DYNACL permit ip any host 192.168.1.2
permit ip host 192.168.2.2 host 192.168.1.2
30 deny ip any any (12 matches)
Mặc định sau khi ACL được tạo ra, ACL sẽ tồn tại trong 120 phút, để thay đổi thời gian timeout là 5 phút nếu không xảy ra bất kỳ hoạt động nào từ PC2 đến PC1, dùng lệnh:
GATEWAY(config)#username vnpro autocommand access-enable host timeout 5
Mô tả
Cấu hình Dynamic ACL, đảm bảo rằng PC2 phải được xác thực trước khi được phép truy cập tài nguyên trên PC1.
Cấu hình
Tạo thông tin người dùng:
GATEWAY(config)#username vnpro password 123
Cấu hình Dynamic ACL theo người dùng:
GATEWAY(config)#username vnpro autocommand access-enable
Kết hợp ACL với Dynamic ACL:
GATEWAY(config)#access-list 100 permit tcp any host 192.168.2.1 eq 23
Cấu hình Dynamic ACL:
GATEWAY(config)#access-list 100 dynamic DYNACL permit ip any host 192.168.1.2
GATEWAY(config)#access-list 100 deny ip any any
Lưu ý: Chỉ có một Dynamic ACL được tạo.
Cấu hình login trên VTY:
GATEWAY(config)#line vty 0 4
GATEWAY(config-line)#login local
Gán ACL vào cổng
GATEWAY(config)#interface fa0/1
GATEWAY(config-if)#ip access-group 100 in
Cấu hình đầy đủ
GATEWAY#sh run
Building configuration...
Current configuration : 1113 bytes
!
hostname GATEWAY
!
username vnpro password 0 123
username vnpro autocommand access-enable
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.2.1 255.255.255.0
ip access-group 100 in
duplex auto
speed auto
!
access-list 100 permit tcp any host 192.168.2.1 eq telnet
access-list 100 dynamic DYNACL permit ip any host 192.168.1.2
access-list 100 deny ip any any
!
line con 0
exec-timeout 0 0
line aux 0
line vty 0 4
login local
!
scheduler allocate 20000 1000
!
end
GATEWAY#
Kiểm tra
Khi chưa thực hiện xác thực ACL sẽ không được active, việc truy cập sẽ không thành công.
Hình 2.52.
GATEWAY#sh access-lists
Extended IP access list 100
10 permit tcp any host 192.168.2.1 eq telnet
20 Dynamic DYNACL permit ip any host 192.168.1.2
30 deny ip any any (12 matches)
Thực hiện bước xác thực, thông qua việc thực hiện lệnhtelnet vào GATEWAY (192.168.2.1).
Hình 2.53.
ACL được tạo ra.
Hình 2.54.
GATEWAY#sh access-lists
Extended IP access list 100
10 permit tcp any host 192.168.2.1 eq telnet (63 matches)
20 Dynamic DYNACL permit ip any host 192.168.1.2
permit ip any host 192.168.1.2 (4 matches)
30 deny ip any any (12 matches)
Tuy nhiên trong trường hợp này địa chỉ nguồn là any, nên có thể dẫn đến những lỗ hổng bảo mật.
GATEWAY(config)#username vnpro autocommand access-enable host
Với dòng lệnh này địa chỉ của thiết bị được xác thực sẽ được cho phép.
GATEWAY#sh access-lists
Extended IP access list 100
10 permit tcp any host 192.168.2.1 eq telnet (279 matches)
20 Dynamic DYNACL permit ip any host 192.168.1.2
permit ip host 192.168.2.2 host 192.168.1.2
30 deny ip any any (12 matches)
Mặc định sau khi ACL được tạo ra, ACL sẽ tồn tại trong 120 phút, để thay đổi thời gian timeout là 5 phút nếu không xảy ra bất kỳ hoạt động nào từ PC2 đến PC1, dùng lệnh:
GATEWAY(config)#username vnpro autocommand access-enable host timeout 5