Cisco show vlan access list

Cấu hình Vlan Access List [VACL] trên Switch Cisco Layer 3

Thảo luận trong 'Switching' bắt đầu bởi baonguyen, 11/1/18.

Tags:
  • cấu hình vacl
  • configuration vacl cisco
  1. baonguyen New Member

    VLAN ACL [VACL] trên thiết bị chuyển mạch Switch Cisco Layer 3 là một dịch vụ cho phép tạo và quản lý danh sách truy cấp dựa vào địa chỉ MAC, IP. Bạn có thể cấu hình VACLs để kiểm tra các gói tin lưu thông trong nội bộ một VLAN.

    VACLs thì không quản lí truy cấp theo hướng [in, out]. VACLs dùng Access Map để chứa danh sách tuần tự một hoặc nhiều mẫu tin [entry] về việc quản lí truy cập. Mỗi mẫu tin trong bản đồ truy cập mô tả việc kiểm tra gói tin dựa vào IP hoặc MAC để áp cho một hành động nào đó đối với những gói tin. Các mẫu tin đều được đánh số thứ tự nên ta có thể cấu hình ưu tiên cho các mẫu tin phù hợp với một yêu cầu nào đó. Khi các gói tin đi qua thiết bị sẽ được kiểm tra thông qua VACL dựa vào bản đồ truy cấp đã được cấu hình mà thiết bị sẽ quyết định có chuyển tiếp gói tin đi hay không.

    Những mẫu tin trong VLAN Access Map cung cấp các hành động tương ứng với:
    + Forward: Hành động này sẽ cho phép gói tin được chuyển qua Switch
    + Redirect: Gói tin sẽ được chuyển hướng sang 1 hoặc nhiều giao diện được chỉ định
    + Drop: Với một gói tin vi phạm thì hành động này cho phép hủy gói tin ngay lập tức và chúng ta có thể lưu trạng thái [logs] về việc hủy các gói tin này.

    Ta xét ví dụ sau:
    Port FastEthernet trên R1 và R2 là cùng VLAN 10. Ta sẽ cấu hình VACLs để cấm R1 telnet đến R2.

    - Trước tiên ta kiểm tra telnet từ R1-> R2.

    R1#telnet 10.10.10.2
    Trying 10.10.10.2 ... Open
    User Access Verification
    Password:
    R2>quit
    [Connection to 10.10.10.2 closed by foreign host]
    R1#

    --> Kết quả telnet thành công.

    - Cấu hình Vlan ACL
    Bây giờ chúng ta tạo 1 ACL cho phép R1 telnet đến R2, sau đó sử dụng VACL để Drop gói tin telnet này.

    + Tạo ACL
    SW2[config]#ip access-list extended ACL_R1TELNETR2
    SW2[config-ext-nacl]#permit tcp host 10.10.10.1 host 10.10.10.2 eq telnet


    + Cấu hình VACL
    SW2[config-ext-nacl]#vlan access-map VACL_STOPTELNET
    SW2[config-access-map]#match ip address ACL_R1TELNETR2
    SW2[config-access-map]#action drop
    SW2[config-access-map]#vlan access-map VACL_STOPTELNET
    SW2[config-access-map]#action forward
    SW2[config-access-map]#exit


    ACL được match cho khả năng Telnet được thực hiện là DROP , sau đó match tất cả các traffic và cho phép forward tất cả.
    + Áp dụng lên Vlan
    SW2[config]#vlan filter VACL_STOPTELNET vlan-list 10

    - Xem lại các cấu hình bằng các lệnh sau:
    SW2#show running-config aclmrg --> hiển thị ACL được cấu hình
    SW2#show vlan filter --> Hiển thị thông tin VACLs áp dụng cho vlan
    SW2#show vlan access-map --> hiển thị các entry trong access-map

    - Cuối cùng ta kiểm tra kết nối từ R1->R2
    + Telnet
    R1#telnet 10.10.10.2
    Trying 10.10.10.2 ...
    % Connection timed out; remote host not responding

    --> Telnet đã bị chặn

    + Ping
    R1#ping 10.10.10.2
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
    !!!!!
    -->
    Ping vẫn bình thường

    Chúc các bạn thành công.
    baonguyen, 11/1/18
    #1
  2. baonguyen New Member

    Lọc lưu lượng [Telnet] bằng VACL trên Switch Cisco Layer3

    ACL sử dụng các IP và cổng nguồn / hoặc đích để khớp trực tiếp các gói sẽ được lọc.

    VACL thì khác, VACL được sử dụng trong các mạng chuyển mạch nơi bạn muốn lọc lưu lượng trong VLAN. VACL tương tự về mặt logic với bản đồ tuyến đường [route maps] nhưng thay vì nhập “route-map”, chúng chứa các mục nhập “access-map”.

    Mỗi mục nhập "access-map" chứa một câu lệnh đối sánh [sử dụng ACL thông thường] và chuyển tiếp hoặc bỏ [drop] các hành động tương ứng.

    Bạn có thể có các câu lệnh đối sánh khác nhau cho mọi chuỗi bản đồ truy cập [access-map] và chúng sẽ được xử lý theo thứ tự được nhập.

    Cũng giống như một bản đồ tuyến đường [route map] bình thường, có một tuyên bố ngầm định từ chối tất cả ở cuối, vì vậy hãy đảm bảo tạo một mục nhập bản đồ truy cập [access-map] cuối cùng cho phép tất cả các phương tiện giao thông khác.


    Như được hiển thị trên sơ đồ, chúng ta có hai máy [hosts] trong cùng một VLAN 100 [và cùng một mạng con Layer3 192.168.1.0/24] được kết nối trên cùng một Switch Layer3. Chúng ta muốn hạn chế quyền truy cập telnet từ Host1 đến Host2.

    Trước tiên, hãy xác minh kết nối giữa hai máy [hosts] khi chưa áp dụng VACL:

    H1#ping 192.168.1.2
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
    !!!!!
    Success rate is 100 percent [5/5], round-trip min/avg/max = 1/2/4 ms

    H1#telnet 192.168.1.2
    Trying 192.168.1.2… Open
    User Access Verification
    Username:
    --> Telnet thành công

    Cấu hình VACL trên Switch Layer3 để chặn telnet từ Host1 sang Host2

    1. Configure an ACL to match telnet traffic from Host1 to Host2.
    SW-L3-TGM[config]#ip access-list extended Block_Telnet
    SW-L3-TGM[config-ext-nacl]#permit tcp host 192.168.1.1 host 192.168.1.2 eq 23
    SW-L3-TGM[config-ext-nacl]#exit

    2. Configure the Vlan Access Map a VACL
    SW-L3-TGM[config]#vlan access-map VACL_ Block_Telnet 10

    VLAN ACL [VACL]

    Prerequisite – Virtual LAN [VLAN], Access-lists [ACL]
    VLAN [Virtual LAN] is a concept in which we divide the broadcast domain into smaller broadcast domains logically at layer 2. If we create different VLANs then by default, a host from one VLAN can communicate with all the hosts residing in the same VLAN. If we want some hosts not able to reach other hosts within the same VLAN, then the concept of VLAN Access-list or Private VLAN can be used. [Access-list, is a set of various permit or deny conditions, used for packet filtering]

    VLAN ACL [VACL] –
    VLAN ACL is used to filter traffic of a VLAN [traffic within a VLAN i.e traffic for destination host residing in the same VLAN]. All packets entering the VLAN are checked against the VACL. Unlike Router ACL, VACL is not defined in a direction but it is possible to filter traffic based on the direction of the traffic by combining VACLs and Private VLAN features.

    Procedure –

    1. Define the standard or extended access list to be used in VACL –
      An access list should be defined to identify the type of traffic and the hosts on which it is applied.
    2. Define a VLAN access map –
      A VLAN access-map is defined in which hosts IP address will be matched [using the access-list defined]
    3. Configure an action clause in a VLAN access map sequence –
      This will tell what action [forward or drop] should be taken on the traffic [defined in the VLAN access map]
    4. Apply the VLAN access map to the specified VLANs –
      The last step in the configuration of VACL is to create a filter list specifying, on which VLAN the access map has been applied.
    5. Display VLAN access map information –
      We can verify the information by using the command.

    Configuration –



    There is a switch named switch2 which is connected to 3 routers named Router1 [IP address-192.168.1.1/24], Router2 [IP address-192.168.1.2/24], and Router3 [IP address-192.168.1.3/24] as shown in the figure.
    Configuring IP address on Router1.

    Router1[config]#int fa0/0 Router1[config-if]#ip address 192.168.1.1 255.255.255.0 Router1[config-if]#no shut

    Configuring IP address on Router2.

    Router2[config]#int fa0/0 Router2[config-if]#ip address 192.168.1.2 255.255.255.0 Router2[config-if]#no shut

    Configuring IP address on Router3.

    Router3[config]#int fa0/0 Router3[config-if]#ip address 192.168.1.3 255.255.255.0 Router3[config-if]#no shut

    In this task, we will deny traffic from Router1 to Router3 using VACL.

    Configuring access-list on switch2 stating that all IP traffic should be allowed from host 192.168.1.1 to 192.168.1.3

    switch2[config]#ip access-list extended My_access_list switch2[config-ext-nacl]#permit ip host 192.168.1.1 host 192.168.1.3

    Now, configuring VLAN access-map which states that match the IP address defined in access-list and take action of drop [which means traffic should not be allowed from 192.168.1.1 to 192.168.1.3].

    switch2[config]#vlan access-map Mapping 10 switch2[config-access-map]#match ip address My_access_list switch2[config-access-map]#action drop switch2[config-access-map]#exit

    In the first command, 10 is the sequence number of the access map. If we do not define any sequence number then it will automatically take 10 as a sequence number.
    Now, for the traffic from Router1 [192.168.1.1] to Router3 [192.168.1.3], the traffic will be dropped but what about the traffic from Router2 to Router3?

    The traffic from Router2 to Router3 will also get drop because no action is defined for this traffic [implicit deny]. Therefore, we have to define another rule stating that the other traffic should be allowed.

    switch2[config]#vlan access-map Mapping 20 switch2[config-access-map]#action forward switch2[config-access-map]#exit

    In the first command, 20 is the sequence number which means this rule will be checked after the first rule having sequence number 10.

    At last, we will assign this access-map, named My_access_list, to a VLAN [here VLAN 1]

    switch2[config]#vlan filter Mapping vlan-list 1

    To verify the configuration, use the command.

    switch2#show vlan access-map

    This command will display the access map. This will display the name of the access-map, sequence number of the rule, and the access-list name [that has been used].

    switch2#show vlan filter

    This will display the VLANs which are filtered by the VLAN access map.

    Article Tags :
    Computer Networks
    Practice Tags :
    Computer Networks
    Read Full Article

    Video liên quan

    Chủ Đề