Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDS adds backslash (\) character and .local when the hostname is represented by IP address #76

Open
z-krejsa opened this issue Oct 26, 2022 · 7 comments

Comments

@z-krejsa
Copy link

z-krejsa commented Oct 26, 2022

Our server sends responses to mDNS query, see the attached picture ...
image

As can be seen the name is represented by IP address. The LDS server receives and parses this response and adds it to the list of discovered servers.
When the OPC client (Unified Automation UA Expert) asks the LDS server for ServersOnNetwork, it returns our OPC UA server, but the DiscoveryUrl string in not correct. We would assume "opc.tcp://192.168.0.50:4840", but the created string is a little bit different with added '' and ".local" ... "opc.tcp://192\.168\.0\.50.local.:4840".
image

It seems to me like a problem in the LDS server, but I'm not 100% sure. Can you tell me, where's the source of the problem and how to fix it, please?

@erhardgrishaber
Copy link
Contributor

@z-krejsa: If I understand it correctly: Your OPC-UA Server is registering to the mDNS Server and not the LDS-ME Server.
In this case, from OPC-UA spec v1.04 chapter 6.2.5: "The mDNS specification requires that fully qualified domain name be announced on the network. If a Server is not configured with a fully qualified domain name then mDNS requires
that the ‘local’ top level domain be appended to the domain names."
This means that you either register to the mDNS with fully qualified domain name (like myhost.mycompany.com) or hostname appended with ".local." (like myhostname.local.). Do not register with IP addresses.
I recommend that your OPC-UA Server to register to the LDS-ME Server and let the discovery server do the job for you.

@erhardgrishaber
Copy link
Contributor

@z-krejsa Extra info: The port 4840 is reserved for the LDS-ME. So try not to used it for your own Server.

@z-krejsa
Copy link
Author

z-krejsa commented Nov 1, 2022

Thanks for you fast response. I'll try to describe in more details my experience ...

Our device is an embedded device with simple RTOS operating system, just one OPC UA server is running there. In that case the device don't need a LDS-ME server, just need to implement the mDNS Responder functionality as can be seen in the "Hosts without a LocalDiscoveryServer" chapter of the OPC UA standard.

I did following investigation with the FQDN (Fully Qualified Domain Name) and hostname...

When I use just hostname ("simocode001"), the resulted DiscoveryUrl is "opc.tcp://simocode001.local.:4840". But this DiscoveryUrl doesn't work, the additional "." (dot) after local is a problem. If I use the DiscoveryUrl without the dot, it works, the UAExpert OPC UA client is able to connect to the OPC UA server running on our embedded device. Do you know where's the problem? As I can see from the Wireshark logs, when there's not the final dot, our device responds to mDNS query, but it doesn't reply to dot finished string? What's correct ".local" or ".local."? As written in the OPC UA standard chapter 6.2.5, mDNS requires that the ‘local’ top level domain be appended to the domain names. The mDNS module from lwIP stack doesn't process the mDNS query with dot.

The second test was with FQDN of "simocode001.siemens.com", the resulted DiscoveryUrl produced by the OPC Foundation LDS-ME server is "opc.tcp://simocode001\.siemens\.com.local.:4840". Why there are the added slashes? And why there's the ".local" at the end, even when it's the FQDN?

Regarding the TCP port 4840 ... as I know it's a general port for OPC UA communication, not just for LDS-ME. It's a common port used in all the OPC UA servers which I know. So why should I use another port?

@erhardgrishaber
Copy link
Contributor

@z-krejsa : Please read the closed issue: #67 Maybe it helps.
It is intentionally with ".local." It works like this for many years. For mDNS module, LDS-ME uses dnssd from Apple.
My UaExpert (v1.6.2) can resolve and connect
to the discovery url returnd by the FindServersOnNetwork. See screenshot below.
UaExpert_LDS

For FQDN it should not append the .local. to the name. When LDS does the registration the FQDN has been tested and it worked properly. The usecase that you described (the registration is done by a different entity) needs to be tested locally to give an exact answer.

Question: Can you ping the following from the machine where you have UaExpert ?: a) simocode001 b) simocode001.local c) simocode001.local.

@erhardgrishaber
Copy link
Contributor

@z-krejsa This info might help: https://www.rfc-editor.org/rfc/rfc6762#section-3
It describes that for MDNS, the ".local." needs to be added to the hostname. So with the "." in the end.

@erhardgrishaber
Copy link
Contributor

@z-krejsa In OPC-UA Spec v1.04 Part 12 there is an example using FQDN. Event in this case, a "." is added in the MDNS message hotstname. See screenshot below:
UaExpert_LDS2

@z-krejsa
Copy link
Author

z-krejsa commented Nov 4, 2022

I did following tests with pinging ...

  • ping simocode003 - works. Strange for me is, that name in the query is "simocode003.local"
    image
    image

  • ping simocode003.local - works correctly
    image
    image

  • ping simocode003.local. - doesn't work. The mDNS query is simocode003.local, without the final dot. The device respond correctly, but the ping itself was not raised
    image
    image

Do you have any explanation for that behavior?

When I tried to use FQDN name and called ping simocode003.siemens.com , even no mDNS query was send

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants