此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 RFP 文档使用的语言或引用的第三方产品使用的语言,文档中可能无法确保完全使用非歧视性语言。 深入了解思科如何使用包容性语言。
思科采用人工翻译与机器翻译相结合的方式将此文档翻译成不同语言,希望全球的用户都能通过各自的语言得到支持性的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 Cisco Systems, Inc. 对于翻译的准确性不承担任何责任,并建议您总是参考英文原始文档(已提供链接)。
本文档介绍如何在基于单播的方法中配置本地区域Bonjour并对其进行故障排除。
本文档没有任何特定的要求。
本文档中的信息基于以下软件和硬件版本:
注意:有关在其他思科平台上启用这些功能的命令,请参阅相应的配置指南。
注意:运行Local Area Bonjour需要Cisco DNA Advantage许可证。验证服务发现网关(SDG)代理或服务对等体(SP)模式是否从支持矩阵支持Cisco Catalyst平台,该矩阵可在特定Cisco IOS XE版本的配置指南中找到。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
从Cisco IOS XE Amsterdam版本17.3.2开始,引入了mDNS服务网关的新方法,以替代传统的基于泛洪的实施。这种新方法提供单播模型,并具有以下增强功能:
mDNS查询具有下一条记录:
mDNS响应或通告具有以下记录:
主要区别在于mDNS网关(Cat9k交换机)如何将mDNS通告路由到查询器:
此外,在基于组播的实施中,收到的mDNS数据包会泛洪到允许在其中接收数据包的VLAN的其他端口。
在基于单播的方法中,通过mDNS监听提供泛洪防御机制,该机制为VLAN配置下的每个VLAN配置的mdns-sd网关启用。这样,mDNS数据包将以单播方式发送:
在对mDNS网关进行故障排除时,要确定交换机运行的是基于泛洪的模式还是基于单播的模式,您可以验证在哪里配置了mdns-sd网关。
提供无泛洪服务发现网关有两种设置。使用哪个主要取决于第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. 在交换机间TRUNK端口上配置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代理在其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数据包,并且SDG代理未与mDNS响应方交换,请检查服务策略并确保服务在列表中。
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代理在其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. 验证“服务对等体查询已发送”计数器是否增加。此外,收到的查询响应也在增加。
服务对等体在每个服务查询计时器向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 |
初始版本 |