# 用命令操作 Brocade SAN 交換器 - Part2: Zoning 設定 ###### tags: `san` `storage` `brocade` [toc] # Zoning? 其實之前最常聽到 SAN 交換器的應用就是 **Zoning**(分區?應該可以這樣翻譯吧!)。就我腦力的理解就是將實體連接的服務主機和存儲設備,透過 Zoning 劃分成為可相互存取的邏輯設備群組。 在核心架構(Fabric)中建立分區(Zoning), - 同一區域(zone)中的服務主機和存儲設備可以相互存取。 - 位於不同區域(zone)中的設備相互間無法存取。 - 設備可以屬於多個區域。 ## Zoning 範例 下圖是不同版本中提到的分區範例。但基本上都說明了大致相同的分區概念: - Server 1 僅可與 Storage 1/Loop 1 設備相互聯繫。(紅色區域) - Server 2 僅可與 Storage 2 及 RAID 設備相互聯繫。(藍色區域) - Server 3 可與 Storage 1/Loop 1 和 RAID 設備相互聯繫。(綠色區域) - Storage 3/Loop 2 並未指定於任何區域當中,所以此核心架構(fabric)中已被指派區域的服務主機和存儲設備可以與其相互聯繫。 <img width=480 src='https://hackmd.io/_uploads/HJQ3A2t43.png'> > Brocade 7.1.0 Fabric OS Administator's Guide <img width=640 src='https://hackmd.io/_uploads/H1raC2tEh.png'> > Brocade 8.2.x Fabric OS Administation Guide 我想大致了解這個概念應該就可以了。 :::info 使用 **zonehelp** 命令可以列出與 zoning 相關的命令列表。 ```bash switch:admin> zonehelp aliadd Add a member to a zone alias alicreate Create a zone alias alidelete Delete a zone alias aliremove Remove a member from a zone alias alishow Print zone alias information bootluncfg Configure boot LUN for an HBA cfgactvshow Display Effective zone configuration information cfgadd Add a member to a configuration cfgclear Clear all zone configurations cfgcreate Create a zone configuration cfgdelete Delete a zone configuration cfgdisable Disable a zone configuration cfgenable Enable a zone configuration cfgremove Remove a member from a configuration cfgsave Save zone configurations in flash cfgshow Print zone configuration information cfgsize Print size details of zone database cfgtransabort Abort zone configuration transaction cfgtransshow Print zone configurations in transaction buffer defzone Activates or deactivates a default zone configuration. msfr Create a MSFR Zone nsdevlog Manage Name Server device logs nszonemember Display the information of all the online devices which are zoned with the given device. openfr Create a MSFR Zone zone Configure zone objects zoneadd Add a member to a zone zonecreate Create a zone zonedelete Delete a zone zonehelp Print zoning help info zoneobjectcopy Copies a zone object zoneobjectexpunge Expunges a zone object zoneobjectrename Rename a zoning Object zoneobjectreplace Replace a zoning Object zoneremove Remove a member from a zone zoneshow Print zone information ``` ::: ## 區域成員(Zone Member) 區域成員(zone member) 指的應該是設定時所指定存在於區域的對象(object),其中可包含以下類型: - **SAN 交換器實體埠** 以 **<Domain_ID>,<Index_Number> | D,I** 的格式來表示。 - **WWN(World Wide Name)** WWN 格式為 **`10:00:50:eb:1a:7a:fe:5e`**,以 **":"** 區隔 **8** 組 16 進位數字。簡單理解是 **FC 光纖通道定址的格式**,相較網際網路(Internet) 使用的是 IP 位址; 區域網路使用的是 MAC 位址。基本上 WWN 為獨一無二的定址方式。WWN 在使用上還分為兩種: - 用來指定設備或節點 (node) 的稱為 **WWNN, World Wide Node Name** 或 **N-WWN, Node World Wide Name**。 - 用來指定存取的埠 (port) 位址的叫作 **WWPN, World Wide Port Name** 或 **P-WWN, Port World Wide Name**。 另外使用不同類型進行的區域設定,也會影響區域成員資格。 - 使用 SAN 交換器實體埠時,連接至該交換器實體埠的所有設備都屬於該區域。 - 使用 Node-WWN(WWNN) 作為區域成員,指定的設備屬於該區域。 > 該設備(節點)的所有界面埠應該都屬於該區域? - 使用 Port-WWN(WWPN) 作為區域成員,只有該界面埠屬於該區域。 設定區域時,對於定義區域成員的類型可以混用,使用 **";"** 作為區隔即可。 ## 區域別名(Zone Alias) 看到要建立 zoning,如果要使用的是 WWN 類型,心情一定會不好的。怪不得存儲專家都告訴我,用 GUI 界面設定就好。沒辦法就遇到 Java 不能用啊! 幸好可以透過將這些 WWN 或交換器實體埠定義成閱讀性高的區域別名,可大幅地簡化設定,減少重複輸入的錯誤。 - 設定別名時須注意別名成員必須至少一組,不能沒有。 - 別名成員的設定類型可以混用交換器實體埠和 WWN。 ## 區域組態(Zone Configuration) - 區域組態可以包含一組以上的區域,而設定的區域可以包含在多個區域組態當中。 - 當區域組態生效(effect)時,在組態中的所有區域也會同時生效。 - 在一個 SAN 交換器上同時可以保留多組區域組態,讓管理者可以在多個組態之間切換使用。 - **一次只能啟用一組區域組態**。 區域組態包含以下類型: - **Defined configuration**: 在 fabric 中所定義全部的區域物件(object),包含 - zone configuration - zone name - alias name - **Effective configuration**: 目前所套用的區域組態。啟用(enable)指定的區域組態便會建立成有效組態。 - **Saved configuration**: 保存在快閃記憶體中的定義區域組態和有效區域組態。若修改區域的配置而沒有儲存,所保存的區域組態和定義的區域組態之間可能存在差異。 - **Disabled configuration**: 從快閃記憶體移除的有效區域組態。 :::danger 夠了!只是要設定 Zoning ,應該是不需要知道這些資訊的。腦容量存放空間不足已經產生告警了。直接按照攻略,打完收工! ::: # 實際操作 :::success **主要目標** 將連接 SAN 交換器的 ESXi 主機和存儲設備,完成簡單的 Zoning 組態,並讓 ESXi 主機可以正確取得存儲設備規劃提供的資料存放區。 ::: ## 連線架構 ESXi 主機和存儲設備分別使用多模光纖線與 SAN 交換器建立 FC 光纖通道,實際接線及連接埠如下圖所示。 <img width=480 src='https://i.imgur.com/IOkaO6Q.png'> ## WWN 資訊 要建立 zoning 資訊,需要先確認區域成員的資訊,這裡分別透過命令取得各個設備界面的 WWN (Port-WWN )資訊。 ### ESXi 主機 在 VMware vSphere 系統中,可以使用 **`esxcli storage core adapter list`** 簡要列出實體儲存卡資訊。 ```bash [root@HDSLAB:~] esxcli storage core adapter list HBA Name Driver Link State UID Capabilities Description -------- ---------- ---------- ------------------------------------ ------------------- ----------- vmhba0 vmw_ahci link-n/a sata.vmhba0 (0000:00:11.4) Intel Corporation Wellsburg AHCI Controller vmhba1 vmw_ahci link-n/a sata.vmhba1 (0000:00:1f.2) Intel Corporation Wellsburg AHCI Controller vmhba2 qlnativefc link-up fc.20000024ff203d6e:21000024ff203d6e Second Level Lun ID (0000:81:00.0) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA vmhba3 qlnativefc link-up fc.20000024ff203d6f:21000024ff203d6f Second Level Lun ID (0000:81:00.1) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA ``` 使用 **grep fc** 針對 Fibre Channel 實體卡條列資訊。 ```bash [root@HDSLAB:~] esxcli storage core adapter list | grep -i fc vmhba2 qlnativefc link-up fc.20000024ff203d6e:21000024ff203d6e Second Level Lun ID (0000:81:00.0) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA vmhba3 qlnativefc link-up fc.20000024ff203d6f:21000024ff203d6f Second Level Lun ID (0000:81:00.1) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA [root@HDSLAB:~] esxcli storage core adapter list | grep -i fc | awk '{print $1, $2, $4}' vmhba2 qlnativefc fc.20000024ff203d6e:21000024ff203d6e vmhba3 qlnativefc fc.20000024ff203d6f:21000024ff203d6f ``` 使用命令 **`esxcli storage san fc list`** 顯示系統安裝 FC 實體卡詳細資訊。 ```bash [root@HDSLAB:~] esxcli storage san fc list Adapter: vmhba2 Port ID: 010000 Node Name: 20:00:00:24:ff:20:3d:6e Port Name: 21:00:00:24:ff:20:3d:6e Speed: 8 Gbps Port Type: NPort Port State: ONLINE Model Description: PCI-Express Dual Channel 8Gb Fibre Channel HBA Hardware Version: PX2810403-01 D OptionROM Version: 2.10 Firmware Version: 8.08.207 (90d5) Driver Name: qlnativefc DriverVersion: 4.1.14.0 Adapter: vmhba3 Port ID: 010000 Node Name: 20:00:00:24:ff:20:3d:6f Port Name: 21:00:00:24:ff:20:3d:6f Speed: 8 Gbps Port Type: NPort Port State: ONLINE Model Description: PCI-Express Dual Channel 8Gb Fibre Channel HBA Hardware Version: PX2810403-01 D OptionROM Version: 2.10 Firmware Version: 8.08.207 (90d5) Driver Name: qlnativefc DriverVersion: 4.1.14.0 ``` 目前得知 **ESXi 主機上 FC 實體卡 WWN 資訊**: | 界面卡名稱 | Node-WWN | Port-WWN | Speed | Port Type | 驅動程式 | | --- | --- | --- | --- | --- | --- | | vmhba2 | **20:00:00:24:ff:20:3d:6e** | **21:00:00:24:ff:20:3d:6e** | 8 Gbps | N-port | qlnativefc | | vmhba3 | **20:00:00:24:ff:20:3d:6f** | **21:00:00:24:ff:20:3d:6f** | 8 Gbps | N-port | qlnativefc | :::info 使用以下命令可以了解目前驅動程式安裝版本。 ```bash [root@HDSLAB:~] vmkload_mod -s qlnativefc | grep Version Version: 4.1.14.0-26vmw.703.0.20.19193900 ``` ::: ### HDS 存儲設備 本次測試的存儲設備為 Hitachi G130,使用 Storage Advisor Embedded 工具,選擇上方 **Ports** 功能,便可顯示目前磁碟控制器配置的 FC 界面 WWN 資訊。 ![](https://i.imgur.com/magPxFC.png) 另外也可以透過 Hitachi Embedded CCI(Command Control Interface) 提供命令界面,使用 **`raidcom get port`** 命令查詢 FC 界面 WWN 資訊。 ![](https://i.imgur.com/hib0ait.png) 目前得知**存儲設備 FC 界面 WWN 資訊**: | 磁碟控制器 | 界面埠 | WWN(port) | | --- | --- | --- | | CTL1 | 1A | 50060e80224b4600 | | CTL1 | 3A | 50060e80224b4620 | | CTL2 | 2A | 50060e80224b4610 | | CTL2 | 4A | 50060e80224b4630 | :::info - **磁碟控制器#1(CTL1)** 的 FC 界面埠編號為 **1A** 和 **3A** (奇數)。 - **磁碟控制器#2(CTL2)** 的 FC 界面埠編號為 **2A** 和 **4A** (偶數)。 ::: ## WWN 格式轉換 取得 WWN 的過程中發現,設備顯示 **WWN 的格式可能帶有 ':' 或沒有 ':'** 的兩種格式,有時輸入 WWN 也需要不同的格式。所以透過 ChatGPT 寫碼好幫手,輕鬆完成一個**轉換 WWN 格式的腳本程式**。 ### wwn_converter.sh ```bash= #!/bin/bash # # edited by ChatGPT # # 2023/05/11 add_colons=false remove_colons=false while getopts "ar" opt; do case ${opt} in a) add_colons=true ;; r) remove_colons=true ;; esac done shift $((OPTIND -1)) if [ $# -ne 1 ]; then echo "Usage: $0 [-a | -r] <wwn>" >&2 exit 1 fi wwn="${1//:/}" # remove colons if present if $add_colons; then echo "${wwn:0:2}:${wwn:2:2}:${wwn:4:2}:${wwn:6:2}:${wwn:8:2}:${wwn:10:2}:${wwn:12:2}:${wwn:14:2}" elif $remove_colons; then echo "${wwn}" else echo "Usage: $0 [-a | -r] <wwn>" >&2 exit 1 fi ``` ### 執行結果 ```bash $ ./wwn_converter.sh Usage: ./wwn_converter.sh [-a | -r] <wwn> $ ./wwn_converter.sh -a 50060e80224b4600 50:06:0e:80:22:4b:46:00 $ ./wwn_converter.sh -r 21:00:00:24:ff:20:3d:6e 21000024ff203d6e ``` # Zoning 組態流程 了解上述的資訊後,建立分區組態的大致流程如下: 1. 建立區域成員別名(Zone Alias) 2. 建立區域名稱並群組成員(Create Zone) 3. 將區域資訊加入至區域組態(Creare Zone Configuration) 4. 儲存區域組態(Save Zone Configuration) 5. 啟用區域組態(Enable Zone Configuration) 上述的建立流程,轉換成 SAN 交換器的命令語言: ```mermaid graph LR; alicreate-->zonecreate; zonecreate-->cfgcreate; zonecreate-->cfgadd; cfgcreate-->cfgsave; cfgadd-->cfgsave; cfgsave-->cfgenable; ``` ## 區域資訊整理 根據所收集到設備的 WWN 及線路連接的界面埠資訊,歸納整理如下: #### SAN SW1 | 設備 | 界面埠 | WWN | 交換器埠號 | 區域別名 | | --- | --- | --- | :-: | --- | | ESXi | vmhba3 | 21:00:00:24:ff:20:3d:6f | 0 | ESXi_vmhba3 | | Storage | ct1_1A | 50:06:0e:80:22:4b:46:00 | 8 | HDS_CT1_1A | | Storage | ct2_2A | 50:06:0e:80:22:4b:46:10 | 16 | HDS_CT2_2A | #### SAN SW2 | 設備 | 界面埠 | WWN | 交換器埠號 | 區域別名 | | --- | --- | --- | :-: | --- | | ESXi | vmhba2 | 21:00:00:24:ff:20:3d:6e | 0 | ESXi_vmhba2 | | Storage | ct1_3A | 50:06:0e:80:22:4b:46:20 | 8 | HDS_CT1_3A | | Storage | ct2_4A | 50:06:0e:80:22:4b:46:30 | 16 | HDS_CT2_4A | #### Zone Objects | 物件 | 名稱 | | --- | --- | | Zone Name | HDS_ZONE | | Configuration Name | HDS_ZONE_CONFIG | ## 建立區域成員別名(Create Alias) 使用 **`alicreate`** 定義設備別名。完成後使用 **`alishow`** 顯示設定內容。 :::info - 命令詳細說明,請自行參閱官方文件。 - 設定命令執行顯示 SAN 交換器 #1(SAN48-111),在 SAN 交換器 #2(SAN48-112) 也需根據上述資訊及命令建立完成。 ::: ```bash SAN48-111:admin> alicreate "ESXi_vmhba3", "21:00:00:24:ff:20:3d:6f" SAN48-111:admin> alicreate "HDS_CT1_1A", "50:06:0e:80:22:4b:46:00" SAN48-111:admin> alicreate "HDS_CT2_2A", "50:06:0e:80:22:4b:46:10" SAN48-111:admin> alishow Defined configuration: alias: ESXi_vmhba3 21:00:00:24:ff:20:3d:6f alias: HDS_CT1_1A 50:06:0e:80:22:4b:46:00 alias: HDS_CT2_2A 50:06:0e:80:22:4b:46:10 Effective configuration: no configuration in effect ``` :::info 此時定義組態(Defined Configuration)已經包含區域別名資訊,但尚未生效的區域組態(Effective Configuration)。 ::: ## 建立區域並群組成員(Create Zone) 使用 **`zonecreate`** 建立區域名稱 **HDS_ZONE**,並從先前建立的設備別名加入其成員名單,各成員資訊用 **';'** 區隔。使用 **`zoneshow`** 顯示區域設定內容。 ```bash SAN48-111:admin> zonecreate "HDS_ZONE", "ESXi_vmhba3; HDS_CT1_1A; HDS_CT2_2A" SAN48-111:admin> zoneshow Defined configuration: zone: HDS_ZONE ESXi_vmhba3; HDS_CT1_1A; HDS_CT2_2A alias: ESXi_vmhba3 21:00:00:24:ff:20:3d:6f alias: HDS_CT1_1A 50:06:0e:80:22:4b:46:00 alias: HDS_CT2_2A 50:06:0e:80:22:4b:46:10 Effective configuration: no configuration in effect ``` :::info 定義組態又增加區域及其成員資訊,依舊尚未有生效的區域組態。 ::: ## 建立區域組態(Create Zone Configuration) 使用 **`cfgcreate`** 建立組態名稱 **HDS_ZONE_CONFIG**,並將區域 **HDS_ZONE** 加入該組態中。 若區域組態名稱已經存在,則使用 **`cfgadd`**,將新建立的區域 **HDS_ZONE** 加入至現有的區域組態中。 使用 **`cfgshow`** 顯示目前組態配置狀態。 ```bash SAN48-111:admin> cfgcreate "HDS_ZONE_CONFIG", "HDS_ZONE" SAN48-111:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE zone: HDS_ZONE ESXi_vmhba3; HDS_CT1_1A; HDS_CT2_2A alias: ESXi_vmhba3 21:00:00:24:ff:20:3d:6f alias: HDS_CT1_1A 50:06:0e:80:22:4b:46:00 alias: HDS_CT2_2A 50:06:0e:80:22:4b:46:10 Effective configuration: no configuration in effect ``` :::info 定義組態又增加區域組態資訊,依舊尚未有生效的區域組態。 ::: ## 儲存並啟用組態(Save and Enable Zone Configuration) 將先前完成定義的區域組態使用 **`cfgsave`** 儲存至快閃記憶體,接著使用 **`cfgenable`** 將該區域組態啟用為有效的區域組態。 SAN 交換器將會根據相關配置完成分區功能。 使用 **`cfgshow`** 顯示並確認目前啟用的區域組態。 ```bash SAN48-111:admin> cfgsave You are about to save the Defined zoning configuration. This action will only save the changes on Defined configuration. If the update includes changes to one or more traffic isolation zones, you must issue the 'cfgenable' command for the changes to take effect. Do you want to save the Defined zoning configuration only? (yes, y, no, n): [no] y Updating flash ... SAN48-111:admin> cfgenable "HDS_ZONE_CONFIG" You are about to enable a new zoning configuration. This action will replace the old zoning configuration with the current configuration selected. If the update includes changes to one or more traffic isolation zones, the update may result in localized disruption to traffic on ports associated with the traffic isolation zone changes Do you want to enable 'HDS_ZONE_CONFIG' configuration (yes, y, no, n): [no] y zone config "HDS_ZONE_CONFIG" is in effect Updating flash ... SAN48-111:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE zone: HDS_ZONE ESXi_vmhba3; HDS_CT1_1A; HDS_CT2_2A alias: ESXi_vmhba3 21:00:00:24:ff:20:3d:6f alias: HDS_CT1_1A 50:06:0e:80:22:4b:46:00 alias: HDS_CT2_2A 50:06:0e:80:22:4b:46:10 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6f 50:06:0e:80:22:4b:46:00 50:06:0e:80:22:4b:46:10 ``` :::info 定義組態為目前區域組態資訊,生效的區域組態為 **HDS_ZONE_CONFIG**。 ::: :::success 使用 **`echo -e 'y\n' | cfgsave`** 可以直接回答 yes,可以再偷懶一點!新版本 Fabric OS 9.x 有加入 **`--force | -f`** 參數了! ::: 以下是 SAN 交換器 #2 (SAN48-112) 複製貼上命令的執行結果: ```bash SAN48-112:admin> alicreate "ESXi_vmhba2", "21:00:00:24:ff:20:3d:6e" SAN48-112:admin> alicreate "HDS_CT1_3A", "50:06:0e:80:22:4b:46:20" SAN48-112:admin> alicreate "HDS_CT2_4A", "50:06:0e:80:22:4b:46:30" SAN48-112:admin> zonecreate "HDS_ZONE", "ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A" SAN48-112:admin> echo SAN48-112:admin> cfgcreate "HDS_ZONE_CONFIG", "HDS_ZONE" SAN48-112:admin> echo -e 'y\n' | cfgsave You are about to save the Defined zoning configuration. This action will only save the changes on Defined configuration. If the update includes changes to one or more traffic isolation zones, you must issue the 'cfgenable' command for the changes to take effect. Do you want to save the Defined zoning configuration only? (yes, y, no, n): [no] Updating flash ... SAN48-112:admin> echo -e 'y\n' | cfgenable "HDS_ZONE_CONFIG" You are about to enable a new zoning configuration. This action will replace the old zoning configuration with the current configuration selected. If the update includes changes to one or more traffic isolation zones, the update may result in localized disruption to traffic on ports associated with the traffic isolation zone changes Do you want to enable 'HDS_ZONE_CONFIG' configuration (yes, y, no, n): [no] zone config "HDS_ZONE_CONFIG" is in effect Updating flash ... SAN48-112:admin> echo SAN48-112:admin> SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6e 50:06:0e:80:22:4b:46:20 50:06:0e:80:22:4b:46:30 ``` :::success 其實只要把設定命令準備好,透過 Console 或 SSH 連線登入,將配置命令貼上,就可以**輕鬆完成分區設定**囉! :+1: ::: ## 進一步觀察 完成 Zoning 任務,使用 **`switchshow`** 檢視交換器和界面埠狀態。ESXi 主機和存儲設備的 WWN 都與規劃配置連線一致,且狀態正常。 :::info 2 台 SAN 交換器獨立存在,目前的**角色(SwitchRole)**都是 **"Principal**,且**網域識別碼(Domain ID)** 都是 **"1"**。後續若有測試串接 SAN 交換器時,可以再次觀察這些資訊。 ::: - SAN48-111(SAN SW1) ```bash SAN48-111:admin> switchshow switchName: SAN48-111 switchType: 109.1 switchState: Online switchMode: Native switchRole: Principal switchDomain: 1 switchId: fffc01 switchWwn: 10:00:50:eb:1a:7a:fe:5e zoning: OFF switchBeacon: OFF FC Router: OFF FC Router BB Fabric ID: 1 Address Mode: 0 HIF Mode: OFF Index Port Address Media Speed State Proto ================================================== 0 0 010000 id N8 Online FC F-Port 21:00:00:24:ff:20:3d:6f 1 1 010100 id N16 No_Light FC 2 2 010200 id N16 No_Light FC 3 3 010300 id N16 No_Light FC 4 4 010400 id N16 No_Light FC 5 5 010500 id N16 No_Light FC 6 6 010600 id N16 No_Light FC 7 7 010700 id N16 No_Light FC 8 8 010800 id N16 Online FC F-Port 50:06:0e:80:22:4b:46:00 9 9 010900 id N16 No_Light FC 10 10 010a00 id N16 No_Light FC 11 11 010b00 id N16 No_Light FC 12 12 010c00 id N16 No_Light FC 13 13 010d00 id N16 No_Light FC 14 14 010e00 id N16 No_Light FC 15 15 010f00 id N16 No_Light FC 16 16 011000 id N16 Online FC F-Port 50:06:0e:80:22:4b:46:10 17 17 011100 id N16 No_Light FC 18 18 011200 id N16 No_Light FC 19 19 011300 id N16 No_Light FC 20 20 011400 id N16 No_Light FC 21 21 011500 id N16 No_Light FC 22 22 011600 id N16 No_Light FC 23 23 011700 id N16 No_Light FC 24 24 011800 id N16 No_Light FC 25 25 011900 id N16 No_Light FC 26 26 011a00 id N16 No_Light FC 27 27 011b00 id N16 No_Light FC 28 28 011c00 id N16 No_Light FC 29 29 011d00 id N16 No_Light FC 30 30 011e00 id N16 No_Light FC 31 31 011f00 id N16 No_Light FC 32 32 012000 id N16 No_Light FC 33 33 012100 id N16 No_Light FC 34 34 012200 id N16 No_Light FC 35 35 012300 id N16 No_Light FC 36 36 012400 id N16 No_Light FC 37 37 012500 id N16 No_Light FC 38 38 012600 id N16 No_Light FC 39 39 012700 id N16 No_Light FC 40 40 012800 id N16 No_Light FC 41 41 012900 id N16 No_Light FC 42 42 012a00 id N16 No_Light FC 43 43 012b00 id N16 No_Light FC 44 44 012c00 id N16 No_Light FC 45 45 012d00 id N16 No_Light FC 46 46 012e00 id N16 No_Light FC 47 47 012f00 id N16 No_Light FC SAN48-111:admin> ``` - SAN48-112(SAN SW2) ```bash SAN48-112:admin> switchshow switchName: SAN48-112 switchType: 109.1 switchState: Online switchMode: Native switchRole: Principal switchDomain: 1 switchId: fffc01 switchWwn: 10:00:50:eb:1a:42:88:7c zoning: ON (HDS_ZONE_CONFIG) switchBeacon: OFF FC Router: OFF FC Router BB Fabric ID: 1 Address Mode: 0 HIF Mode: OFF Index Port Address Media Speed State Proto ================================================== 0 0 010000 id N8 Online FC F-Port 21:00:00:24:ff:20:3d:6e 1 1 010100 id N16 No_Light FC 2 2 010200 id N16 No_Light FC 3 3 010300 id N16 No_Light FC 4 4 010400 id N16 No_Light FC 5 5 010500 id N16 No_Light FC 6 6 010600 id N16 No_Light FC 7 7 010700 id N16 No_Light FC 8 8 010800 id N16 Online FC F-Port 50:06:0e:80:22:4b:46:20 9 9 010900 id N16 No_Light FC 10 10 010a00 id N16 No_Light FC 11 11 010b00 id N16 No_Light FC 12 12 010c00 id N16 No_Light FC 13 13 010d00 id N16 No_Light FC 14 14 010e00 id N16 No_Light FC 15 15 010f00 id N16 No_Light FC 16 16 011000 id N16 Online FC F-Port 50:06:0e:80:22:4b:46:30 17 17 011100 id N16 No_Light FC 18 18 011200 id N16 No_Light FC 19 19 011300 id N16 No_Light FC 20 20 011400 id N16 No_Light FC 21 21 011500 id N16 No_Light FC 22 22 011600 id N16 No_Light FC 23 23 011700 id N16 No_Light FC 24 24 011800 id N16 No_Light FC 25 25 011900 id N16 No_Light FC 26 26 011a00 id N16 No_Light FC 27 27 011b00 id N16 No_Light FC 28 28 011c00 id N16 No_Light FC 29 29 011d00 id N16 No_Light FC 30 30 011e00 id N16 No_Light FC 31 31 011f00 id N16 No_Light FC 32 32 012000 id N16 No_Light FC 33 33 012100 id N16 No_Light FC 34 34 012200 id N16 No_Light FC 35 35 012300 id N16 No_Light FC 36 36 012400 id N16 No_Light FC 37 37 012500 id N16 No_Light FC 38 38 012600 id N16 No_Light FC 39 39 012700 id N16 No_Light FC 40 40 012800 id N16 No_Light FC 41 41 012900 id N16 No_Light FC 42 42 012a00 id N16 No_Light FC 43 43 012b00 id N16 No_Light FC 44 44 012c00 id N16 No_Light FC 45 45 012d00 id N16 No_Light FC 46 46 012e00 id N16 No_Light FC 47 47 012f00 id N16 Laser_Flt FC ``` 從存儲設備的管理工具中,將註冊的 ESXi 主機加入 Volumes,若是正確的 Zoning 配置,ESXi 主機將會正確取得存儲系統所提供的空間。 ![](https://i.imgur.com/qSB53QH.png) 加入 2 組 Volumes,各提供 250GB 存儲空間。 ![](https://i.imgur.com/UJpmHmD.png) 存儲空間提供完成! ![](https://i.imgur.com/3gQFpUE.png) 從 ESXi 主機上使用 **`esxcli storage core adapter device list`** 顯示目前 FC 介面卡取得對應的存儲裝置空間資訊。 ![](https://i.imgur.com/AHhJRyY.png) 由 Web 管理工具也可取得相同資訊。 ![](https://i.imgur.com/nbsSA2M.png) ESXi 主機接續就可用該空間建立資料存放區(Datastore)。 ![](https://i.imgur.com/zSWqnFM.png) 大致上任務已經完成,準備收工囉! # 進一步觀察測試 ## defzone 使用 **`defzone`** 可以顯示及設定預設區域的存取模式。在未啟用分區功能時,則使用此預設區域控制設備存取。只要使用者啟用分區功能,便會覆蓋預設區域存取模式。預設區域的相關物件會使用 **d_efault_** 作為前綴(d_default_cfg, d_default_zone)存在且不可變動。使用 **`cfgshow`** 也不可見。 :::info 這部份我並不清楚實際的運作,也無從以命令結果查詢確認。 ::: ```bash SAN48-111:admin> defzone --show Default Zone Access Mode committed - All Access transaction - No Transaction ``` ## 相關命令操作 先前提到 zoning 的成員組成也可直接用 SAN 交換器實體埠建立。讓我試著用這種方式建立分區看看。 ```bash SAN48-112:admin> alicreate "connect_host", "1,0;1,1;1,2;1,3" SAN48-112:admin> alicreate "connect_array", "1,4;1,5;1,6;1,7" SAN48-112:admin> zonecreate "test_port_zone", "connect_host; connect_array; 1,8" SAN48-112:admin> cfgcreate "test_port_cfg", "test_port_zone" SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE cfg: test_port_cfg test_port_zone zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A zone: test_port_zone connect_host; connect_array; 1,8 alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 alias: connect_array 1,4; 1,5; 1,6; 1,7 alias: connect_host 1,0; 1,1; 1,2; 1,3 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6e 50:06:0e:80:22:4b:46:20 50:06:0e:80:22:4b:46:30 ``` 目前建立了一組新的區域組態 **test_port_cfg**,由 **test_port_zone** 定義區域,其中成員直接用交換器實體埠建立。接著使用 **`cfgadd`** 命令把新建立的區域 **test_port_zone** 加入既有的區域組態 **HDS_ZONE_CONFIG**。 ```bash SAN48-112:admin> cfgadd "HDS_ZONE_CONFIG", "test_port_zone" SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE; test_port_zone cfg: test_port_cfg test_port_zone zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A zone: test_port_zone connect_host; connect_array; 1,8 alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 alias: connect_array 1,4; 1,5; 1,6; 1,7 alias: connect_host 1,0; 1,1; 1,2; 1,3 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6e 50:06:0e:80:22:4b:46:20 50:06:0e:80:22:4b:46:30 ``` 別忘了,要套用區域組態,要使用 **cfgenable** 命令才會生效。 ```bash SAN48-112:admin> echo -e 'y\n' | cfgsave WARNING!!! The changes you are attempting to save will render the Effective configuration and the Defined configuration inconsistent. The inconsistency will result in different Effective Zoning configurations for switches in the fabric if a zone merge or HA failover happens. To avoid inconsistency it is recommended to commit the configurations using the 'cfgenable' command. Do you want to proceed with saving the Defined zoning configuration only? (yes, y, no, n): [no] Updating flash ... SAN48-112:admin> echo -e 'y\n' | cfgenable "HDS_ZONE_CONFIG" You are about to enable a new zoning configuration. This action will replace the old zoning configuration with the current configuration selected. If the update includes changes to one or more traffic isolation zones, the update may result in localized disruption to traffic on ports associated with the traffic isolation zone changes Do you want to enable 'HDS_ZONE_CONFIG' configuration (yes, y, no, n): [no] zone config "HDS_ZONE_CONFIG" is in effect Updating flash ... SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE; test_port_zone cfg: test_port_cfg test_port_zone zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A zone: test_port_zone connect_host; connect_array; 1,8 alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 alias: connect_array 1,4; 1,5; 1,6; 1,7 alias: connect_host 1,0; 1,1; 1,2; 1,3 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6e 50:06:0e:80:22:4b:46:20 50:06:0e:80:22:4b:46:30 zone: test_port_zone 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7 1,8 ``` 好喔!看來就是這麼簡單。只要確認連接的實體埠或是設備 WWN 資訊,應該就可以用腳本程式建立設定命令了,這樣一來,也可作為設定備份使用。這部份這邊就不測試! 由於連線調整原本 port 1,8 需要移除,可以使用 **`zoneremove`** 完成。但是還是別忘了,修正的區域組態並未套用喔。 ```bash SAN48-112:admin> zoneremove "test_port_zone", "1,8" SAN48-112:admin> zoneshow "test_port_zone" zone: test_port_zone connect_host; connect_array ``` 接著管理者要變更區域 **test_port_zone** 為 **port_testzone**。 ```bash SAN48-112:admin> zoneobjectrename "test_port_zone", "port_testzone" SAN48-112:admin> SAN48-112:admin> zoneshow "test_port_zone" "test_port_zone" does not exist. SAN48-112:admin> zoneshow "port_testzone" zone: port_testzone connect_host; connect_array SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE; port_testzone cfg: test_port_cfg port_testzone zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A zone: port_testzone connect_host; connect_array alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 alias: connect_array 1,4; 1,5; 1,6; 1,7 alias: connect_host 1,0; 1,1; 1,2; 1,3 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6e 50:06:0e:80:22:4b:46:20 50:06:0e:80:22:4b:46:30 zone: test_port_zone 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7 1,8 ``` 管理者可能是不小心刪除了 **connect_host** 別名。 ```bash SAN48-112:admin> alidelete "connect_host" SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE; port_testzone cfg: test_port_cfg port_testzone zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A zone: port_testzone connect_host; connect_array alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 alias: connect_array 1,4; 1,5; 1,6; 1,7 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6e 50:06:0e:80:22:4b:46:20 50:06:0e:80:22:4b:46:30 zone: test_port_zone 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7 1,8 ``` 接著想要針對 **HDS_ZONE_CONFIG** 進行重新套用。系統會檢驗相關配置是否沒有問題,若發現問題則不會套用區域組態。 ```bash SAN48-112:admin> echo -e 'y\n' | cfgenable "HDS_ZONE_CONFIG" You are about to enable a new zoning configuration. This action will replace the old zoning configuration with the current configuration selected. If the update includes changes to one or more traffic isolation zones, the update may result in localized disruption to traffic on ports associated with the traffic isolation zone changes Do you want to enable 'HDS_ZONE_CONFIG' configuration (yes, y, no, n): [no] "connect_host" not found SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE; port_testzone cfg: test_port_cfg port_testzone zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A zone: port_testzone connect_host; connect_array alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 alias: connect_array 1,4; 1,5; 1,6; 1,7 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6e 50:06:0e:80:22:4b:46:20 50:06:0e:80:22:4b:46:30 zone: test_port_zone 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7 1,8 ``` 既然找到問題,就把這個已經失去應用的區域相關設定刪除,並重新調整後套用組態。 ```bash SAN48-112:admin> zonedelete "port_testzone" SAN48-112:admin> cfgdelete "test_port_cfg" SAN48-112:admin> cfgremove "HDS_ZONE_CONFIG", "port_testzone" SAN48-112:admin> echo -e 'y\n' | cfgsave WARNING!!! The changes you are attempting to save will render the Effective configuration and the Defined configuration inconsistent. The inconsistency will result in different Effective Zoning configurations for switches in the fabric if a zone merge or HA failover happens. To avoid inconsistency it is recommended to commit the configurations using the 'cfgenable' command. Do you want to proceed with saving the Defined zoning configuration only? (yes, y, no, n): [no] Updating flash ... SAN48-112:admin> SAN48-112:admin> echo -e 'y\n' | cfgenable "HDS_ZONE_CONFIG" You are about to enable a new zoning configuration. This action will replace the old zoning configuration with the current configuration selected. If the update includes changes to one or more traffic isolation zones, the update may result in localized disruption to traffic on ports associated with the traffic isolation zone changes Do you want to enable 'HDS_ZONE_CONFIG' configuration (yes, y, no, n): [no] zone config "HDS_ZONE_CONFIG" is in effect Updating flash ... SAN48-112:admin> SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 alias: connect_array 1,4; 1,5; 1,6; 1,7 Effective configuration: cfg: HDS_ZONE_CONFIG zone: HDS_ZONE 21:00:00:24:ff:20:3d:6e 50:06:0e:80:22:4b:46:20 50:06:0e:80:22:4b:46:30 ``` 最後測試 **`cfgdisable`** 命令,可以觀察到該 SAN 交換器目前並沒有有效的區域組態(Effective configuration)。 ```bash SAN48-112:admin> echo -e 'y\n' | cfgdisable You are about to disable zoning configuration. This action will disable any previous zoning configuration enabled. Do you want to disable zoning configuration? (yes, y, no, n): [no] Updating flash ... SAN48-112:admin> SAN48-112:admin> cfgshow Defined configuration: cfg: HDS_ZONE_CONFIG HDS_ZONE zone: HDS_ZONE ESXi_vmhba2; HDS_CT1_3A; HDS_CT2_4A alias: ESXi_vmhba2 21:00:00:24:ff:20:3d:6e alias: HDS_CT1_3A 50:06:0e:80:22:4b:46:20 alias: HDS_CT2_4A 50:06:0e:80:22:4b:46:30 alias: connect_array 1,4; 1,5; 1,6; 1,7 Effective configuration: no configuration in effect ``` :::success 好囉!簡易的 Zoning 測試就到此為止了!日常任務應該夠用了吧?! ::: # 參考 - [Fabric OS v7.1.0 Command Reference](https://dl.dell.com/manuals/all-products/esuprt_ser_stor_net/esuprt_powerconnect/brocade-m5424_administrator%20guide5_en-us.pdf) - [Fabric OS v7.1.0 Administrator's Guide](https://dl.dell.com/manuals/all-products/esuprt_ser_stor_net/esuprt_powerconnect/brocade-m6505_administrator%20guide2_en-us.pdf) - [Brocade Useful Fabric OS Commands](https://vmarena.com/brocade-useful-fabric-os-commands/) # 附錄 ## VMware vSphere 查詢卡片驅動程式 要確定 HBA 卡的推薦驅動程式,必須使用 **vmkchdev** 命令取得: - 供應商識別碼(Vendor ID, VID) - 設備識別碼(Device ID, DID) - 子供應商識別碼(Sub-Vendor ID, SVID) - 子設備識別碼(Sub-Device ID, SDID): ```bash [root@HDSLAB:~] vmkchdev -l |grep vmhba2 0000:81:00.0 1077:2532 1077:015d vmkernel vmhba2 [root@HDSLAB:~] vmkchdev -l |grep vmhba3 0000:81:00.1 1077:2532 1077:015d vmkernel vmhba3 ``` - VID =1077 - DID =2532 - SVID =1077 - SDID =015d ![](https://i.imgur.com/CVFdXDr.png) ![](https://i.imgur.com/QvHk6hd.png) 使用 VMware 原廠提供的腳本程式,可以快速地列出 ESXi 系統 HBA 卡硬體識別碼資訊。 ```bash [root@HDSLAB:~] for name in `vmkchdev -l | grep vmhba | awk '{print$5}'`;do echo $name ; echo "VID :DID SVID:SDID"; vmkchdev -l | grep $name | awk '{print $2 , $3}';printf "Driver: "; echo `esxcfg-scsidevs -a | grep $name |awk '{print $2}'`;vmkload_mod -s `esxcfg-scsidevs -a | grep $name|awk '{print $2}'` |grep -i version;echo `lspci -vvv | grep $name | awk '{print $1=$NF="",$0}'`;printf "\n";done vmhba0 VID :DID SVID:SDID 8086:8d62 152d:89a4 Driver: vmw_ahci Version: 2.0.11-1vmw.703.0.20.19193900 Mass storage controller SATA controller: Intel Corporation Wellsburg AHCI Controller vmhba1 VID :DID SVID:SDID 8086:8d02 152d:89a4 Driver: vmw_ahci Version: 2.0.11-1vmw.703.0.20.19193900 Mass storage controller SATA controller: Intel Corporation Wellsburg AHCI Controller vmhba2 VID :DID SVID:SDID 1077:2532 1077:015d Driver: qlnativefc Version: 4.1.14.0-26vmw.703.0.20.19193900 Serial bus controller Fibre Channel: QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA vmhba3 VID :DID SVID:SDID 1077:2532 1077:015d Driver: qlnativefc Version: 4.1.14.0-26vmw.703.0.20.19193900 Serial bus controller Fibre Channel: QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA ``` :::info - [Determining Network/Storage firmware and driver version in ESXi (1027206)](https://kb.vmware.com/s/article/1027206) - [Changing the queue depth for QLogic, Emulex, and Brocade HBAs (1267)](https://kb.vmware.com/s/article/1267) ::: [](https://www.youtube.com/watch?v=siyofa2otWw&list=PLe5xhhyFjDPdYsqlPaqT9Ru744TAjUAmF&index=15) [](https://vmarena.com/brocade-useful-fabric-os-commands/) [](https://support.purestorage.com/Solutions/SAN/SAN_Configuration/Introduction_to_Fibre_Channel_and_Zoning) --- # 其他 用命令操作 Brocade SAN 交換器 - [Part1: 基本操作](https://hackmd.io/@farmer87/brocade_learning_01) - [Part2: Zoning 設定](https://hackmd.io/@farmer87/brocade_learning_02) - [Part3: 交換器互連](https://hackmd.io/@farmer87/brocade_learning_03)