Cisco ACI Contract

1. Overview

Cisco ACI security architecture is based on allow-list where explicit definition of traffic flow need to be defined using contract. Contract is a foundation for ACI security architecture where communication between EPGs|ESGs is defined. The contract relationship is between ESGs, EPGs (regular or uSig EPGs) or within EPG|ESG for intra-EPG contract.

By default unicast communication between EPGs (Endpoint Groups) or ESGs (Endpoint Security Groups) are not allowed. Unicast traffic between end points with in EPG or ESG is allowed. BUM traffic such as Broadcast, Unknown unicast and Multicast Protocols, and protocols like ARP, DHCP, OSPF, EIGRP, PIM are always allowed.

EPG is a collection of end points with similar policy requirements residing in the same bridge domain ( a layer 2 boundary). A Bridge Domain (BD) can have one or more EPGs. EPG is equivalent to Security Zones with in BD. Each EPG is mapped to a number called “class-id” or “pcTag” in hardware.

ESG is a collection of end points with similar policy requirements residing in the same VRF ( a layer 3 boundary). A VRF can have one or more ESGs. ESG is equivalent to Security Zones with in VRF. Each ESG is mapped to a number called “class-id” or “pcTag” in hardware.

Contract is a filtering rules based on EPGs or ESGs (not on IP addresses). The action can be permit, deny or redirect to a L4L7 device.

Every EPG and ESG is mapped to class-id in hardware for policy enforcement. Policy enforcement is at ingress and flagged with policy applied at source flag if the destination end point is known. If the destination is not known at the ingress leaf, the policy enforcement is done at the egress leaf.

This image has an empty alt attribute; its file name is image-1-1024x156.png
Fig 1 – VxLAN Header

Contract in ACI is more than policy enforcement construct, it can also be used for:

  • Defining route leaking between VRFs in the same tenants
  • Defining route leaking between VRFs in different tenants
  • QOS class assignment
  • Policy based redirect to service devices/nodes
  • WAN SLA policy (For Cisco SD-WAN integration)

Contract is applied in a provider / consumer relationship. The provider provides the service and the consumer consumes the provided service. EPG 2 / ESG 2 is providing web service (port 80 and 443) and EPG 1 / ESG 1 is consuming the web service on port 80 and 443. The defined contract is applied to EPG 1 / ESG 1 as consumed and EPG 2 / ESG 2 as provided.

This image has an empty alt attribute; its file name is image-12.png
Fig 2 – Contract between EPGs



This image has an empty alt attribute; its file name is image-13.png
Fig 3 – Contract between ESGs



This image has an empty alt attribute; its file name is image-23.png
Fig 4 – Intra-EPG isolation and contract can be used to allow only required traffics within an EPG|ESG|ext-EPG
This image has an empty alt attribute; its file name is image-15.png
Fig 5 – Contract between EPG and ESG is not supported except between ESG and L3out EPGs

2. EPG/ESG classification

An endpoint can belong to one EPG. Physical, virtual, and container endpoints can coexist in the same EPG. How to define which EPG an endpoint belongs to is based on the EPG type, as described below:

2.1 Standard EPG

EPG is classified based on static binding of leaf interface and VLAN ID or VxLAN ID and/or dynamic binding of the EPG to VMM domain (VMM integration will identify the leaf, port, and encapsulation VLAN)

ACI Contract  EPG classification with VMM domain
Fig 6 – Dynamic mapping of endpoint using the VMM integration
ACI Contract  EPG Classification with physical domain
Fig 7 – Static mapping of endpoint connected to interface with a VLAN encapsulation

2.2 External EPG

External EPG is based on the longest prefix match of the IP subnet configured under the extEPG and is at VRF level, not based on an L3out the endpoint is learned from.

Example:

The subnet under L3out-1 extEPG1 is 10.0.0.0/8 and the subnet under L3out-2 extEPG2 is 10.100.0.0/16. An endpoint from L3out-1 with IP address 10.100.10.10 will be classified as member of extEPG2 not ExtEPG1 and a contract applied to extEPG2 will be applied. This will result in an unintended policy enforcement. Subnets assigned to extEPG should be as specific as possible to match the subnets behind the L3out.

