Skip to content

IP Access List

Access lists provide packet filtering and traffic classification on NX-OS through ordered sequences of permit/deny rules that match on Layer 3 and Layer 4 header fields including protocol, source/destination prefixes, ports, DSCP, and TCP flags. Each ACL supports per-ACE statistics, fragment handling policies, address and port groups for object-based matching, ICMP type/code filtering, HTTP method matching, packet length operators, time-range restrictions, and VLAN/VNI-based filtering. Access lists are applied to interfaces for ingress/egress traffic filtering and referenced by other features such as route maps, QoS policies, and DHCP snooping for comprehensive traffic control and security enforcement.

Diagram
NameTypeConstraintMandatoryDefault Value
ip_access_listsList[ip_access_lists]No

ip_access_lists (nxos.devices.configuration)

Section titled “ip_access_lists (nxos.devices.configuration)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
fragmentsChoicepermit-all, deny-allNo
statistics_per_entryBooleantrue, falseNo
entriesList[entries]No

entries (nxos.devices.configuration.ip_access_lists)

Section titled “entries (nxos.devices.configuration.ip_access_lists)”
NameTypeConstraintMandatoryDefault Value
sequence_numberIntegermin: 1, max: 4294967295Yes
remarkStringNo
actionChoicepermit, denyNo
protocolAnyString or Integer or String[Regex: ^.*[\$\%]\{.*$]No
source_prefixStringNo
source_prefix_lengthStringNo
source_prefix_maskStringNo
source_address_groupStringNo
source_port_operatorChoicenone, eq, neq, lt, gt, rangeNo
source_port_1AnyString or Integer or String[Regex: ^.*[\$\%]\{.*$]No
source_port_2AnyString or Integer or String[Regex: ^.*[\$\%]\{.*$]No
source_port_groupStringNo
destination_prefixStringNo
destination_prefix_lengthStringNo
destination_prefix_maskStringNo
destination_address_groupStringNo
destination_port_operatorChoicenone, eq, neq, lt, gt, rangeNo
destination_port_1AnyString or Integer or String[Regex: ^.*[\$\%]\{.*$]No
destination_port_2AnyString or Integer or String[Regex: ^.*[\$\%]\{.*$]No
destination_port_groupStringNo
dscpIntegermin: 0, max: 63No
fragmentBooleantrue, falseNo
logBooleantrue, falseNo
establishedBooleantrue, falseNo
ackBooleantrue, falseNo
finBooleantrue, falseNo
pshBooleantrue, falseNo
rstBooleantrue, falseNo
synBooleantrue, falseNo
urgBooleantrue, falseNo
icmp_typeIntegermin: 0, max: 256No
icmp_codeIntegermin: 0, max: 256No
icmp_messageStringNo
http_methodChoiceget, put, head, post, delete, trace, connectNo
time_rangeStringNo
redirectStringNo
packet_length_operatorChoicenone, eq, neq, lt, gt, rangeNo
packet_length_1AnyString or Integer or String[Regex: ^.*[\$\%]\{.*$]No
packet_length_2AnyString or Integer or String[Regex: ^.*[\$\%]\{.*$]No
precedenceAnyString or Integer or String[Regex: ^.*[\$\%]\{.*$]No
vlanIntegermin: 0, max: 4095No
vniStringNo

Example 1: Management plane protection ACL — restrict SSH and SNMP access to trusted subnets

nxos:
devices:
- name: SPINE1
configuration:
ip_access_lists:
- name: ACL-MGMT-ACCESS
statistics_per_entry: true
entries:
- sequence_number: 10
remark: "Allow SSH from management subnet"
- sequence_number: 20
action: permit
protocol: tcp
source_prefix: 10.50.202.0
source_prefix_length: "24"
destination_prefix: any
destination_port_operator: eq
destination_port_1: 22
- sequence_number: 30
remark: "Allow SNMP from monitoring servers"
- sequence_number: 40
action: permit
protocol: udp
source_prefix: 10.50.100.0
source_prefix_length: "24"
destination_prefix: any
destination_port_operator: eq
destination_port_1: 161
- sequence_number: 50
remark: "Allow TACACS from AAA servers"
- sequence_number: 60
action: permit
protocol: tcp
source_prefix: 10.50.100.10
source_prefix_length: "32"
destination_prefix: any
destination_port_operator: eq
destination_port_1: 49
- sequence_number: 1000
action: deny
protocol: ip
source_prefix: any
destination_prefix: any
log: true

Example 2: VXLAN fabric infrastructure ACL — permit BFD, BGP, and VXLAN UDP traffic between spine and leaf

nxos:
devices:
- name: LEAF1
configuration:
ip_access_lists:
- name: ACL-FABRIC-INFRA
statistics_per_entry: true
entries:
- sequence_number: 10
remark: "Allow BGP between fabric peers"
- sequence_number: 20
action: permit
protocol: tcp
source_prefix: 10.1.10.0
source_prefix_length: "24"
destination_prefix: 10.1.10.0
destination_prefix_length: "24"
destination_port_operator: eq
destination_port_1: 179
- sequence_number: 30
remark: "Allow VXLAN encapsulated traffic"
- sequence_number: 40
action: permit
protocol: udp
source_prefix: 10.1.200.0
source_prefix_length: "24"
destination_prefix: 10.1.200.0
destination_prefix_length: "24"
destination_port_operator: eq
destination_port_1: 4789
- sequence_number: 50
remark: "Allow ICMP for troubleshooting"
- sequence_number: 60
action: permit
protocol: icmp
source_prefix: 10.1.0.0
source_prefix_length: "16"
destination_prefix: 10.1.0.0
destination_prefix_length: "16"

Example 3: Tenant traffic filtering ACL with TCP flags, DSCP marking, and logging on a border leaf

nxos:
devices:
- name: BORDER-LEAF1
configuration:
ip_access_lists:
- name: ACL-TENANT-BLUE-IN
statistics_per_entry: true
fragments: deny-all
entries:
- sequence_number: 10
remark: "Allow established TCP sessions"
- sequence_number: 20
action: permit
protocol: tcp
source_prefix: any
destination_prefix: 192.168.1.0
destination_prefix_length: "24"
established: true
- sequence_number: 30
remark: "Allow HTTPS inbound to web tier"
- sequence_number: 40
action: permit
protocol: tcp
source_prefix: any
destination_prefix: 192.168.1.0
destination_prefix_length: "24"
destination_port_operator: eq
destination_port_1: 443
dscp: 46
- sequence_number: 50
remark: "Allow DNS queries to tenant DNS"
- sequence_number: 60
action: permit
protocol: udp
source_prefix: any
destination_prefix: 192.168.1.0
destination_prefix_length: "24"
destination_port_operator: eq
destination_port_1: 53
- sequence_number: 70
remark: "Deny and log all other traffic"
- sequence_number: 80
action: deny
protocol: ip
source_prefix: any
destination_prefix: any
log: true