Cisco IOS 802.1x Authenticationの設定

スポンサーリンク

802.1xは認証プロトコルのひとつで、接続されたホストが認証されるかどうかをRADIUSなどの認証サーバに問い合わせます。なお、CCIE試験ではサーバは存在しないため、スイッチ機器の設定のみが試験範囲となります。

概要

dot1x authenticationについてまとめます。実践では認証サーバやクライアント端末なども含めた設定が必要になりますが、検証資材が手に入らなかったため本シナリオではスイッチ機器のみの動作確認になっています。

コマンド一覧

このシナリオで重要なコマンド一覧は以下の通りです。

Switch(config)# aaa new-model
Switch(config)# aaa authentication dot1x default radius
Switch(config)# dot1x system-auth-control

Switch(config)# radius-server host <addr>
Switch(config)# radius-server dead-criteria time <sec> tries <num>
Switch(config)# radius-server deadtime <sec>

Switch(config)# errdisable detect cause security-violation shutdown vlan
Switch(config)# errdisable recovery cause security-violation
Switch(config)# errdisable recovery interval 300

Switch(config)# dot1x critical eapol

Switch(config)# interface <interface>
Switch(config-if)# switchport mode access
Switch(config-if)# authentication port-control auto
Switch(config-if)# authentication port-control { auto | force-authorized | force-un authorized }
Switch(config-if)# dot1x violation-mode {shutdown | restrict | protect}
Switch(config-if)# dot1x guest-vlan <id>
Switch(config-if)# dot1x auth-fail vlan <id>
Switch(config-if)# dot1x critical
Switch(config-if)# dot1x critical recovery action reinitialize
Switch(config-if)# dot1x critical vlan <id>

構成図

下記構成で動作確認を行います。

 +--------+
 |   SW1  | 
 +--------+
 [SW1]
hostname SW1

設定全文は下記ファイルです。詳細設定は下記を参照ください。

SW1
!
version 12.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname SW1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
system mtu routing 1500
ip subnet-zero
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
 no ip address
!
ip classless
ip http server
ip http secure-server
!
!
!
!
control-plane
!
!
line con 0
line vty 5 15
!
end

仕様説明

802.1x Authentication

802.1x Authenticationを使用するには、以下のようなコマンドを用いて802.1x Authenticatoinを有効にする必要があります。なお、dot1xの認証メソッドはヘルプストリングで様々な選択肢が表示されますが、実際にサポートされるのは”default radius”のみです。

Switch(config)# aaa new-model
Switch(config)# aaa authentication dot1x default radius
Switch(config)# dot1x system-auth-control

Switch(config)# radius-server host <addr>

“authentication port-control auto”コマンドで、802.1x Authenticationを有効にするポートを指定します。なお、access portのみ802.1xを有効にできる事に注意して下さい。言い換えれば、デフォルト設定のdynamic auto, dynamic desirableでは802.1xを有効化できない事に注意して下さい。

Switch(config)# interface <interface>
Switch(config-if)# switchport mode access
Switch(config-if)# authentication port-control auto

“authentication port-control”コマンドの正確な意味は以下の通りです。autoとは802.1xに基づく認証を行うという意味になります。

value desctiption
authorized portを常にauthorizedの状態としてます。
言い換えれば、全てのパケットを許可する状態とします。
unauthorized portを常にunauthorizedの状態とします。
言い換えれば、全てのパケットを拒否する状態とします。
auto 802.1x 認証に基づく認証結果で、authorizedとするかunauthorizedとするかを決定します。
Switch(config-if)# authentication port-control { auto | force-authorized | force-un authorized }

802.1x Host Mode

以下のコマンドでHost Modeを指定する事ができます。デフォルト設定はsingle-hostです。

value desctiption
single-host 各ポートで認証できるホストは1つまでです。
1つのホストを認証すると他のホストは接続不能となります。
multi-host 各ポートで複数のホストを認証できます。

violation mode

認証エラー時の挙動は以下3通りから選ぶ事ができます。それぞれキーワードの意味はport securityと同じです。

Switch(config)# interface <interface>
Switch(config-if)# dot1x violation-mode {shutdown | restrict | protect}

violation-modeとしてshutdownを指定した場合、デフォルトの状態ではセキュリティ違反が発生すると、err-disable状態になります。しかし、以下のコマンドを入力するとerror-disableではなくshutdown状態になります。

Switch(config)# errdisable detect cause security-violation shutdown vlan

“errdiable recovery”コマンドを使用すると、一定時間後に自動的にerror-disableから復旧します。

Switch(config)# errdisable recovery cause security-violation
Switch(config)# errdisable recovery interval 300

guest vlan / fail vlan

以下のコマンドでguest vlan, auth-fail vlanを定義する事ができます。guest vlanは802.1x authenticationをサポートしないクライアントに割り当てられるvlanです。auth-fail vlanはパスワード間違え等の認証エラーの際に割り当てられるvlanです。