There are some specific class-ids used to represent the L3out extEPG when the extEPG subnet is defined as 0.0.0.0/0. If the traffic is from source L3out to destination EPG the class id for the extEPG is set with that of the VRF . If traffic is from source EPG to destination L3out, the class id for the extEPG is set to 15.



ACI Contract EPG Classification with L3out
Fig 8 – Endpoint mapping for extEPG using longest prefix match of a subnet

2.3 MicroSeg EPG

uSeg EPG is based on IP, MAC and VM attributes or a combination of IP, MAC, and VM attributes.

This image has an empty alt attribute; its file name is Screen-Shot-2022-10-05-at-10.39.10-PM-1024x508.png
Fig 9 – Micro Seg EPG attributes

2.4 ESG

ESG is based on selectors (Tag, EPG, IP subnet and Service EPG). Policy Tags are objects that can be attached to ACI objects as a label. BD subnet, IP Address, MAC Address, and Static endpoints can use policy tag for ESG classification.

Tag Selectors at different level to classify endpoints into an ESG

ACI Contract ESG Classification
Fig 10 – Using policy tag at different objects levels, endpoints can be grouped into the same ESG
This image has an empty alt attribute; its file name is image-12-1024x304.png
Fig 11 – ESG Tag Selectors to classify endpoints

IP Subnet Selectors to classify endpoints into an ESG

Cisco ACI Contract Classification
Fig 12 – ESG IP Subnet Selectors to classify endpoints

EPG Selectors to classify endpoints into an ESG

Cisco ACI Contract Classification
Fig 13 – Endpoints under EPG before classified as an ESG
Cisco ACI Contract Classification
Fig 14 – Endpoints moved to ESG with EPG Selectors

3. Contract Structure

3.1 Standard Contract

A contract is a policy construct used to define communication between EPGs|ESGs. Contract contains one or more subject. A subject is a construct contained within a contract and references a filter. A subject contains one or more filters. A filter contains one or more filter entries. A filter entry is a rule specifying fields such as the TCP port and protocol type.

ACI Contract Structure
Fig 15 – Contract structure

The steps to create and use a contract are:

  1. Create filter
  2. Create contract
  3. Add contracts to provider and consumer EPGs|ESGs

3.1.1 Create a Filter

1. Tenant > Contracts > Filters

This image has an empty alt attribute; its file name is Screen-Shot-2022-10-02-at-11.05.36-PM-1024x517.png
Fig 16 – Filter and filter entry

Filter and filter entry – a filter is collection of filter entries. Unspecified in the filter entry means any. if filter entry is configured with the “stateful” flag, ACI programs the filters in the reverse direction to allow packets only if they have the ACK bit set. Stateful option is disabled by default. The stateful option doesn’t work with compression

3.1.2 Create a Contract

2. Tenant > Contracts > Standard

This image has an empty alt attribute; its file name is image-9.png
Fig 17 – Standard contract

The scope of a service contract between two or more EPGs is important especially when the contract is used for inter-VRF and/or inter-tenant contracts.

‘Apply Both Directions’ – sets the contract filter to apply on both ingress and egress traffic directions.

‘Reverse Filter Ports’ – enables the filter to apply on both ingress and egress traffic.

Filter chain contains filters with name, directives, action and priority. Directives can be log or policy compression. for action permit or deny are the options. Priority is only used for deny action.

A subject is a collection of filters. a subject can be associated with service graph.

3.1.3 Add Contract to Provider and Consumer EPGs|ESGs

3. Add contracts to provider and consumer EPGs|ESGs

ACI Contract - Applying Contract to EPGs

Fig 18 – Apply contract to EPG|ESG

3.2 Contract inheritance

Contract inheritance Establishes a relationship between EPGs/ESGs, so that one EPG/ESG can inherit the contract relations of other EPGs/ESGs. When new contract relations are added to the higher EPG/ESG (the master EPG/ESG), those with inheritance relation will automatically get the same contract associations. EPG/ESGs must be on the same tenant. Contract inheritance is not applied to vzAny (vzAny can’t refer to a master EPG or be a master EPG). Contract inheritance can simplify the configuration task, but it does not reduce TCAM resource consumption.

This image has an empty alt attribute; its file name is Screen-Shot-2022-10-06-at-12.16.13-AM-1024x507.png
Fig 19 – Contract inheritance

