はじめに
- Cisco 機器にて RADIUS サーバを使用した MAC 認証バイパスを設定します
- 認証が有効化されたポートに対して端末が接続されたときに、端末の認証が成功した場合にのみ当該ポートをアップさせます(※)
- 認証方法は MAC アドレスによる認証とします
- 認証時に RADIUS サーバから MACアドレスに対応する Vlan 情報を返して、Cisco 側アクセスポートの Vlan ID が動的に決定されるようにします
作業環境
- オーセンティケータ
- Cisco C891FJ-K9
- バージョン:15.3(3)M5
- 認証サーバ
- CentOS 8.0
- FreeRADIUS 3.0.20
- サプリカント
- Windows 10
ネットワーク構成
Cisco 機器(オーセンティケータ)の設定
設定項目
- AAA の有効化
- RADIUS サーバの設定
- auth-port/acct-port は FreeRADIUS の場合は 1812/1813 ですが使用する認証サーバの仕様に合わせて設定します
- key は RADIUS サーバ側で設定している値とします
- RADIUS サーバグループの設定
- IEEE 802.1X 認証リストおよびネットワーク認可リストの設定
- グローバルでの IEEE 802.1X 認証の有効化
- ポートの設定
- アクセスポート設定
- IEEE 802.1X 認証の有効化
- 認証オーダーおよび認証プライオリティの設定と MAC 認証有効化
- オーセンティケータとしてのみ動作させる設定
## 1. AAA の有効化
aaa new-model
## 2. RADIUS サーバの設定
radius server "Radiusサーバ名"
address ipv4 "RadiusサーバIP" auth-port "1812" acct-port "1813"
key "Radiusサーバキー"
## 3. RADIUS サーバグループの設定
aaa group server radius "Radiusサーバグループ名"
server name "Radiusサーバ名"
## 4. IEEE 802.1X 認証リストおよびネットワーク認可リストの設定
aaa authentication dot1x default group "Radiusサーバグループ名"
aaa authorization network default group "Radiusサーバグループ名"
## 5. グローバルでの IEEE 802.1X 認証の有効化
dot1x system-auth-control
## 6. ポートの設定
interface "インターフェース名"
# 6.1. アクセスポート設定
switchport mode access
# 6.2. IEEE 802.1X 認証の有効化
authentication port-control auto
# 6.3. 認証オーダーおよび認証プライオリティの設定と MAC 認証有効化
authentication order mab
authentication priority mab
mab
# 6.4. オーセンティケータとしてのみ動作させる設定
dot1x pae authenticator
※緑文字部分が環境に合わせて変更するパラメータです。ダブルコーテーション「”」はハイライトのために付けているため、実際には付けないでください
設定例
## 1. AAA の有効化
aaa new-model
## 2. RADIUS サーバの設定
radius server radsv
address ipv4 10.1.10.9 auth-port 1812 acct-port 1813
key radiuskey
## 3. RADIUS サーバグループの設定
aaa group server radius RADgroup
server name radsv
## 4. IEEE 802.1X 認証リストおよびネットワーク認可リストの設定
aaa authentication dot1x default group RADgroup
aaa authorization network default group RADgroup
## 5. グローバルでの IEEE 802.1X 認証の有効化
dot1x system-auth-control
## 6. ポートの設定
interface GigabitEthernet0
# 6.1. アクセスポート設定
switchport mode access
# 6.2. IEEE 802.1X 認証の有効化
authentication port-control auto
# 6.3. 認証オーダーおよび認証プライオリティの設定と MAC 認証有効化
authentication order mab
authentication priority mab
mab
# 6.4. オーセンティケータとしてのみ動作させる設定
dot1x pae authenticator
オプション項目
いずれもインターフェースに対する設定です。
項目 | 説明 | 設定コマンド |
再認証 | 定期的な再認証の有効化 | authentication periodic |
再認証間隔 (再認証有効時) | 再認証間隔(秒) デフォルトは 3,600 秒 | authentication timer reauthenticate <1-65535> |
再認証間隔 (認証失敗時) | 認証失敗時の再認証間隔(秒) デフォルトは 60 秒 | authentication timer restart <0-65535> |
ホストモード | ・ポートでの複数端末認証の可否 ・ポートでの複数端末接続の可否 ・デフォルトは single-host | authentication host-mode multi-auth authentication host-mode single-host authentication host-mode multi-host |
ホストモードの詳細
authentication host-mode multi-auth
- 802.1X 認証ポートにハブを接続していて、そのハブに複数の端末が接続されている場合、端末ごとに認証を行い、認証できた端末のみ通信可能
authentication host-mode single-host
- 802.1X 認証ポートでは認証された 1 端末のみ通信可能
authentication host-mode multi-host
- 802.1X 認証ポートにハブを接続していて、そのハブに複数の端末が接続されている場合、いずれかの端末で認証に成功するとすべての端末で通信可能
設定確認コマンド
show dot1x interface <インターフェース名>
Router#show dot1x interface gigabitEthernet0
Dot1x Info for GigabitEthernet0
-----------------------------------
PAE = AUTHENTICATOR
PortControl = AUTO
ControlDirection = Both
HostMode = SINGLE_HOST
QuietPeriod = 60
ServerTimeout = 0
SuppTimeout = 30
ReAuthMax = 2
MaxReq = 2
TxPeriod = 30
FreeRADIUS(認証サーバ)の設定
認証サーバは CentOS 8.0 で FreeRADIUS を使用して構築します。
パッケージインストール
# dnf install freeradius freeradius-utils
設定ファイル編集
/etc/raddb/radiusd.conf
radiusd.conf
ではログの設定を行います。
log{}
セクションの中の以下の 3 項目を探します。デフォルトでいずれも no
になっているため、yes
に変更します。これで認証成功/失敗時のログが出力されます。
■変更前
log {
auth = no
auth_badpass = no
auth_goodpass = no
}
■変更後
log {
auth = yes
auth_badpass = yes
auth_goodpass = yes
}
出力先ログファイルは /var/log/radius/radius.log
です。
/etc/raddb/clients.conf
clients.conf
ではクライアントリストの設定を行います。
ファイルの末尾に以下の構文で内容を追加します。
client リスト名 {
ipaddr = x.x.x.x/nn
secret = 文字列
}
- ipaddr:オーセンティケータが所属するセグメントを指定
- secret:オーセンティケータにて RADIUS サーバ設定する際に指定する key となる文字列を指定
■設定例
client mynetwork {
ipaddr = 0.0.0.0/0
secret = radiuskey
}
/etc/raddb/users
users
では認証用ユーザ情報とダイナミック Vlan 用情報の設定を行います。
MAC 認証バイパスではユーザ ID とパスワードはともに MAC アドレスとなります。
ファイルの末尾に以下の構文で内容を追加します。
<MACアドレス> Cleartext-Password := "<MACアドレス>"
Tunnel-Type = 13 ,
Tunnel-Medium-Type = 6 ,
Tunnel-Private-Group-Id = "<Vlan ID または Vlan name>"
Tunnel-Type = 13
はTunnel-Type = VLAN
と書いても OKTunnel-Medium-Type = 6
はTunnel-Medium-Type = IEEE-802
と書いても OK
複数のユーザ(MAC アドレス)を登録する場合は上記の内容を必要分だけ記載します。
■設定例
7085c202646d Cleartext-Password := "7085c202646d"
Tunnel-Type = 13 ,
Tunnel-Medium-Type = 6 ,
Tunnel-Private-Group-Id = "10"
firewalld のポート開放設定
サービス radius
を追加します。
# firewall-cmd --add-service=radius --zone=public --permanent
# firewall-cmd --reload
# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client radius ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
radiusd サービスの起動と自動起動設定
# systemctl start radiusd
# systemctl enable radiusd
認証テスト
各機器の設定については以上で完了です。
各機器をネットワーク接続します。端末をオーセンティケータに接続すると認証が試みられます。
認証サーバのログ確認
認証成功時のログ:
# tail /var/log/radius/radius.log
Sat Jan 9 14:19:55 2021 : Auth: (8) Login OK: [7085c202646d/7085c202646d] (from client localnet1 port 50000 cli 70-85-C2-02-64-6D)
Cisco のログ
*Jan 9 04:48:02.043: %MAB-5-SUCCESS: Authentication successful for client (7085.c202.646d) on Interface Gi0 AuditSessionID 000000000000000000009A80
*Jan 9 04:48:02.043: %AUTHMGR-7-RESULT: Authentication result 'success' from 'mab' for client (7085.c202.646d) on Interface Gi0 AuditSessionID 000000000000000000009A80
*Jan 9 04:48:02.043: %AUTHMGR-5-VLANASSIGN: VLAN 10 assigned to Interface Gi0 AuditSessionID 000000000000000000009A80
*Jan 9 04:48:02.075: %AUTHMGR-5-SUCCESS: Authorization succeeded for client (7085.c202.646d) on Interface Gi0 AuditSessionID 000000000000000000009A80
*Jan 9 04:48:03.071: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0, changed state to up
*Jan 9 04:48:33.071: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
認証成功後にインターフェースが line protocol is up
になっていること、また RADIUS サーバ側で設定した通り Vlan 10 が割り当てられていることが確認できます。
Cisco 状態確認コマンド
show aaa servers
Router#show aaa servers
RADIUS: id 2, priority 1, host 10.1.10.9, auth-port 1812, acct-port 1813
State: current UP, duration 837s, previous duration 0s
Dead: total time 0s, count 3
Quarantined: No
Authen: request 1, timeouts 0, failover 0, retransmission 0
Response: accept 1, reject 0, challenge 0
Response: unexpected 0, server error 0, incorrect 0, time 4ms
Transaction: success 1, failure 0
Throttled: transaction 0, timeout 0, failure 0
Author: request 0, timeouts 0, failover 0, retransmission 0
Response: accept 0, reject 0, challenge 0
Response: unexpected 0, server error 0, incorrect 0, time 0ms
Transaction: success 0, failure 0
Throttled: transaction 0, timeout 0, failure 0
Account: request 0, timeouts 0, failover 0, retransmission 0
Request: start 0, interim 0, stop 0
Response: start 0, interim 0, stop 0
Response: unexpected 0, server error 0, incorrect 0, time 0ms
Transaction: success 0, failure 0
Throttled: transaction 0, timeout 0, failure 0
Elapsed time since counters last cleared: 13m
Estimated Outstanding Access Transactions: 0
Estimated Outstanding Accounting Transactions: 0
Estimated Throttled Access Transactions: 0
Estimated Throttled Accounting Transactions: 0
Maximum Throttled Transactions: access 0, accounting 0
Requests per minute past 24 hours:
high - 0 hours, 13 minutes ago: 1
low - 0 hours, 14 minutes ago: 0
average: 0
State: current UP
となっていること。
show authentication sessions
Router#show authentication sessions
Interface MAC Address Method Domain Status Session ID
Gi0 7085.c202.646d mab DATA Authz Success 000000000000000000009A80
Status Authz Success
となっていること。
show vlan-switch
Router#show vlan-switch
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Gi1, Gi2, Gi3, Gi5, Gi6
10 default_seg active Gi0, Gi4
#略
Gi0 が Vlan 10 となっていること。(設定した通りの Vlan が割り当てられていること。)
RADIUS パケットのキャプチャ
■リクエストパケット
User-Name が MAC アドレスになっていることが確認できます。パスワードは暗号化されています。
■アクセプトパケット
Tunnel-Private-Group-ID(Vlan 情報)として 10 が返ってきていることが確認できます。
ホストモード multi-auth の場合について
スイッチポートにて authentication host-mode multi-auth
と設定して、当該ポート配下にハブを接続して複数の端末を接続する場合は、すべての端末が同じ Vlan である必要があります。
異なる Vlan の端末を接続した場合、2 つめの Vlan 以降の認証時に Vlan の割り当てに失敗します。
参考資料

―――――――――――――