Switch(config)# interface <interface>
Switch(config-if)# dot1x guest-vlan <id>
Switch(config-if)# dot1x auth-fail vlan <id>

Authentication Bypass

デフォルトの状態では、Radiusサーバが疎通不能になってしまうと全クライアントの通信が止まってしまいます。しかし、Bypass機能を使用すれば、Radius疎通不能時の挙動を定義する事ができます。

必須設定ではありませんが、どのような条件で”Radiusサーバがdownした”と判断するのかを決めるのは非常に重要です。dead-criteriaコマンドで、Raduisサーバへのtimeoutとretry回数を定義する事ができます。また、Radiusサーバがdownしている状態で常にtimeoutを待ち続けるのは非常に待ち時間が長くなってしまうので、Radiusがdownしていると判断した場合は、一定時間Radiusサーバへ問い合わせを行わないようにする事ができます。その一定時間の設定は、deadtimeコマンドを用いて設定する事ができます。

Switch(config)# radius-server dead-criteria time <sec> tries <num>
Switch(config)# radius-server deadtime <sec>

以下のコマンドで、Radius疎通不能時にクライアント端末にEAPOL-Success messageを返し、疎通可能になるようにします。

Switch(config)# dot1x critical eapol

以下のコマンドでRADIUSサーバが復旧してから、再びRADIUSによる認証を行うまでの時間を定義する事ができます。

Switch(config)# dot1x critical recovery delay <msec>

以下のコマンドでinterfaceに対してBypass機能を有効にする事ができます。さらに、”dot1x critical vlan”を定義するとRADUISサーバがダウンした時のvlanを定義する事ができます。dot1x critical recovery actionはRADUISサーバが復旧した時の挙動です。

Switch(config)# interface <interface>
Switch(config-if)# dot1x critical
Switch(config-if)# dot1x critical recovery action reinitialize
Switch(config-if)# dot1x critical vlan <id>

802.1x Authentication

設定投入

以下のコマンドを投入し、f0/1に対してdot1x authenticationを有効にします。

 [SW1]
aaa new-model
aaa authentication dot1x default group radius
dot1x system-auth-control
!
radius-server host 192.168.1.1 key cisco
!
interface FastEthernet0/1
 switchport mode access
 dot1x port-control auto

動作確認

下記showコマンドにより設定を確認します。

 [SW1]
SW1#show dot1x interface FastEthernet 0/1
Dot1x Info for FastEthernet0/1
-----------------------------------
PAE                       = AUTHENTICATOR
PortControl               = AUTO
ControlDirection          = Both
HostMode                  = SINGLE_HOST
Violation Mode            = PROTECT
ReAuthentication          = Disabled
QuietPeriod               = 60
ServerTimeout             = 0
SuppTimeout               = 30
ReAuthPeriod              = 3600 (Locally configured)
ReAuthMax                 = 2
MaxReq                    = 2
TxPeriod                  = 30
RateLimitPeriod           = 0

802.1x Host Mode

設定投入

以下のコマンドを投入し、f0/1に対して複数ホストが接続可能になるようにします。

 [SW1]
interface FastEthernet0/1
 dot1x host-mode multi-host

動作確認

下記showコマンドにより設定を確認します。

 [SW1]
SW1#show dot1x interface FastEthernet 0/1
Dot1x Info for FastEthernet0/1
-----------------------------------
PAE                       = AUTHENTICATOR
PortControl               = AUTO
ControlDirection          = Both
HostMode                  = MULTI_HOST
Violation Mode            = PROTECT
ReAuthentication          = Disabled

 <omitted>

violation mode

設定投入

セキュリティ違反が発生した場合、error-disableになるようにします。また、error-disableは3分後に自動復旧するようにします。

 [SW1]
errdisable recovery cause security-violation
errdisable recovery interval 180
!
interface FastEthernet0/1
 dot1x violation-mode shutdown

動作確認

下記showコマンドにより設定を確認します。

 [SW1]
SW1#show dot1x interface FastEthernet 0/1
Dot1x Info for FastEthernet0/1
-----------------------------------
PAE                       = AUTHENTICATOR
PortControl               = AUTO
ControlDirection          = Both
HostMode                  = MULTI_HOST
Violation Mode            = SHUTDOWN
ReAuthentication          = Disabled
QuietPeriod               = 60
ServerTimeout             = 0
SuppTimeout               = 30
ReAuthPeriod              = 3600 (Locally configured)
ReAuthMax                 = 2
MaxReq                    = 2
TxPeriod                  = 30
RateLimitPeriod           = 0

SW1#

