<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Autosmart port and IOS Shell scripting in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4795279#M580525</link>
    <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a requirement to trigger a script on a switch using Cisco ISE upon successful authorization of an endpoint. For this, i used the Cisco Autosmart port feature and the script looks like below. The requirement was that by default all the switchports on the switch will be configured for VLAN 106 (access) and VLAN 107 (voice). But depending upon the type of endpoint being connected, there would be a change in the switchport configuration. This requirement perfectly works when we have a single switch but in a dual stack switch environment we would have VLAN 108 and VLAN 109 on the secondary switch. Just wondering if there is a way in IOS shell scripting i can leverage to add an additional condition to the same script check the interface number before applying the configuration. For example: Switch1 in a stack will have Gi1/0/x while the Switch 2 in a stack will have Gi2/0/x..&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insights will be highly appreciated.&lt;/P&gt;&lt;P&gt;macro auto execute ISE_AP_CONFIG {&lt;BR /&gt;if [[ $LINKUP == YES ]]; then&lt;BR /&gt;conf t&lt;BR /&gt;default interface $INTERFACE&lt;BR /&gt;interface $INTERFACE&lt;BR /&gt;macro description $TRIGGER&lt;BR /&gt;description Wireless&lt;BR /&gt;switchport trunk native vlan 112&lt;BR /&gt;switchport mode trunk&lt;BR /&gt;device-tracking attach-policy IPDT_POLICY&lt;BR /&gt;ip access-group ACL-DEFAULT in&lt;BR /&gt;authentication event fail action next-method&lt;BR /&gt;authentication event server dead action authorize vlan 112&lt;BR /&gt;authentication host-mode multi-host&lt;BR /&gt;authentication open&lt;BR /&gt;authentication order mab dot1x&lt;BR /&gt;authentication priority dot1x mab&lt;BR /&gt;authentication port-control auto&lt;BR /&gt;authentication periodic&lt;BR /&gt;authentication timer reauthenticate 28800&lt;BR /&gt;authentication timer inactivity 180&lt;BR /&gt;authentication violation replace&lt;BR /&gt;mab&lt;BR /&gt;no snmp trap link-status&lt;BR /&gt;dot1x pae authenticator&lt;BR /&gt;dot1x timeout tx-period 10&lt;BR /&gt;storm-control broadcast level 10.00&lt;BR /&gt;storm-control multicast level 10.00&lt;BR /&gt;spanning-tree bpduguard enable&lt;BR /&gt;exit&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;&lt;P&gt;if [[ $LINKUP == NO ]]; then&lt;/P&gt;&lt;P&gt;conf t&lt;BR /&gt;default interface $INTERFACE&lt;BR /&gt;interface $INTERFACE&lt;BR /&gt;no macro description&lt;BR /&gt;description User_Segment_1&lt;BR /&gt;switchport access vlan 106&lt;BR /&gt;switchport mode access&lt;BR /&gt;switchport voice vlan 107&lt;BR /&gt;device-tracking attach-policy IPDT_POLICY&lt;BR /&gt;ip access-group ACL-DEFAULT in&lt;BR /&gt;load-interval 30&lt;BR /&gt;authentication event fail action next-method&lt;BR /&gt;authentication event server dead action authorize vlan 206&lt;BR /&gt;authentication event server dead action authorize voice&lt;BR /&gt;authentication event server alive action reinitialize&lt;BR /&gt;authentication host-mode multi-domain&lt;BR /&gt;authentication open&lt;BR /&gt;authentication order mab dot1x&lt;BR /&gt;authentication priority dot1x mab&lt;BR /&gt;authentication port-control auto&lt;BR /&gt;authentication periodic&lt;BR /&gt;authentication timer reauthenticate 28800&lt;BR /&gt;authentication timer inactivity 180&lt;BR /&gt;authentication violation replace&lt;BR /&gt;mab&lt;BR /&gt;no snmp trap link-status&lt;BR /&gt;dot1x pae authenticator&lt;BR /&gt;dot1x timeout tx-period 10&lt;BR /&gt;storm-control broadcast level 1.00&lt;BR /&gt;no mdix auto&lt;BR /&gt;spanning-tree portfast&lt;BR /&gt;spanning-tree bpduguard enable&lt;BR /&gt;end&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 07:15:20 GMT</pubDate>
    <dc:creator>Vivek Ganapathi</dc:creator>
    <dc:date>2023-03-16T07:15:20Z</dc:date>
    <item>
      <title>Autosmart port and IOS Shell scripting</title>
      <link>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4795279#M580525</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a requirement to trigger a script on a switch using Cisco ISE upon successful authorization of an endpoint. For this, i used the Cisco Autosmart port feature and the script looks like below. The requirement was that by default all the switchports on the switch will be configured for VLAN 106 (access) and VLAN 107 (voice). But depending upon the type of endpoint being connected, there would be a change in the switchport configuration. This requirement perfectly works when we have a single switch but in a dual stack switch environment we would have VLAN 108 and VLAN 109 on the secondary switch. Just wondering if there is a way in IOS shell scripting i can leverage to add an additional condition to the same script check the interface number before applying the configuration. For example: Switch1 in a stack will have Gi1/0/x while the Switch 2 in a stack will have Gi2/0/x..&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insights will be highly appreciated.&lt;/P&gt;&lt;P&gt;macro auto execute ISE_AP_CONFIG {&lt;BR /&gt;if [[ $LINKUP == YES ]]; then&lt;BR /&gt;conf t&lt;BR /&gt;default interface $INTERFACE&lt;BR /&gt;interface $INTERFACE&lt;BR /&gt;macro description $TRIGGER&lt;BR /&gt;description Wireless&lt;BR /&gt;switchport trunk native vlan 112&lt;BR /&gt;switchport mode trunk&lt;BR /&gt;device-tracking attach-policy IPDT_POLICY&lt;BR /&gt;ip access-group ACL-DEFAULT in&lt;BR /&gt;authentication event fail action next-method&lt;BR /&gt;authentication event server dead action authorize vlan 112&lt;BR /&gt;authentication host-mode multi-host&lt;BR /&gt;authentication open&lt;BR /&gt;authentication order mab dot1x&lt;BR /&gt;authentication priority dot1x mab&lt;BR /&gt;authentication port-control auto&lt;BR /&gt;authentication periodic&lt;BR /&gt;authentication timer reauthenticate 28800&lt;BR /&gt;authentication timer inactivity 180&lt;BR /&gt;authentication violation replace&lt;BR /&gt;mab&lt;BR /&gt;no snmp trap link-status&lt;BR /&gt;dot1x pae authenticator&lt;BR /&gt;dot1x timeout tx-period 10&lt;BR /&gt;storm-control broadcast level 10.00&lt;BR /&gt;storm-control multicast level 10.00&lt;BR /&gt;spanning-tree bpduguard enable&lt;BR /&gt;exit&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;&lt;P&gt;if [[ $LINKUP == NO ]]; then&lt;/P&gt;&lt;P&gt;conf t&lt;BR /&gt;default interface $INTERFACE&lt;BR /&gt;interface $INTERFACE&lt;BR /&gt;no macro description&lt;BR /&gt;description User_Segment_1&lt;BR /&gt;switchport access vlan 106&lt;BR /&gt;switchport mode access&lt;BR /&gt;switchport voice vlan 107&lt;BR /&gt;device-tracking attach-policy IPDT_POLICY&lt;BR /&gt;ip access-group ACL-DEFAULT in&lt;BR /&gt;load-interval 30&lt;BR /&gt;authentication event fail action next-method&lt;BR /&gt;authentication event server dead action authorize vlan 206&lt;BR /&gt;authentication event server dead action authorize voice&lt;BR /&gt;authentication event server alive action reinitialize&lt;BR /&gt;authentication host-mode multi-domain&lt;BR /&gt;authentication open&lt;BR /&gt;authentication order mab dot1x&lt;BR /&gt;authentication priority dot1x mab&lt;BR /&gt;authentication port-control auto&lt;BR /&gt;authentication periodic&lt;BR /&gt;authentication timer reauthenticate 28800&lt;BR /&gt;authentication timer inactivity 180&lt;BR /&gt;authentication violation replace&lt;BR /&gt;mab&lt;BR /&gt;no snmp trap link-status&lt;BR /&gt;dot1x pae authenticator&lt;BR /&gt;dot1x timeout tx-period 10&lt;BR /&gt;storm-control broadcast level 1.00&lt;BR /&gt;no mdix auto&lt;BR /&gt;spanning-tree portfast&lt;BR /&gt;spanning-tree bpduguard enable&lt;BR /&gt;end&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 07:15:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4795279#M580525</guid>
      <dc:creator>Vivek Ganapathi</dc:creator>
      <dc:date>2023-03-16T07:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Autosmart port and IOS Shell scripting</title>
      <link>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4796064#M580561</link>
      <description>&lt;P&gt;How does your script get the value for&amp;nbsp;$INTERFACE ?&lt;/P&gt;
&lt;P&gt;I have not done EEM in a while, but I thought you could write a trigger that would trigger on parsing the local syslog events using regular expressions.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 22:14:30 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4796064#M580561</guid>
      <dc:creator>Arne Bier</dc:creator>
      <dc:date>2023-03-16T22:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Autosmart port and IOS Shell scripting</title>
      <link>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4796145#M580562</link>
      <description>&lt;P&gt;Thank you for your reply. I believe $INTERFACE, $LINKUP, $TRIGGER are all a system defined variables. I just took them from the Built-in Macros and modified according to my need. I didn't find any documentations listing the system defined variables. So not very sure how the value is feed into $INTERFACE.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 03:23:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4796145#M580562</guid>
      <dc:creator>Vivek Ganapathi</dc:creator>
      <dc:date>2023-03-17T03:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Autosmart port and IOS Shell scripting</title>
      <link>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4798265#M580646</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;If my understanding is correct, ISE actually triggers the switch to apply the locally defined macro.&lt;/P&gt;
&lt;P&gt;If that's the case, you can simply use in ISE two authorization rules, something like if request is for x y z (your existing conditions) AND nas-port-id starts with GigabitEthernet1/0/ apply this authorization profile (macro1), if request is for x y z AND nas-port-id starts with GigabitEthernet2/0/ apply this authorization profile (macro2).&lt;/P&gt;
&lt;P&gt;Each macro would have its own VLAN so everybody's happy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;BR,&lt;/P&gt;
&lt;P&gt;Octavian&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 07:01:19 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4798265#M580646</guid>
      <dc:creator>Octavian Szolga</dc:creator>
      <dc:date>2023-03-21T07:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Autosmart port and IOS Shell scripting</title>
      <link>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4798645#M580652</link>
      <description>&lt;P&gt;Hi Octavian,&lt;/P&gt;&lt;P&gt;This is the perfect solution! For some reason i couldn't think about this! I have tested this and working perfectly.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vivek&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 15:43:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4798645#M580652</guid>
      <dc:creator>Vivek Ganapathi</dc:creator>
      <dc:date>2023-03-21T15:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Autosmart port and IOS Shell scripting</title>
      <link>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4798648#M580653</link>
      <description>&lt;P&gt;Thank you very much Octavian!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 15:45:12 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4798648#M580653</guid>
      <dc:creator>Vivek Ganapathi</dc:creator>
      <dc:date>2023-03-21T15:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Autosmart port and IOS Shell scripting</title>
      <link>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4798824#M580657</link>
      <description>&lt;P&gt;Glad to be of help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, &lt;/P&gt;
&lt;P&gt;Octavian&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 20:36:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/autosmart-port-and-ios-shell-scripting/m-p/4798824#M580657</guid>
      <dc:creator>Octavian Szolga</dc:creator>
      <dc:date>2023-03-21T20:36:47Z</dc:date>
    </item>
  </channel>
</rss>

