802.1x VLAN User Distribution (VLAN Group)

In this blog post, I will be going over 802.1x VLAN User Distribution (sometimes referred to as “VLAN Groups”) in Cisco IOS and a use case scenario that involves Cisco ISE (Identity Services Engine).

First, some background around VLAN Groups. Based on my research it seems there are two major types of VLAN Groups: The Firewall Service Module (FWSM) on the 6500 and on Cisco IOS & IOS XE Switches. It appears to possibly have other functionality within the Wireless Space for user assignment, but I did not do extensive research on that aspect to find an inclusive answer. In the world of IOS a VLAN group is simply a group that has a name assigned to it that can contain one or more VLANs assigned to that group.

The main purpose of 802.1x VLAN User Distribution is to dynamically provide VLAN load balancing by having the RADIUS server dictate the VLAN Group name within attribute 81 (Tunnel-Private-Group-ID) in the RADIUS response instead of a regular VLAN ID/Name. When the switch receives the VLAN Group name, it will assign the endpoint to the least populated configured VLAN for that group. Prior to IOS release 12.2(33)SXI1, this was accomplished by having multiple VLAN names specified under attribute 81.

A use case I have found outside of VLAN distribution load balancing (and the reason I know about VLAN Groups) is to provide a way to dynamically assign a preconfigured VLAN that does not have a uniform number across the enterprise from ISE. This case in particular was to have a predefined VLAN, that would span multiple different VLAN numbers, specific for Cisco IP Phones not tied to a Cisco CM dynamically assigned once the appropriate device profile in ISE was determined. This allows for the ability to have a different option 80 fields in the DHCP response to direct the phones to their non-Cisco based Call Manager.

To take advantage of this configuration, the VLAN group assigned with your desired VLAN(s) must be configured on the switch and the authorization profile that will be applied from ISE must be configured with RADIUS attribute 81 set to the VLAN group name.

To configure a VLAN group in IOS perform the following task:
SW1(config)# vlan group group-name vlan-list vlan-list

To note:

  • A VLAN Group name can be up to 32 characters
  • A VLAN Group name must start with a letter
  • Group members can be specified as a single VLAN ID, a list of VLAN IDs, or a VLAN ID range. Multiple entries are separated by a hyphen (-) or a comma (,) similar to the interface range command.
  • To remove a VLAN from the VLAN group, use the no version (no vlan group group-name vlan-list vlan-ID).
  • The VLAN Group will be removed once the last VLAN ID is removed from the group.

Configuring a VLAN Group on a Cisco Switch:rh3cn9l
vlan group TEST_VG vlan-list 410

Configuring VLAN Group assignment in ISE:
image002
Navigate to Policy Elements > Results > Authorization > Authorization Profiles > Profile
Select VLAN and Enter VLAN Group Name

Once a endpoint is authenticated against the switch via 802.1X and the appropriate authorization profile is assigned, the VLAN configured on the switch for the VLAN group is assigned:Verfication

Some bonus verification information:

When a VLAN is statically assigned via 802.1X, the VLAN assignment can be seen across multiple switchport / VLAN status commands.

The first command is show vlan.

Before dynamic VLAN assignment (port configuration):verification1

After dynamic VLAN assignment (via 802.1X with VLAN Group):verification2

The second command is show interface interface-name switchport:

Before dynamic VLAN assignment (port configuration):verification3

After dynamic VLAN assignment (via 802.1X with VLAN Group):verification4

Cisco ISE REST API & Python

I’ve been faced with a fun little challenge on how to make sure our ISE deployment has every NAD (Network Access Device) configured appropriately to allow for successful EAP communications. Originally I was planning on utilizing a CSV and the bulk import tool to regularly import new devices into ISE as they were built. This allows for a number (small or large) of devices to be imported into ISE without taking too much time. This has worked well in the past but creates an reliance on making sure the CSV is proper and that someone (me) still has to manually login and import the file. With that I decided to look into other possibilities to remove the “me” from the process flow. At first I was looking into ways to automatically populate the CSV and then script out away to login to ISE and force the bulk import. While that option would work, it seemed to be too complicated to really deploy and rely on. I finally decided to give another whack at using the REST API ( I had previously tried years prior with ACS but did not have much luck).

There are a two things that need to be done on ISE prior to being able to utilize the REST API. The below screens and settings are based on ISE 2.2 but are similar between all recent releases of ISE:

  1. Create an account that will be utilized for the REST calls.  To do this navigate to: Administration > Admin Access > Administrators > Admin Users and click on “Add”:ialbmj4
    Currently there are two different access types you can assign: Read/Write or ReadOnly. For the code about to be run, we need Read/Write.
  2. Enable ERS (External RESTful Services) to allow REST calls. To do this navigate to: Administration > System > Settings > ERS Settings then select “Enable ERS for Read/Write” under the Primary Administration Node:fsdtf17
    This setting must be enabled after each upgrade as its set to disabled during the upgrade. If you plan to utilize the REST API, I recommend adding to your upgrade documentation / process that the REST API is enabled at the end of the upgrade.

