本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
本文檔介紹如何在基於單播的方法中配置區域網Bonjour並對其進行故障排除。
本文件沒有特定需求。
本文中的資訊係根據以下軟體和硬體版本:
注意:有關用於在其他Cisco平台上啟用這些功能的命令,請參閱相應的配置指南。
注意:要運行Local Area Bonjour,必須提供Cisco DNA Advantage許可證。驗證服務探索閘道(SDG)代理或服務對等體(SP)模式是否從支援矩陣支援Cisco Catalyst平台,可在特定Cisco IOS XE版本的組態指南中找到。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
從Cisco IOS XE阿姆斯特丹版本17.3.2開始,引入了mDNS服務網關的新方法,以替代傳統的基於泛洪的實施。這種新方法提供單播模型,並具有以下增強功能:
mDNS查詢具有下一個「記錄:
mDNS響應或通告具有以下記錄:
主要區別是mDNS網關(Cat9k交換機)如何將mDNS通告路由到查詢器:
此外,在基於組播的實施中,接收的mDNS資料包會被泛洪到允許接收資料包的VLAN的其他埠。
在基於單播的方法中,mDNS監聽提供了泛洪防禦機制,該機制可在VLAN配置下為每個VLAN配置的mdns-sd網關啟用。這樣,mDNS資料包將以單播方式傳送:
當排除mDNS網關故障時,要確定交換機運行的是基於泛洪還是基於單播的模式,您可以驗證配置了mdns-sd網關的位置。
提供無泛洪服務發現網關的設定有2種。使用哪一個主要取決於第3層邊界的位置:
在實驗室中測試mDNS網關配置時,需要解決的一個難題是如何獲取:
使用DNS-SD命令可以完成這2個角色。DNS-SD命令是一種網路診斷工具,使裝置能夠測試mDNS服務發現。最重要的功能是,它可以通告服務的存在以及發現服務。
要通告mDNS服務,請使用以下命令:
dns-sd -R name _app._protocol local port
其中:
示例:節點名稱testpc在TCP埠3000上通告Airplay服務。
dns-sd -R testpc _airplay._tcp local 3000
要查詢mDNS服務,請使用以下命令:
dns-sd -B _app._protocol local
其中:
範例:查詢Airplay服務。
dns-sd -B _airplay._tcp local
1. 全局啟用mDNS網關。
注意:從Cisco IOS XE 17.9.1開始,可以配置SDG代理處理查詢和響應的模式。預設模式為循環,在此模式下,一旦收到來自終端的查詢,預設情況下會定期傳送15秒的響應。另一種模式是按需模式;在此模式下,僅當從終端收到查詢時才傳送響應。按需模式是較早的Cisco IOS XE版本如何處理來自終端的查詢。
mdns-sd gateway
active-query timer 1 <----- Optionally enable Active querying to discover mDNS responders that might not send advertisements periodically.
query-response mode on-demand <----- Sets the response mode to on-demand instead of the default recurring mode (only for 17.9.1 and later releases)
2. 建立位置過濾器
自定義策略中的VLAN間服務路由需要位置過濾器。在這種情況下,要求在VLAN 2455和2481之間進行服務路由,以便將這些VLAN增加到位置過濾器LOCAL-PROXY。
mdns-sd location-filter LOCAL-PROXY
match location-group default vlan 2481
match location-group default vlan 2455
3. 建立允許所關注服務的輸入與輸出服務清單。
注意:出站服務策略中允許的服務與步驟2中定義的位置過濾器關聯。VLAN間服務路由需要此功能。
mdns-sd service-list LOCAL-AREA-SERVICES-IN IN
match airplay
match apple-tv
!
mdns-sd service-list LOCAL-AREA-SERVICES-OUT OUT
match airplay location-filter LOCAL-PROXY
match apple-tv location-filter LOCAL-PROXY
4. 建立服務策略並關聯步驟3中建立的服務清單。
mdns-sd service-policy LOCAL-AREA-SERVICE-POLICY
service-list LOCAL-AREA-SERVICES-IN IN
service-list LOCAL-AREA-SERVICES-OUT OUT
5. 在感興趣的VLAN上啟用單播mDNS網關。
vlan configuration 2455
mdns-sd gateway
service-policy LOCAL-AREA-SERVICE-POLICY
source-interface Vlan2455 <---- This is the source IP address that mDNS packets are going to be send from for this VLAN
!
vlan configuration 2481
mdns-sd gateway
service-policy LOCAL-AREA-SERVICE-POLICY
source-interface Vlan2481 <---- This is the source IP address that mDNS packets are going to be send from for this VLAN
1. 全局啟用mDNS網關。
mdns-sd gateway
source-interface vlan10 <----- This is the IP source that the SDG Agent are going to be use to establish BCP sessions with the Service Peers
2. 建立位置過濾器
自定義策略中的VLAN間服務路由需要位置過濾器。在這種情況下,要求在VLAN 2455和2481之間進行服務路由,以便將這些VLAN增加到位置過濾器LOCAL-PROXY。
mdns-sd location-filter LOCAL-PROXY
match location-group default vlan 2481
match location-group default vlan 2455
3. 建立允許所關注服務的輸入與輸出服務清單。
注意:出站服務策略中允許的服務與步驟2中定義的位置過濾器關聯。VLAN間服務路由需要此功能。
mdns-sd service-list LOCAL-AREA-SERVICES-IN IN
match airplay
match apple-tv
!
mdns-sd service-list LOCAL-AREA-SERVICES-OUT OUT
match airplay location-filter LOCAL-PROXY
match apple-tv location-filter LOCAL-PROXY
4. 建立服務策略並關聯步驟3中建立的服務清單。
mdns-sd service-policy LOCAL-AREA-SERVICE-POLICY
service-list LOCAL-AREA-SERVICES-IN IN
service-list LOCAL-AREA-SERVICES-OUT OUT
5. 在感興趣的VLAN上啟用單播mDNS網關。
vlan configuration 2455
mdns-sd gateway
service-policy LOCAL-AREA-SERVICE-POLICY
!
vlan configuration 2481
mdns-sd gateway
service-policy LOCAL-AREA-SERVICE-POLICY
6. 配置服務對等體組以啟用服務對等體之間的服務路由。
需要增加執行服務路由所需的每個服務對等源IP。
mdns-sd service-peer group
peer-group 1
service-policy LOCAL-AREA-SERVICE-POLICY
service-peer 10.1.1.1 location-group default
service-peer 10.1.1.5 location-group default
7. 在交換機間中繼埠上配置mDNS信任。
此配置不是必需的,但建議埠丟棄入口或出口中的任何mDNS資料包。這是因為在這些連線埠上,不再預期會看到mDNS封包,而是BCP封包。
int range tw1/0/1, tw1/0/19
mdns-sd trust
1. 全局啟用mDNS網關並配置服務對等模式。
mdns-sd gateway
active-query timer 1
mode service-peer
sdg-agent 10.1.1.3 <------ IP address of the SDG Agent
2. 建立位置過濾器
自定義策略中的VLAN間服務路由需要位置過濾器。在這種情況下,要求在VLAN 2455和2481之間進行服務路由,以便將這些VLAN增加到位置過濾器LOCAL-PROXY。
mdns-sd location-filter LOCAL-PROXY
match location-group default vlan 2481
match location-group default vlan 2455
3. 建立允許所關注服務的輸入與輸出服務清單。
mdns-sd service-list LOCAL-AREA-SERVICES-IN IN
match airplay
match apple-tv
!
mdns-sd service-list LOCAL-AREA-SERVICES-OUT OUT
match airplay location-filter LOCAL-PROXY
match apple-tv location-filter LOCAL-PROXY
4. 建立服務策略並關聯步驟3中建立的服務清單。
mdns-sd service-policy LOCAL-AREA-SERVICE-POLICY
service-list LOCAL-AREA-SERVICES-IN IN
service-list LOCAL-AREA-SERVICES-OUT OUT
5. 在感興趣的VLAN上啟用單播mDNS網關。
對於服務對等體10.1.1.1:
vlan configuration 2455
mdns-sd gateway
service-policy LOCAL-AREA-SERVICE-POLICY
對於服務對等體10.1.1.5:
vlan configuration 2481
mdns-sd gateway
service-policy LOCAL-AREA-SERVICE-POLICY
6. 在交換機間中繼埠上配置mDNS信任。
此配置不是必需的,但建議埠丟棄入口或出口中的任何mDNS資料包。這是因為在這些連線埠上,不再預期會看到mDNS封包,而是BCP封包。
對於服務對等體10.1.1.1:
int range tw1/0/1
mdns-sd trust
對於服務對等體10.1.1.5:
int range Gig1/0/1
mdns-sd trust
1. 驗證從SDG代理傳送/接收mDNS查詢。
C9500#show mdns-sd statistics vlan <vlan/interface> | i mDNS|send|received
mDNS Statistics
mDNS packets sent : 5 <---Validate that this number increments in multiple readings.
mDNS packets rate limited : 0
mDNS packets received : 3 <---mDNS queries received and processed by the SDG Agent.
advertisements received : 0
queries received : 3
IPv4 received : 3
IPv4 advertisements received : 0
IPv4 queries received : 3
IPv6 received : 0
IPv6 advertisements received : 0
IPv6 queries received : 0
mDNS packets dropped : 0
2. 驗證SDG Agent在其mDNS快取中是否有播發。
C9500#show mdns-sd cache
mDNS CACHE
=================================================================================================================================
[<NAME>] [<TYPE>] [<TTL>/Remaining] [Vlan-Id/If-name] [Mac Address] [<RR Record Data>]
CXLabs-W10.local A 4500/3717 31 0050.56b3.d162 10.34.41.104
CXLabs-W10.local A 4500/4224 30 0050.56b3.e409 10.34.37.59
_airplay._tcp.local PTR 4500/4472 31 0050.56b3.d162 test31._airplay._tcp.local
test31._airplay._tcp.local SRV 4500/4472 2481 0050.56b3.d162 0 0 3000 CXLabs-W10-3.local
test31._airplay._tcp.local TXT 4500/4472 2481 0050.56b3.d162 (1)''
CXLabs-W10-3.local A 4500/4472 31 0050.56b3.d162 10.34.41.104
3. 驗證已在與mDNS服務關聯的VLAN上啟用了服務策略。
C9500#show mdns-sd service-policy association vlan
========== VLAN policy association =============
VLAN Service-policy
------------------------------------------------
1 LOCAL-AREA-POLICY
2481 LOCAL-AREA-POLICY
2455 LOCAL-AREA-POLICY
4. 驗證mDNS快取服務、查詢器和響應器是否正在通告。
C9500#show mdns-sd statistics cache all
mDNS cache statistics :
Number of service types : 1
Number of records of type PTR : 1
Number of records of type SRV : 1
Number of records of type A : 3
Number of records of type AAAA : 0
Number of records of type TXT : 1
Top service types by instances :
Service type : (count of service instances)
_mirrorp2s._tcp.local : 1 <------Verify the service is display.
Top advertisers of record :
MAC Address : (count of records)
0050.56b3.d162 : 5
0050.56b3.e409 : 1 <-------Verify that interested MACs are mDNS Querier/Responder displays.
5. 如果在快取中看不到條目,則僅接收mDNS資料包,並且沒有向mDNS響應方交換SDG代理,請檢視服務策略並確保該服務在清單中。
C9500#show mdns-sd service-list
Name Type Service Msg-Type Source Location-filter
========================================================================================================================================================
LOCAL-AREA-SERVICES-IN IN all any - - <-- Service list permit all services Inbound Direction
default-mdns-in-service-list IN apple-airprint any - -
IN apple-remote-login any - -
IN apple-screen-share any - -
IN apple-tv any - -
IN apple-windows-fileshare any - -
IN google-chromecast any - -
IN google-expeditions any - -
IN homesharing any - -
IN multifunction-printer any - -
IN printer-ipps any - -
LOCAL-AREA-SERVICES-OUT OUT all any ALL LOCAL-PROXY<-- Service list permit all services Outbound Direction
default-mdns-out-service-list OUT apple-airprint any ALL default-mdns-location-filter
OUT apple-remote-login any ALL default-mdns-location-filter
OUT apple-screen-share any ALL default-mdns-location-filter
OUT apple-tv any ALL default-mdns-location-filter
OUT apple-windows-fileshare any ALL default-mdns-location-filter
OUT google-chromecast any ALL default-mdns-location-filter
OUT google-expeditions any ALL default-mdns-location-filter
OUT homesharing any ALL default-mdns-location-filter
OUT multifunction-printer any ALL default-mdns-location-filter
6. 透過調試來複查mDNS流程。
debug mdns all
1. 驗證服務對等體和SDG代理(保持連線交換)之間是否存在BCP會話。
在服務對等體上:
C9500#show mdns-sd sp-sdg statistics | i Keep|Message Messages sent: Keep-Alive : 69439 <---- Validate that this number increments in multiple readings Messages received: Keep-Alive Response : 69420 <---- Validate that this number increments in multiple readings C9300-2# show udp | i Proto|10991 Proto Remote Port Local Port In Out Stat TTY OutputIF 17 --listen-- --any-- 10991 0 0 2001221 0 17(v6) --listen-- --any-- 10991 0 0 2020221 0
在SDG代理程式上:
C9500# show mdns-sd sp-sdg statistics | i Keep|Message Messages received: Keep-Alive : 138901 <---- Validate that this number increments in multiple readings Messages sent: Keep-Alive Response : 138901 <---- Validate that this number increments in multiple readings
C9500#show mdns-sd sdg service-peer summary ========================================================================================================= Service-Peer/Port Cache-Sync Uptime Record Count Sent Time ========================================================================================================= 10.1.1.5/10991 124 Sep 5 15:24:03 2023 62 Hrs 15 Mins 0 10.1.1.1/10991 360 Sep 5 15:32:03 2023 180 Hrs 7 Mins 0
2. 驗證服務對等體在其mDNS快取中具有通告。
如果在mDNS快取中未發現,請在連線到mDNS響應器的介面中進行資料包捕獲,並驗證終端是否正在傳送有效的mDNS通告。
C9500#sh mdns cache mDNS CACHE ================================================================================================================================= [<NAME>] [<TYPE>] [<TTL>/Remaining] [Vlan-Id/If-name] [Mac Address] [<RR Record Data>] _airplay._tcp.local PTR 4500/4500 2481 0050.56b3.e9c2 PC-vlan2481._airplay._tcp.local PC-vlan2481._airplay._tcp.local SRV 4500/4500 2481 0050.56b3.e9c2 0 0 3000 CXLabs-WIN10.local CXLabs-WIN10.local A 4500/4500 2481 0050.56b3.e9c2 10.24.81.11 PC-vlan2481._airplay._tcp.local TXT 4500/4500 2481 0050.56b3.e9c2 (1)''
3. 驗證服務對等通告傳送計數器是否增加。
每個服務對等體將每個服務通告計時器向SDG代理傳送通告。預設值為30秒。
C9300-2#sh mdns summary Global mDNS Gateway ========================================== mDNS Gateway : Enabled Rate Limit : 60 PPS (default) AirPrint Helper : Disabled Mode : Service-Peer SDG Agent IP : 10.1.1.3 <----- SDG Agent configured Source Interface : Vl10 ANY Query Forward : Disabled Next Advertisement to SDG : 00:00:12 <----- Time left for sending next advertisement to SDG Agent (Default is every 30 seconds) Next Query to SDG : 00:00:12 Active Response Timer : Disabled Active Query Timer : Enabled 1 Minutes mDNS Query Type : PTR only Service Enumeration period : Default SSO : Inactive C9300-2#show mdns-sd service-peer statistics mDNS Packet statistics: Packets received from client : 11560 Queries : 281 IPv4 : 281 IPv6 : 0 Advertisements : 11279 IPv4 : 11279 <---- Validate that this number increments in multiple readings IPv6 : 0 Packets sent to client : 23939 Advertisements : 6 IPv4 : 6 IPv6 : 0 Queries : 23933 IPv4 : 23933 IPv6 : 0 Packets sent to SDG : 110 Queries : 92 Advertisements : 18 <---- Validate that this number increments in multiple readings Packets received from SDG : 0
C9300-2#show mdns-sd sp-sdg statistics One min, 5 mins, 1 hour Average Input rate (pps) : 0, 0, 0 Average Output rate (pps) : 0, 0, 0 Messages sent: Query : 92 ANY query : 0 Advertisements : 18 <---- Validate that this number increments in multiple readings Advertisement Withdraw : 15 Interface down : 0 Vlan down : 0 Service-peer cache clear : 2 Resync response : 365 Srvc Discovery response : 0 Keep-Alive : 71056 Messages received: Query response : 0 ANY Query response : 0 Cache-sync : 395 Get service-instance : 0 Srvc Discovery request : 0 Keep-Alive Response : 71037
4. 驗證SDG Agent在其mDNS快取中是否有播發。
C9500# show mdns cache mDNS CACHE ================================================================================================================================= [<NAME>] [<TYPE>] [<TTL>/Remaining] [Vlan-Id/If-name] [Mac Address] [<RR Record Data>] _airplay._tcp.local PTR 4500/4500 2481 0050.56b3.e9c2 PC-vlan2481._airplay._tcp.local PC-vlan2481._airplay._tcp.local SRV 4500/4500 2481 0050.56b3.e9c2 0 0 3000 CXLabs-WIN10.local CXLabs-WIN10.local A 4500/4500 2481 0050.56b3.e9c2 10.24.81.11 PC-vlan2481._airplay._tcp.local TXT 4500/4500 2481 0050.56b3.e9c2 (1)'' =========================================================================================================================================================================
5. 透過調試來複查mDNS流程。
debug mdns all
1. 驗證服務對等體在其mDNS query-db中是否具有查詢。
如果在mDNS query-db中未發現,請在連線到mDNS查詢器的介面中進行資料包捕獲,並驗證終端是否正在傳送有效的mDNS查詢。
C9300-1#show mdns query-db ------------------------------------------------------------------ Client MAC Vlan ID Location ID User Role ------------------------------------------------------------------ PTR Name: _airplay._tcp.local 0050.56b3.2ec1 2455 Default none
2. 驗證服務對等體和SDG代理(保持連線交換)之間是否存在BCP會話。
C9300-1#show mdns sp-sdg statistics | i Keep|Message Messages sent: Keep-Alive : 71232 <---- Validate that this number increments in multiple readings Messages received: Keep-Alive Response : 71218 <---- Validate that this number increments in multiple readings C9300-1#show udp | i Proto|10991 Proto Remote Port Local Port In Out Stat TTY OutputIF 17 --listen-- --any-- 10991 0 0 2001221 0 17(v6) --listen-- --any-- 10991 0 0 2020221 0
3. 驗證傳送的服務對等查詢計數器是否增加。此外,收到的查詢響應也在增加。
服務對等體每一個service-query-timer都將查詢傳送到SDG代理。預設值為15秒。
C9300-1#show mdns-sd sp-sdg statistics One min, 5 mins, 1 hour Average Input rate (pps) : 0, 0, 0 Average Output rate (pps) : 0, 0, 0 Messages sent: Query : 608 <---- Validate that this number increments in multiple readings ANY query : 0 Advertisements : 2 Advertisement Withdraw : 0 Interface down : 0 Vlan down : 0 Service-peer cache clear : 6 Resync response : 0 Srvc Discovery response : 0 Keep-Alive : 71192 Messages received: Query response : 178 <---- Validate that this number increments in multiple readings ANY Query response : 0 Cache-sync : 395 Get service-instance : 0 Srvc Discovery request : 0 Keep-Alive Response : 71178
4. 驗證SDG代理程式是否正在傳送廣告作為回應。
C9500#show mdns sp-sdg statistics One min, 5 mins, 1 hour Average Input rate (pps) : 0, 0, 0 Average Output rate (pps) : 0, 0, 0 Messages received: Query : 704 ANY query : 0 Advertisements : 19 Advertisement Withdraw : 15 Interface down : 0 Vlan down : 0 Service-peer cache clear : 8 Resync response : 366 Srvc Discovery response : 0 Keep-Alive : 142377 Messages sent: Query response : 191 <---- Validate that this number increments in multiple readings ANY Query response : 0 Cache-sync : 791 Get service-instance : 0 Srvc Discovery request : 0 Keep-Alive Response : 142377
5. 透過調試來複查mDNS流程。
debug mdns all
show running-config mdns-sd
show mdns-sd summary
show mdns-sd service-policy association vlan
show mdns-sd service-policy association role
show mdns-sd statistics all
show mdns-sd statistics debug
show mdns-sd cache all
show mdns-sd query-db
show mdns-sd statistics cache all
show mdns-sd service-peer statistics
show mdns-sd sp-sdg statistics
show mdns-sd sdg service-peer summary
show mdns-sd controller summary
show mdns-sd controller detail
show mdns-sd controller statistics
show mdns-sd controller export-summary
show tech-support mdns-sd
debug mdns-sd all
修訂 | 發佈日期 | 意見 |
---|---|---|
1.0 |
05-Apr-2024 |
初始版本 |