The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This document describes how to configure and troubleshoot Local Area Bonjour in the unicast-based approach.
There are no specific requirements for this document.
The information in this document is based on these software and hardware versions:
Note: Consult the appropriate configuration guide for the commands that are used in order to enable these features on other Cisco platforms.
Note: Cisco DNA Advantage License is required to run Local Area Bonjour. Validate that the Cisco Catalyst platform is supported in Service Discovery Gateway (SDG) Agent or Service Peer (SP) mode from the support matrix, which can be found in the configuration guide for the specific Cisco IOS XE version.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
Starting from Cisco IOS XE Amsterdam Release 17.3.2, a new approach of mDNS Service Gateway was introduced to replace the traditional flood-based implementation. This new approach provides a Unicast model with the next enhancements:
An mDNS query have the next Record:
An mDNS response or advertisement have the next records:
The key difference is how the mDNS gateway (Cat9k switch) routes the mDNS advertisement to the queriers:
Additionally, in the multicast-based implementation, received mDNS packets are flooded to other ports that allow the VLAN in which the packet was received.
In the unicast-based approach, a flooding prevention mechanism is provided by mDNS snooping, which is enabled for every VLAN configured mdns-sd gateway under VLAN configuration. This way, mDNS packets are going to be sent in a unicast fashion:
When troubleshooting an mDNS gateway, to identify if the switch is running flood-based or unicast-based mode, you can verify where mdns-sd gateway is configured.
There are 2 types of setups to provide a flood-free Service Discovery Gateway. Which to use depends mostly on where is the Layer 3 boundary:
One of the struggles when testing mDNS gateway configurations in the lab is finding out how to get:
These 2 roles can be accomplished using DNS-SD command. The DNS-SD command is a network diagnostic tool that enables a device to test mDNS Service Discovery. The most important function is that it can advertise the existence of a service as well as to discover it.
To advertise an mDNS service, use the next command:
dns-sd -R name _app._protocol local port
Where:
Example: Node name testpc advertising Airplay service on TCP port 3000.
dns-sd -R testpc _airplay._tcp local 3000
To query for an mDNS service, use the next command:
dns-sd -B _app._protocol local
Where:
Example: Querying for Airplay service.
dns-sd -B _airplay._tcp local
1. Enable mDNS gateway globally.
Note: Starting on Cisco IOS XE 17.9.1, the mode in which the SDG Agent handles queries and responds can be configured. The default mode is recurring, in this mode once a query is received from endpoints, a response is sent at regular intervals of 15 seconds by default. The other mode is on-demand; in this mode, a response is sent only when a query is received from the endpoints. On-demand is how earlier Cisco IOS XE versions would handle the queries from endpoints.
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. Create a location filter
A location filter is required for inter-VLAN service routing in custom policies. In this specific case, Service routing between VLANs 2455 and 2481 is required so those VLANs are added to the location filter LOCAL-PROXY.
mdns-sd location-filter LOCAL-PROXY
match location-group default vlan 2481
match location-group default vlan 2455
3. Create an inbound and outbound service list that permits the services of interest.
Note: The services permitted in the outbound service-policy are associated with the location-filter defined in step 2. This is required for inter-VLAN service routing.
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. Create a service policy and associate the service lists created in step 3.
mdns-sd service-policy LOCAL-AREA-SERVICE-POLICY
service-list LOCAL-AREA-SERVICES-IN IN
service-list LOCAL-AREA-SERVICES-OUT OUT
5. Activate unicast mDNS gateway on VLANs of interest.
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. Enable mDNS gateway globally.
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. Create a location filter
A location filter is required for inter-VLAN service routing in custom policies. In this specific case, Service routing between VLANs 2455 and 2481 is required so those VLANs are added to the location filter LOCAL-PROXY.
mdns-sd location-filter LOCAL-PROXY
match location-group default vlan 2481
match location-group default vlan 2455
3. Create an inbound and outbound service list that permits the services of interest.
Note: The services permitted in the outbound service-policy are associated with the location-filter defined in step 2. This is required for inter-VLAN service routing.
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. Create a service policy and associate the service lists created in step 3.
mdns-sd service-policy LOCAL-AREA-SERVICE-POLICY
service-list LOCAL-AREA-SERVICES-IN IN
service-list LOCAL-AREA-SERVICES-OUT OUT
5. Activate unicast mDNS gateway on VLANs of interest.
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. Configure a Service Peer group to enable service routing between Service Peers.
It is needed to add each of the Service Peers source IP that it is needed to perform Service Routing.
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. Configure mDNS trust on inter-switch trunk ports.
This configuration is not mandatory but it is recommended so that the port drops any mDNS packet in either ingress or egress. This is because on these ports it is no longer expected to see mDNS packets but rather BCP packets.
int range tw1/0/1, tw1/0/19
mdns-sd trust
1. Enable mDNS gateway globally and configure Service Peer mode.
mdns-sd gateway
active-query timer 1
mode service-peer
sdg-agent 10.1.1.3 <------ IP address of the SDG Agent
2. Create a location filter
A location filter is required for inter-VLAN service routing in custom policies. In this specific case, Service routing between VLANs 2455 and 2481 is required so those VLANs are added to the location filter LOCAL-PROXY.
mdns-sd location-filter LOCAL-PROXY
match location-group default vlan 2481
match location-group default vlan 2455
3. Create an inbound and outbound service list that permits the services of interest.
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. Create a service policy and associate the service lists created in step 3.
mdns-sd service-policy LOCAL-AREA-SERVICE-POLICY
service-list LOCAL-AREA-SERVICES-IN IN
service-list LOCAL-AREA-SERVICES-OUT OUT
5. Activate unicast mDNS gateway on VLANs of interest.
For Service Peer 10.1.1.1:
vlan configuration 2455
mdns-sd gateway
service-policy LOCAL-AREA-SERVICE-POLICY
For Service Peer 10.1.1.5:
vlan configuration 2481
mdns-sd gateway
service-policy LOCAL-AREA-SERVICE-POLICY
6. Configure mDNS trust on inter-switch trunk ports.
This configuration is not mandatory but it is recommended so that the port drops any mDNS packet in either ingress or egress. This is because on these ports it is no longer expected to see mDNS packets but rather BCP packets.
For Service Peer 10.1.1.1:
int range tw1/0/1
mdns-sd trust
For Service Peer 10.1.1.5:
int range Gig1/0/1
mdns-sd trust
1. Validate that send/receive the mDNS query from the SDG Agent.
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. Validate that the SDG Agent has the advertisement in its mDNS cache.
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. Validate the service-policy is enabled on the VLAN associated with the mDNS service.
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. Validate mDNS cache service, querier, and responder are advertising.
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. If entry is not seen on the cache, only mDNS packets are received and there is not an exchange of the SDG Agent towards mDNS responder, review the service policy and make sure the service is on the list.
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. Take debugs to review the mDNS process.
debug mdns all
1. Validate that there is a BCP session between the Service Peer and the SDG Agent (Keep-Alive exchange).
On Service Peer:
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
On SDG Agent:
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. Validate that the Service Peer has the advertisement in its mDNS cache.
If not seen in mDNS cache, take a packet capture in the interface connected to the mDNS responder and validate the endpoint is sending valid mDNS advertisements.
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. Validate that the Service Peer advertisement sent counter is increasing.
Each Service Peer send the advertisements to the SDG Agent every service-announcement-timer. The default is 30 seconds.
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. Validate that the SDG Agent has the advertisement in its mDNS cache.
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. Take debugs to review the mDNS process.
debug mdns all
1. Validate that the Service Peer has the query in its mDNS query-db.
If not seen in mDNS query-db, take a packet capture in the interface connected to the mDNS querier and validate the endpoint is sending valid mDNS queries.
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. Validate that there is a BCP session between the Service Peer and the SDG Agent (Keep-Alive exchange).
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. Validate that the Service Peer query sent counter is increasing. Also, the query response received is increasing.
The Service Peer sends the queries to the SDG Agent every service-query-timer. The default is 15 seconds.
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. Validate that the SDG Agent is sending an advertisement in response.
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. Take debugs to review the mDNS process.
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
Revision | Publish Date | Comments |
---|---|---|
1.0 |
05-Apr-2024 |
Initial Release |