After a user account is created and ERS is enabled the REST API can be utilized via HTTPS on port 9060. API documentation can be found at: https://ISE-PAN-IP:9060/ers/sdk

Now that the API is exposed its now for some fun! But first some cautions / warnings..

  1. This is by no means a tutorial about REST API or Python.
  2. You really should have a good understanding about REST API before enabling it. I’m still skeptical about the security around access when it comes to REST.
  3. You should never use a production system to develop code that makes changes to it.
  4. Use the code shown at your own risk!

And a few notes about the code…

  1. The below code is not complete, and needs tweaking to be functional. Its intention is simply to show a proof of concept for automating device creation.
  2. The code calls ‘nad.xml’ which is a separate XML file (can be found on my github repository). I will not be going over the file in this tutorial, but can be manipulated for actual use.
  3. The final output is not pretty and may not be complete depending on the number of devices being imported.
  4. The code below is a picture due to me not knowing how to easily paste code that looks nice on wordpress. A copy of the code can by found on my github repository.
  5. The IP address or FQDN of your ISE PAN needs to be updated prior to running the code.
  6. A proper authorization key needs to be added prior to running the code. This will be from the account you created earlier.
  7. It would be a good idea to create a variable for the ISE PAN information to use for multiple URLs.
  8. It would be a good idea to create a variable for the authorization information to use for multiple calls.

Now its really time for the fun part!

The below code is intended to do two things: Bulk create network devices in ISE and to verify the status of the bulk job:

kdtfnke

Code Breakdown:

  • Lines 2 – 8 are simply to deal with importing the XML file. You could just include it in the script and assign it to the payload variable (referenced in line 18) but that doesn’t make this usable in a production environment.
  • Line 11 is the URL used for the first API call. Don’t forget to update with your ISE PAN information.
  • Line 15 is where you should update your authorization information.
  • Line 18 has an extra variable in the request which is “verify” set to “False”. This lets you ignore certificate warnings. In my lab I didn’t bother deploying trusted certs so I needed this.
  • Line 18 is the actual API call being pushed. If you do not care about the status you could simply end here or just print the response.
  • Line 21 grabs just the location header from the response from the API call. The location header is a URL containing the BULK ID that is parsed from the entire URL to use for the second portion of the script.
  • Line 28 is the URL used for the second API call + the BULK ID. Don’t forget to update with your ISE PAN information.
  • Line 32 is where you should update your authorization information.
  • Line 36 has an extra variable in the request which is “verify” set to “False”. This lets you ignore certificate warnings. In my lab I didn’t bother deploying trusted certs so I needed this.

Lets see the code in action!

First we will look to see whats configured in ISE for network devices:9aczrfjNow lets run the script:hghklfn

As can be seen the XML containing 10 network devices was still in progress when the status check was run. If this was production code there are multiple options to avoid this such as a timer could be implemented, the user could be asked when to run the check, or constant checking until it completes.

Now lets see what we have in ISE:qghpxe9Ten brand new devices!

The API in Cisco ISE has many different functions that can allow for the creation, modification, or deletion of several different objects outside of network devices. This is just one example of the power that is available for automating functions within ISE that have been around for a while.

 

Hiding (filtering) a specific user from reporting in Cisco ISE

I ran into an interesting problem preparing for an 802.1x deployment – the authentications report in Cisco ISE was full of all the network devices checking to make sure ISE was still available (health checks). As seen below the load balancer’s keep alive fill the logs pretty much on their own, imagine trying to troubleshoot a login issue!1 YUCK!

Something else I found interesting that my Google Foo (or knowledge of ACS and how to filter out a certain user) was no match for trying to find a solution for my issue. Because of this, I decided a quick how-to on this would be helpful (I can’t be the only person who will want to filter out such an annoying problem).

First Navigate to Administration > System > Logging:2

Once in the System Settings for Logging, navigate to “Collection Filters”:3

At this point, the rest is pretty straight forward. But for completeness I am going to finish the whole process, so click “Add”:4

After that just fill in the type of attribute you want to filter (Username, Policy Set Name, NAS IP Address, Device IP Address, or MAC Address), the Value for the selected attribute, and the Filter Type (Filter All, Filter Passed, FIlter Failed, or Bypass Suppression [with time limit]). Finally, click “Submit”!

5

For me, it made the most sense to filter the username used for the monitors, and to only filter on passes for that username. This allows me to use the least amount of filters, and if a health monitor fails for any reason will show up in the reporting still.

Final result (don’t mind the old logs, I was too impatient to wait for them to clear):

6

Happy troubleshooting!