cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1514
Views
5
Helpful
6
Replies

Endpoint Security Group - IP address

noamcoh
Level 1
Level 1

Hello,
I'm trying to understand what is exactly an ESG (Endpoint Security Group).
Is there a connection between ESG and EPG? is ESG are similar to EPG in any way?
Does an ESG contains IP addresses?
For example an EPG can contain Static Endpoints that have IP addresses, is there something similar regarding ESG as well?

Thank you for your help.

1 Accepted Solution

Accepted Solutions

Robert Burns
Cisco Employee
Cisco Employee

Sure you can do pretty much anything in ACI via the API - as long as you know what you want to find, there's a way to query it.  For your question specifically, we can query a few things.  

1. Show all the policy tags

apic1# moquery -c tagTag
Total Objects shown: 2

# tag.Tag
key : esg
childAction :
dn : uni/tn-Rob/BD-vlan10_bd/subnet-[192.168.10.254/24]/tagKey-esg
lcOwn : local
modTs : 2022-03-30T09:13:08.385-04:00
rn : tagKey-esg
status :
uid : 15374
userdom : :all:
value : prod_subnets

# tag.Tag
key : esg
childAction :
dn : uni/tn-Rob/BD-vlan20_bd/subnet-[192.168.20.254/24]/tagKey-esg
lcOwn : local
modTs : 2022-03-30T09:13:47.641-04:00
rn : tagKey-esg
status :
uid : 15374
userdom : :all:
value : dev_subnets

apic1#

 

2. Show only specific policy tags Ex. those tagged as 'prod_subnets' and filter the output to relevant fields

apic1# moquery -c tagTag -f "tag.Tag.value==\"prod_subnets\"" | egrep 'key|dn|value'
key : esg
dn : uni/tn-Rob/BD-vlan10_bd/subnet-[192.168.10.254/24]/tagKey-esg
value : prod_subnets
apic1#

 

3. Show all matched IP endpoints in esgs with a name that contains 'prod' and filter the output to relevant fields
apic1# moquery -c fvIp -x 'query-target-filter=wcard(fvIp.esgUsegDn,"prod")' | egrep 'addr|esgUsegDn|vrf'
addr : 192.168.10.15
esgUsegDn : uni/tn-Rob/ap-app1/esg-esg_prod
vrfDn : uni/tn-Rob/ctx-vrf1
apic1#

 

You can just as easily translate that to an API request also, I'm just showing output using moquery. Generating a similar API URL is as easy as using API Inspector and navigating to the ESG Client Endpoint screen

Robert

 

View solution in original post

6 Replies 6

Robert Burns
Cisco Employee
Cisco Employee

Endpoint Security Groups provide a flexible mechanism to group endpoints.  It's similar in concept to an EPG.  Where an EPG is constrained to including endpoints from a single Bridge Domain, the ESG can include endpoints from anywhere within a VRF.   ESGs are a great way to improve your security posture when starting with a network-centric type of deployment design, and want to move more towards an more secure application policy model.

ESGs use selectors to define which endpoints belong to them.  These can be based on:

1) Subnet (endpoints within the VRF are moved to the ESG based on an IP prefix match)

2) Explicit EPG Name (any endpoint assigned to a particular EPG is matched into the ESG
3) Tags (ACI objects can use REGEX patterns to match specific objects & values)

 

Just like EPGs, contracts are applied between ESGs to allow the endpoints within it to communicate.  

esg.png

 

One functional consideration of ESGs is that contracts must be applied between ESGs.  You can't apply a contract between an ESG & EPG.  The only exception is an L3Out EPG.  A contract may be applied between ESG & L3Out EPGs.

 

This example shows what a configuration using EPG contracts would look like in comparison to using ESGs instead.

esg2.png

 

Robert

Thank you very much for the clear explanation.
Do you have an example that can demonstrate selectors in general and tag selector specifically?

As of the latest version, policy tags are supported on the following ACI objects:

•fvEpMacTag (Endpoint MAC)

•fvEpIpTag (Endpoint IP)

•fvStCEp (silent-host)

•fvSubnet (BD Subnet)

•__vmm:vmname (VM Name)

 

A tag key-value pair is assigned to the above objects, then ESGs can leverage these policy tags as a matching mechanism.  You might look at the Tag options and think  - "fvSubnet tag?, can't we already use an IP Subnet Selector for ESG classification?  Yes, you can however this introduces another level of abstraction.  With an ESG IP Subnet selector you explicitly define subnet prefixes used to match endpoints into an ESG.  With an Subnet tag - you are instead using a key and value combination assigned to subnets independently in order to create a match.    

