Hands-on tutorial

Tutorials · Switching

How to Write Access Control Lists (ACLs) on a Layer 3 Switch

Control traffic between VLANs directly on the core switch: plan the rules, write standard and extended ACLs, apply them in the right direction, and test without locking yourself out.

Intermediate10 min7 steps

Before you start

  • A Layer 3 switch routing between VLANs
  • A list of which VLANs may talk to which, and on which ports
  • Console or out-of-band access in case of mistakes

Step by step

  1. Write the policy in plain language

    For example: guests may reach only the internet; cameras may reach only the NVR; staff may reach servers on web and file ports.

  2. Know the ACL types

    Standard ACLs match source addresses only. Extended ACLs match source, destination, protocol and port, which is what inter-VLAN policy needs.

  3. Write the rules from specific to general

    ACLs are processed top-down and end with an implicit deny. Add explicit permits, then a final deny with logging.

    ip access-list extended CAMERAS-IN
     permit tcp 10.0.40.0 0.0.0.255 host 10.0.50.10 eq 554
     permit udp 10.0.40.0 0.0.0.255 host 10.0.0.1 eq 123
     deny ip any any log
    
  4. Apply on the right interface and direction

    Apply inbound on the VLAN interface where the traffic enters the switch.

    interface vlan 40
     ip access-group CAMERAS-IN in
    
  5. Allow return traffic and essentials

    Remember DHCP, DNS and NTP. Switch ACLs are usually stateless, so replies must be permitted too.

  6. Protect yourself

    Before applying, schedule an automatic reload or rollback, or work from the console, in case you block your own management access.

  7. Test and monitor

    Test each allowed and blocked flow from a real device, and check the hit counters.

    show access-lists CAMERAS-IN
    

Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.

Pro tips

  • Name ACLs by purpose and add remarks to each line.
  • Use a firewall for complex or stateful policies.
  • Keep ACLs in version control with the rest of the configuration.