Lab GNS3 Standard Access-List

bởi | CCNP, GNS3

Home » CCNP » Lab GNS3 Standard Access-List

Sơ đồ bài lab

Lab GNS3 Standard Access-List

Cấu hình gán IP theo sơ đồ

– router 1
conf t
int s 2/0
ip add 192.1.12.1 255.255.255.252
no sh
int fa 0/0
ip add 192.168.100.254 255.255.255.0
no sh
int lo 0
ip add 1.1.1.1 255.255.255.0
exit
ip route 0.0.0.0 0.0.0.0 192.1.12.2

– router 2
conf t
int s 2/0
ip add 192.1.12.2 255.255.255.252
no sh
int lo 0
ip add 2.2.2.2 255.255.255.0
exit
ip route 192.168.100.0 255.255.255.0 192.1.12.1
ip route 1.1.1.0 255.255.255.0 192.1.12.1

Cú pháp để cấu hình standard access-list

– Tạo một standard access-list

R (config)#access-list ACL_number {permit | deny} source_IP wildcard_mask

+ Với ACL_number là số hiệu của ACL từ 1-99 hoặc 1300-1999

– Áp một access-list trên một cổng

R (config-if)#ip access-group ACL_number {in | out}

– permit all hoặc deny all:

R (config)#access-list ACL_number {permit | deny} all

– permit all hoặc deny một host:

R (config)#access-list ACL_number {permit | deny} host 1_source_IP

Cấu hình standard access-list tại Router 1

– Standard Access-list chỉ kiểm tra “IP Nguồn”
– Các yêu cầu standard access-list
+ Cho phép IP 192.168.100.8 –> 192.168.100.48
+ Cho phép IP 192.168.100.128 –> 192.168.100.130
+ Các IP khác thuộc network 192.168.100.0/24 thì cấm và ghi log
+ CẤM IP 1.1.1.1

R1(config)#access-list 1 permit 192.168.100.8 0.0.0.7
R1(config)#access-list 1 permit 192.168.100.16 0.0.0.15
R1(config)#access-list 1 permit 192.168.100.32 0.0.0.15
R1(config)#access-list 1 permit host 192.168.100.48
R1(config)#access-list 1 permit 192.168.100.128 0.0.0.1
R1(config)#access-list 1 permit host 192.168.100.130
R1(config)#access-list 1 deny 192.168.100.0 0.0.0.255 log
R1(config)#access-list 1 deny host 1.1.1.1

– Apply standard access-list tại interface serial 2/0 theo chiều OUT

R1(config)#int s 2/0
R1(config-if)#ip access-group 1 out
R1(config-if)#exit

– Kiểm tra access-list

R1#show access-lists 1
Standard IP access list 1
80 deny 1.1.1.1
40 permit 192.168.100.48
60 permit 192.168.100.130
10 permit 192.168.100.8, wildcard bits 0.0.0.7 (4 matches)
20 permit 192.168.100.16, wildcard bits 0.0.0.15
30 permit 192.168.100.32, wildcard bits 0.0.0.15
50 permit 192.168.100.128, wildcard bits 0.0.0.1
70 deny 192.168.100.0, wildcard bits 0.0.0.255 log (4 matches)

+ Show log

R1#show logging
*Sep 17 04:09:44.747: %SEC-6-IPACCESSLOGNP: list 1 denied 0 192.168.100.50 -> 2.2.2.2, 1 packet
R1#clear ip access-list counters 1

=> reset có packet match về số 0 cho ACL số 1

+ Các IP đấu nối, IP lookback trên R1 cho dù có tạo các dòng deny trong access-list cũng không bị cấm