The above screenshot shows DeliAP-EPG1 using DeliAb-EPG2 as a contract master and inheriting contract relationship from the master. The EPG inheriting the contract can also have EPG specific contracts in addition to the inherited contracts.

3.3 Contract labels

Labels are a configuration option that makes it possible to select which EPGs|ESGs can consume or provide contracts with other EPGs|ESGs. By using Labels to ”group” those EPGs|ESGs can be potentially simplify contract configuration.

Label configurations can be done per EPG or per contract.

  • Per EPG configurations: EPG labels or subject labels
  • per contract configurations: Contract labels or subject labels

Below is an example of subject label on contract configuration. In this example, EPG1 and EGP2 that have same Label “Green” can talk to each other on port SSH, and EPG1 and EPG3 that have same Label “Blue” can talk to each other on http/https.

This image has an empty alt attribute; its file name is image-15.png
Fig 20 – Per contract configuration – subject label

ACI Contract  Contract labels
Fig 21 – Per contract configuration – Subject label



ACI Contract contract label
Fig 22 – Adding label to EPG

Adding label to EPG1, EGP2 and EPG3. ADD “Green” label to EPG1, for ssh communication and “Blue”, for http/https communication. Add “Blue” label to EGP2 and “Green” label EPG3.

Output of a ‘show zoning-rule scope 2359296’ – contract relationship between EPGs with in VRF with segment ID (scope) 2359296.

This image has an empty alt attribute; its file name is image-17-1024x220.png
Fig 23 – Zoning rule output
  • EPG1 (pcTag – 49158) can communicate on port 80/443 (http/https) with EGP2(pcTag – 49165) using Blue subject label.
  • EPG1 (pcTag – 49158) can communicate on port 22 (ssh) with EPG3(pcTag – 16394) using Green subject label.

4. Contract Types

Contract can be applied with different level of granularity. The order of the contract or policy enforcement from macro to micro is:

4.1. Unenforced VRF

VRF level ‘Policy Control Enforcement Preference’ selected as Unenforced: in this mode all communication within the VRF is allowed, no contract is needed.

Cisco ACI Contract

Fig 24 – VRF policy enforcement

4.2. Contract between EPGs|ESGs in different tenants

Contract between EPGs|ESGs in different tenants: an inter-tenant contract is used to policy control between EPGs|ESGs in different tenants. Inter-tenant configures both policy filtering and route leaking. The contract scope must be set correctly. Global scope is the most common and appropriate scope for inter-tenant contracts.

The configuration of inter-tenant contract depends on whether the contracts are:

  • intra-VRF or inter-VRF (discussed next)
  • between Common tenant and user tenant
  • between user tenants

Contracts are not visible across tenants by default with the exception of common tenant contracts. For a contract to be consumed or provided by EPG|ESG the contract object has to be visible by EPG|ESG.

For inter-tenant contract between common and user tenant, the configuration steps are the same as standard contract if the contract is defined in common tenant. If the contract is defined on the user tenant, the contract need to be exported. The common tenant will see the exported contract as a “contract interface”.

For inter-tenant contract between user tenants, the provider tenant need to export the contract and the consumer tenant will see it as a “contract interface” unless the contract used is defined in common tenant.

4.3. Contract between EPGs|ESGs in different VRFs

Contract between EPGs|ESGs in different VRFs: an inter-VRF contract is used for communication between EPGs|ESGs in different VRFs. Inter-VRF contract configures both policy filtering and route leaking and it needs more steps than the regular contracts.

  • Set the contract scope to either Tenant or Global
  • The scope of the subnet in the consumer BD must be set to ‘Shared between VRFs’
  • In the Provider EPG you must add a Subnet more specific than or equal to the Provider BD: The scope of the subnet must be set to ‘ Shared between VRFs’ and select ‘No Default SVI Gateway’ .

Policy Enforcement

  • EPG to EPG – at the consumer VRF
  • EPG to L3out(as a provider) – at the consumer VRF
  • EPG to L3out(as a consumer) – at the ingress leaf
  • L3out to L3out – at the ingress leaf

4.4. vzAny

