27-User Profile配置
本章節下載: 27-User Profile配置 (204.59 KB)
User Profile(用戶配置文件)提供一個配置模板,用於定義針對一個或一類用戶的一係列配置,例如QoS(Quality of Service,服務質量)策略。User Profile可重複使用,並且在用戶的接入端口發生變化後,無須重新為用戶進行配置,減少了配置工作量。
用戶訪問設備時,需要先進行上線用戶身份認證(例如通過802.1X接入認證方式)。用戶通過身份認證後,認證服務器會將與用戶賬戶綁定的User Profile名稱下發給設備,設備會根據指定User Profile裏配置的內容對上線用戶進行限製。
User Profile的典型應用為控製係統為上線用戶分配資源。比如基於接口進行流量監管可限製一群用戶(從指定接口接入的所有用戶)對帶寬資源的使用,而User Profile則可對單個用戶進行流量監管。
User Profile是和接入認證配合使用的,在配置User Profile前需要保證已完成相應的接入認證配置。各接入認證對User Profile的支持情況,請參見相關接入認證模塊的配置指導。
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
創建User Profile並進入相應的User Profile視圖 |
user-profile profile-name |
- |
基於User Profile應用已創建的QoS策略 |
qos apply policy policy-name { inbound | outbound } |
缺省情況下,未應用QoS策略 關於QoS策略的具體介紹與配置,請參見“ACL和QoS配置指導”中的QoS配置 |
在任意視圖下執行display命令可以顯示User Profile的配置信息和在線用戶信息,通過查看顯示信息驗證配置的效果。
表1-2 顯示User Profile
操作 |
命令 |
顯示User Profile的配置信息和在線用戶信息 |
(獨立運行模式) display user-profile [ name profile-name ] [ slot slot-number ] (IRF模式) display user-profile [ name profile-name ] [ chassis chassis-number slot slot-number ] |
如圖1-1所示,接入設備Device上連接了三個802.1X認證用戶,這些用戶屬於同一個ISP域“user”,為了提高認證/授權的效率,該ISP域內用戶采用Device本地認證方法。現要求對三個用戶的流量進行如下控製:
· UserA在每天上午8:30至12:00間即使通過認證也不能訪問網絡。
· UserB在通過認證後的上傳速率限製為2M。
· UserC在通過認證後的下載速率限製為4M。
圖1-1 802.1X本地認證/授權用戶應用Qos策略組網示意圖
(1) 創建對UserA的接入時間進行控製的QoS策略
# 創建周期時間段for_usera,時間範圍為每天的8:30~12:00。
[Device] time-range for_usera 8:30 to 12:00 daily
# 定義基本IPv4 ACL 2000,匹配for_usera內的所有報文。
[Device] acl basic 2000
[Device-acl-basic-2000] rule permit time-range for_usera
[Device-acl-basic-2000] quit
# 創建流分類for_usera,分類規則為匹配ACL 2000。
[Device] traffic classifier for_usera
[Device-classifier-for_usera] if-match acl 2000
[Device-classifier-for_usera] quit
# 創建流行為for_usera,動作為拒絕通過。
[Device] traffic behavior for_usera
[Device-behavior-for_usera] filter deny
[Device-behavior-for_usera] quit
# 創建QoS策略for_usera,將流分類和流行為進行關聯。
[Device] qos policy for_usera
[Device-qospolicy-for_usera] classifier for_usera behavior for_usera
[Device-qospolicy-for_usera] quit
(2) 為UserA創建User Profile,並應用QoS策略
# 創建User Profile,名稱為usera。
[Device] user-profile usera
# 由於是對UserA發送的報文進行過濾,因此在應用QoS策略時應該應用到設備的入方向。
[Device-user-profile-usera] qos apply policy for_usera inbound
[Device-user-profile-usera] quit
(3) 創建對UserB的速率進行限製的QoS策略
# 創建流分類class,匹配所有報文。
[Device] traffic classifier class
[Device-classifier-class] if-match any
[Device-classifier-class] quit
# 創建流行為for_userb,動作為流量監管,cir為2000kbps。
[Device] traffic behavior for_userb
[Device-behavior-for_userb] car cir 2000
[Device-behavior-for_userb] quit
# 創建QoS策略for_userb,將流分類和流行為進行關聯。
[Device] qos policy for_userb
[Device-qospolicy-for_userb] classifier class behavior for_userb
[Device-qospolicy-for_userb] quit
(4) 為UserB創建User Profile,並應用QoS策略
# 創建User Profile,名稱為userb。
[Device] user-profile userb
# 由於是對UserB發送的報文進行過濾,因此在應用QoS策略時應該應用到設備的入方向。
[Device-user-profile-userb] qos apply policy for_userb inbound
[Device-user-profile-userb] quit
(5) 創建對UserC的速率進行限製的QoS策略
# 創建流行為for_userc,動作為流量監管,cir為4000kbps。
[Device] traffic behavior for_userc
[Device-behavior-for_userc] car cir 4000
[Device-behavior-for_userc] quit
# 創建QoS策略for_userc,將流分類和流行為進行關聯。
[Device] qos policy for_userc
[Device-qospolicy-for_userc] classifier class behavior for_userc
[Device-qospolicy-for_userc] quit
(6) 為UserC創建User Profile,並應用QoS策略
# 創建User Profile,名稱為userc。
[Device] user-profile userc
# 由於是對UserC接收的報文進行過濾,因此在應用QoS策略時應該應用到設備的出方向。
[Device-user-profile-userc] qos apply policy for_userc outbound
[Device-user-profile-userc] quit
(7) 創建本地用戶
# 創建名稱為usera的本地用戶。
[Device] local-user usera class network
New local user added.
# 設置用戶密碼為“123456TESTusera&!”。
[Device-luser-network-usera] password simple 123456TESTusera&!
# 設置用戶接入類型為lan-access。
[Device-luser-network-usera] service-type lan-access
# 設置用戶的授權User Profile為usera。
[Device-luser-network-usera] authorization-attribute user-profile usera
[Device-luser-network-usera] quit
# 創建名稱為userb的本地用戶。
[Device] local-user userb class network
New local user added.
# 設置用戶密碼為“123456TESTuserb&!”。
[Device-luser-network-userb] password simple 123456TESTuserb&!
# 設置用戶接入類型為lan-access。
[Device-luser-network-userb] service-type lan-access
# 設置用戶的授權User Profile為userb。
[Device -luser-network-userb] authorization-attribute user-profile userb
[Device -luser-network-userb] quit
# 創建名稱為userc的本地用戶。
[Device] local-user userc class network
New local user added.
# 設置用戶密碼為“123456TESTuserc&!”。
[Device-luser-network-userc] password simple 123456TESTuserc&!
# 設置用戶接入類型為lan-access。
[Device-luser-network-userc] service-type lan-access
# 設置用戶的授權User Profile為userc。
[Device-luser-network-userc] authorization-attribute user-profile userc
[Device-luser-network-userc] quit
(8) 配置本地用戶的認證/授權/計費方法
# 配置ISP域“user”內的802.1X用戶的AAA方案為本地認證/授權,不計費
[Device] domain user
[Device-isp-user] authentication lan-access local
[Device-isp-user] authorization lan-access local
[Device-isp-user] accounting login none
[Device-isp-user] quit
(9) 配置802.1X功能
# 開啟指定端口Ten-GigabitEthernet1/0/1的802.1X特性。
[Device] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] dot1x
# 配置基於MAC地址的接入控製方式(該配置可選,因為端口的接入控製在缺省情況下就是基於MAC地址的)。
[Device-Ten-GigabitEthernet1/0/1] dot1x port-method macbased
[Device-Ten-GigabitEthernet1/0/1] quit
# 開啟全局802.1X特性。
[Device] dot1x
UserA、UserB、UserC通過802.1X客戶端連接網絡,輸入正確的用戶名和密碼後(注意用戶名需要攜帶域名後綴,例如UserA應該輸入用戶名“usera@user”和密碼“123456TESTusera&!”),認證成功並受到相應的Qos策略的限製。
使用diplay user-profile命令在Device上可以查看到如下配置信息和在線用戶信息。
<Device> display user-profile
User-Profile: usera
Inbound:
Policy: for_usera
slot 1:
User -:
Authentication type: 802.1X
Network attributes:
Interface : Ten-GigabitEthernet1/0/1
MAC address : 6805-ca06-557b
Service VLAN : 1
User-Profile: userb
Inbound:
Policy: for_userb
slot 1:
User -:
Authentication type: 802.1X
Network attributes:
Interface : Ten-GigabitEthernet1/0/1
MAC address : 80c1-6ee0-2664
Service VLAN : 1
User-Profile: userc
Outbound:
Policy: for_userc
slot 1:
User -:
Authentication type: 802.1X
Network attributes:
Interface : Ten-GigabitEthernet1/0/1
MAC address : 6805-ca05-3efa
Service VLAN : 1
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!