ISE dynamic trunk

ISE dynamic Trunk Port

ich glaube ich habe es endlich geschafft eine Lösung zu finden wie man Interfaces „dynamisch“ in Trunks konvertieren kann für APs oder Desk Switches. In meinem Fall beruht das ganze allerdings auf einer IBNS2.0 config mit Interface Templates, könnte man aber bestimmt auch für standard configs anpassen.

Standard port template für alle Ports

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
template PORT-AUTH-TEMPLATE-ACC1
 dot1x pae authenticator
 switchport mode access
 switchport voice vlan 142
 mab
 access-session control-direction in
 access-session closed
 access-session port-control auto
 authentication periodic
 authentication timer reauthenticate server
 service-policy type control subscriber DOT1X-DEFAULT
 description ACC:ISE-ACC1

Template für den AP

1
2
3
4
5
template PORT-AUTH-TEMPLATE-TRUNK
 switchport trunk encapsulation dot1q
 switchport trunk native vlan 1101
 switchport mode trunk
 description ACC:ISE-Trunk-ACC1

Port-Config

1
2
3
4
5
interface GigabitEthernet0/4
 switchport access vlan 1112
 switchport mode access
 dot1x timeout tx-period 7
 source template PORT-AUTH-TEMPLATE-ACC1

Problem

Würde in diesem Szenario die ISE das Template PORT-AUTH-TEMPLATE-TRUNK zuweisen würde der AP zwar online kommen aber die Clients die über den AP kommen würden durch den Switch nochmal durch die Auth rauschen. Was unschön ist und man nicht will. Um das zu umgehen, muss auf den Port access-session host-mode multi-host gesetzt werden. Leider kann man das Kommando nicht dynamisch ändern da sich der Port sonst im Kreis dreht. Auf alle Interfaces will man es aber auch nicht setzen da ich auf den übrigen Ports jede MAC authentifizieren will.

Lösung

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
macro auto global processing
shell trigger CISCO_LOCAL_AP Event
 
macro auto execute CISCO_LOCAL_AP  {
if [[ $LINKUP == YES ]]; then
  conf t
  interface $INTERFACE
  macro description $TRIGGER
  access-session host-mode multi-host
  exit
fi
if [[ $LINKUP == NO ]]; then
  conf t
  interface $INTERFACE
  no macro description $TRIGGER
  no access-session host-mode
  exit
fi
}

In den switch hacken und in der ISE die return attribute anpassen.

1
2
3
4
5
6
Access Type = ACCESS_ACCEPT
Tunnel-Private-Group-ID = 1:1101 #sollte trunk native entsprechen
Tunnel-Type = 1:13
Tunnel-Medium-Type = 1:6
cisco-av-pair = auto-smart-port=CISCO_LOCAL_AP #macro name
cisco-av-pair = interface-template-name=PORT-AUTH-TEMPLATE-TRUNK #ap trunk template

Dann sieht das am Ende des Tages auf dem Interface in der derived-config so aus wenn ein AP dran ist:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
csw01#sh derived-config int gi0/4
Building configuration...

Derived configuration : 565 bytes
!
interface GigabitEthernet0/4
 description ACC:ISE-Trunk-ACC1
 switchport access vlan 1112
 switchport trunk encapsulation dot1q
 switchport trunk native vlan 1101
 switchport mode trunk
 switchport voice vlan 142
 authentication periodic
 authentication timer reauthenticate server
 access-session host-mode multi-host
 access-session control-direction in
 access-session closed
 access-session port-control auto
 mab
 macro description CISCO_LOCAL_AP
 dot1x pae authenticator
 dot1x timeout tx-period 7
 service-policy type control subscriber DOT1X-DEFAULT

Wird der Port authentifiziert erscheint folgende Message im log:

1
%AUTOSMARTPORT-5-INSERT: Device  detected on interface GigabitEthernet0/4, executed CISCO_LOCAL_AP

Geht der Port down:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
csw01#sh derived-config int gi0/4
Building configuration...

Derived configuration : 416 bytes
!
interface GigabitEthernet0/4
 description ACC:ISE-ACC1
 switchport access vlan 1112
 switchport mode access
 switchport voice vlan 142
 authentication periodic
 authentication timer reauthenticate server
 access-session control-direction in
 access-session closed
 access-session port-control auto
 mab
 dot1x pae authenticator
 dot1x timeout tx-period 7
 service-policy type control subscriber DOT1X-DEFAULT
1
%AUTOSMARTPORT-5-REMOVE: Device removed from interface GigabitEthernet0/4, executed CISCO_LOCAL_AP to remove the configuration

Anmerkung: Das VLAN im AuthZ result der ISE ist explizit gesetzt da die MAC des AP sonst als static mac im access-vlan des Port gesetzt werden würde.