vzAny represents a collection of EPGs|ESGs|extEPGs that belongs to the same VRF so a contract applied at the ‘EPG|ESG Collection for VRF’ level is applied to all EPGs|ESGs|extEPGs within the VRF.

ACI Contract - vzAny contract

Fig 25 – vzAny contract

4.5. Preferred Group

preferred group is used to allow unrestricted communication/access between a subset of EPGs|ESGs in a VRF that are member of the preferred group. Communication between members of the preferred group and non-members uses the regular contract application.

Steps to enable preferred group

1 Enable preferred group at the VRF level

This image has an empty alt attribute; its file name is Screen-Shot-2022-10-02-at-1.49.21-PM-1024x522.png

Fig 26 – Preferred group

2. Add EPG|ESG to a preferred group member by changing ‘preferred Group Member’ to include.

ACI Contract - Preferred group
Fig 27 – Communication between endpoints member of EPGs|ESGs in the preferred group is allowed.

4.6. Standard Contracts

Communication between endpoints in EPG|ESG|extEPG requires a standard contract. Communication between endpoints with in EPG|ESG|extEPG is allowed without contract.

This image has an empty alt attribute; its file name is image-3-1024x329.png

Fig 28 – Standard contract

4.7. Micro Seg EPG

uSeg EPG groups endpoints based on their attributes. uSeg-EPG is equivalent to a regular EPG in many ways but classification is based on attributes, it doesn’t have encapsulation/port dependancy. The endpoint must be first known to a regular (base) EPG through encapsulation. Communication between uSeg-EPGs or uSeg-EPGs and EPG needs contract even if both are part of the same base EPG. For bare metal servers IP and MAC are the attributes to group endpoints into uSeg EPG. For VMs with VMM domain the attributes listed below can be used.

ACI Contract - uSeg EPG attributes

Fig 29 – Micro seg EPG attributes

4.8. Intra-EPG isolation and contract

Intra-EPG contract is used to restrict communication with in EPG|ESG|extEPG|uSeg-EPG for traffics only allowed by the contract. The contract defines on which protocol and ports the hosts of a given EPG|ESG|extEPG|uSeg-EPG can communicate

This image has an empty alt attribute; its file name is image-6.png

Fig 30 – Intra-EPG contract

ACI Contract - Intra-EPG contract
Fig 31 – Intra-EPG contract

Intra-EPG isolation: Enabling intra-EPG isolation enforces that communication between endpoints in an EPG denied. This is equivalent of PVLANs (private VLANs) in a non ACI network. If layer two is extended to non ACI network like vDS in VMware PVLAN need to be configured. In case of VMM integration, ACI programs PVLAN on the port-group for the EPG. If there is an intermediate switch between the ACI leaf and a vDS, you must configure PVLAN on the intermediate switch.

If communication between EPGs|ESG|extEPG that have intra-EPG isolation enabled is needed you need to also configure Proxy-ARP.

This image has an empty alt attribute; its file name is image-7.png

Fig 32 – Intra-EPG isolation

ACI Contract Intra EPG
Fig 33 – Intra-EPG isolation and proxy-ARP enabled

5. Policy Enforcement

Zoning rules get programmed in the TCAM (Ternary Content Addressable Memory) once the contract is associated with a consumer and a provider EPG if the consumer or provider EPG present on the leaf. Zoning rules are per VRF, and each entry defines an action based on the source EPG, the destination EPG, and filter matching.

This image has an empty alt attribute; its file name is image-18.png

Fig 34 – Each EPG has a unique ID called a class ID or pcTag and each VRF has a unique ID called a VRF scope or segment ID.

ACI Contract - pcTag and Scope

Fig 35 – Class ID and Scope UI

Contract policy is applied on leaf switches, not spine switches. The following table summarize policy enforcement direction based on different criteria.

ACI Contract  Policy enforcement direction
Fig 36 – Policy enforcement direction

The VXLAN headers has a flag that indicates whether policy enforcement on the packet has been applied or not. This is done via the “policy applied bit.”

This image has an empty alt attribute; its file name is image-19.png

6. Reference

https://www.cisco.com/c/en/us/solutions/collateral/data-center-virtualization/application-centric-infrastructure/white-paper-c11-743951.html

https://deliabtech.com/data-center/aci-contract-priority/

Leave a Comment

Your email address will not be published. Required fields are marked *