For example, let's imagine I had a bunch of subnets, some were production, and some where development.  If I happen to know exactly which subnets were used for Production, sure I could just use an ESG selector and add those subnets.  In the other case, perhaps I have thousands of small subnets, and I can't recall offhand which were Prod and which were used for Dev.  With the fvSubnet policy tag, when I created the subnet, I could easily add a key "esg" and value "prod" to that object.  Now when I go to create my ESGs, I can rely on these tags to filter the subnets of interest.  

First I'll assign the policy tag key of "esg" (my choice, but can be anything) the Subnet, and the value of "prod_subnets" - which I will assign to any prod subnet object.

tag1.png

 

Next I will create an ESG called "prod_esg" with a Tag Selector using the same key and value pair.  Notice you can use expressions like Contains, Equals and even Regex to give you max flexibility.

tag2.png

Lastly, I'll check the ESG operational tab to see if the endpoint I expect has been matched - which it has.  Notice it also shows me the Base EPG in which the VM endpoint happens to be assigned to.

tag3.png

By now hopefully you're thinking - "Hey this sure looks alot of uSeg/Attributed based EPGs!?!"  - and you'd be correct.  The goal with ESGs is to provide a more flexible endpoint grouping method that isn't constrained by BD boundaries.  

As with many things in ACI, there's many ways to accomplish your goal-  the key is finding the feature/tool that does this in the easiest, and most simple way.  

Regards,

Robert

As I understand it's a very powerful tool that can help me gather together a group of object under some key-value pair, and then add to the ESG all the object that under this pair.
Is it possible somehow to obtain all the IP addresses that have a certain policy tag? I mean some REST API command that will return all the IP addresses under a certain policy tag.
(I assume that if I use a tag selector it somehow translate it to the IP addresses group)

Robert Burns
Cisco Employee
Cisco Employee

Sure you can do pretty much anything in ACI via the API - as long as you know what you want to find, there's a way to query it.  For your question specifically, we can query a few things.  

1. Show all the policy tags

apic1# moquery -c tagTag
Total Objects shown: 2

# tag.Tag
key : esg
childAction :
dn : uni/tn-Rob/BD-vlan10_bd/subnet-[192.168.10.254/24]/tagKey-esg
lcOwn : local
modTs : 2022-03-30T09:13:08.385-04:00
rn : tagKey-esg
status :
uid : 15374
userdom : :all:
value : prod_subnets

# tag.Tag
key : esg
childAction :
dn : uni/tn-Rob/BD-vlan20_bd/subnet-[192.168.20.254/24]/tagKey-esg
lcOwn : local
modTs : 2022-03-30T09:13:47.641-04:00
rn : tagKey-esg
status :
uid : 15374
userdom : :all:
value : dev_subnets

apic1#

 

2. Show only specific policy tags Ex. those tagged as 'prod_subnets' and filter the output to relevant fields

apic1# moquery -c tagTag -f "tag.Tag.value==\"prod_subnets\"" | egrep 'key|dn|value'
key : esg
dn : uni/tn-Rob/BD-vlan10_bd/subnet-[192.168.10.254/24]/tagKey-esg
value : prod_subnets
apic1#

 

3. Show all matched IP endpoints in esgs with a name that contains 'prod' and filter the output to relevant fields
apic1# moquery -c fvIp -x 'query-target-filter=wcard(fvIp.esgUsegDn,"prod")' | egrep 'addr|esgUsegDn|vrf'
addr : 192.168.10.15
esgUsegDn : uni/tn-Rob/ap-app1/esg-esg_prod
vrfDn : uni/tn-Rob/ctx-vrf1
apic1#

 

You can just as easily translate that to an API request also, I'm just showing output using moquery. Generating a similar API URL is as easy as using API Inspector and navigating to the ESG Client Endpoint screen

Robert

 

Is it possible to make a query that returns all the IP addresses that connect to a certain policy tag?
for example I have this environment:
 - ESG with a name of "NoamESG" with a tag selector to the following policy tag: "NoamTag" : "NoamValue"
 - Subnet 1.1.1.1/24 with the following policy tag: "NoamTag" : "NoamValue"
 - Subnet 2.2.2.1/24 with the following policy tag: "NoamTag" : "NoamValue"

As I understand, the ESG "NoamESG" should hold now 1.1.1.1/24 and also 2.2.2.1/24
can I make a query that returns those two subnets?

Review Cisco Networking for a $25 gift card

Save 25% on Day-2 Operations Add-On License