SW1#show errdisable recovery
ErrDisable Reason            Timer Status
-----------------            --------------
arp-inspection               Disabled
bpduguard                    Disabled
channel-misconfig            Disabled
dhcp-rate-limit              Disabled
dtp-flap                     Disabled
gbic-invalid                 Disabled
inline-power                 Disabled
l2ptguard                    Disabled
link-flap                    Disabled
mac-limit                    Disabled
loopback                     Disabled
pagp-flap                    Disabled
port-mode-failure            Disabled
psecure-violation            Disabled
security-violation           Enabled
sfp-config-mismatch          Disabled
small-frame                  Disabled
storm-control                Disabled
udld                         Disabled
vmps                         Disabled

Timer interval: 180 seconds

Interfaces that will be enabled at the next timeout:

SW1#

Re-Authenticate

設定投入

以下のコマンドを投入し、2時間毎に802.1x認証を行うようにします。

 [SW1]
interface FastEthernet0/1
 dot1x timeout reauth-period 7200
 dot1x reauthentication

動作確認

下記showコマンドにより設定を確認します。

 [SW1]
SW1#show dot1x interface FastEthernet 0/1
Dot1x Info for FastEthernet0/1
-----------------------------------
PAE                       = AUTHENTICATOR
PortControl               = AUTO
ControlDirection          = Both
HostMode                  = MULTI_HOST
Violation Mode            = SHUTDOWN
ReAuthentication          = Enabled
QuietPeriod               = 60
ServerTimeout             = 0
SuppTimeout               = 30
ReAuthPeriod              = 7200 (Locally configured)
ReAuthMax                 = 2
MaxReq                    = 2
TxPeriod                  = 30
RateLimitPeriod           = 0

SW1#

=========================================================

guest vlan / fail vlan

設定投入

以下のコマンドでguest-vlan, auth-fail vlanを定義します。

 [SW1]
interface FastEthernet0/1
 dot1x guest-vlan 999
 dot1x auth-fail vlan 998

動作確認

下記showコマンドにより設定を確認します。

 [SW1]
SW1#show dot1x interface FastEthernet 0/1
Dot1x Info for FastEthernet0/1
-----------------------------------
PAE                       = AUTHENTICATOR
PortControl               = AUTO
ControlDirection          = Both
HostMode                  = MULTI_HOST
Violation Mode            = SHUTDOWN
ReAuthentication          = Enabled
QuietPeriod               = 60
ServerTimeout             = 0
SuppTimeout               = 30
ReAuthPeriod              = 7200 (Locally configured)
ReAuthMax                 = 2
MaxReq                    = 2
TxPeriod                  = 30
RateLimitPeriod           = 0
Auth-Fail-Vlan            = 998
Auth-Fail-Max-attempts    = 3
Guest-Vlan                = 999

SW1#

Authentication Bypass

設定投入

以下のコマンドを投入しAuthentication Bypassを定義します。RADUISサーバがダウンした場合は、vlan997が割り当てられるように設定します。

 [SW1]
radius-server dead-criteria time 30 tries 20
radius-server deadtime 60
dot1x critical eapol
dot1x critical recovery delay 2000

interface FastEthernet0/1
 dot1x critical
 dot1x critical recovery action reinitialize
 dot1x critical vlan 997

動作確認

下記showコマンドにより、dot1xの設定を確認します。

SW1#show dot1x all
Sysauthcontrol              Enabled
Dot1x Protocol Version            2
Critical Recovery Delay        2000
Critical EAPOL              Enabled

Dot1x Info for FastEthernet0/1
-----------------------------------
PAE                       = AUTHENTICATOR
PortControl               = AUTO
ControlDirection          = Both
HostMode                  = MULTI_HOST
Violation Mode            = SHUTDOWN
ReAuthentication          = Enabled
QuietPeriod               = 60
ServerTimeout             = 0
SuppTimeout               = 30
ReAuthPeriod              = 7200 (Locally configured)
ReAuthMax                 = 2
MaxReq                    = 2
TxPeriod                  = 30
RateLimitPeriod           = 0
Critical-Auth             = Enabled
Critical Recovery Action  = Reinitialize

Critical-Auth VLAN        = 997
Auth-Fail-Vlan            = 998
Auth-Fail-Max-attempts    = 3
Guest-Vlan                = 999

SW1#

下記showコマンドにより設定を確認します。RADIUSサーバのtimeout設定がチューニングされた事を確認します。

SW1#show aaa dead-criteria radius 192.168.1.1
RADIUS: No server group specified. Using radius
RADIUS Server Dead Critieria:
=============================
Server Details:
    Address   : 192.168.1.1
    Auth Port : 1645
    Acct Port : 1646
Server Group  : radius
Dead Criteria Details:
    Configured Retransmits   : 3
    Configured Timeout       : 5
    Estimated Outstanding Transactions: 0
    Dead Detect Time         : 30s
    Computed Retransmit Tries: 20
Statistics Gathered Since Last Successful Transaction
=====================================================
    Max Computed Outstanding Transactions: 0
    Max Computed Dead Detect Time: 0s
    Max Computed Retransmits : 0

SW1#
タイトルとURLをコピーしました