microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.02k stars 399 forks source link

DNSService not adding local IP to DNS list as the first server in IPv6 scenario #867

Open sea1jxr opened 6 years ago

sea1jxr commented 6 years ago

I have a local 1 node service fabric cluster running ver 6.0.219.9494. When my service is up and running the relevent parts of my ipconfig /all looks like

   IPv4 Address. . . . . . . . . . . : 10.125.148.62(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.254.0
   Lease Obtained. . . . . . . . . . : Monday, November 13, 2017 5:35:48 PM
   Lease Expires . . . . . . . . . . : Friday, November 17, 2017 12:36:03 PM
   Default Gateway . . . . . . . . . : fe80::21e:f6ff:fe44:8000%9
                                       10.125.148.1
   DHCP Server . . . . . . . . . . . : 10.222.118.112
   DHCPv6 IAID . . . . . . . . . . . : 38277071
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1F-28-42-66-48-0F-CF-61-E6-99
   DNS Servers . . . . . . . . . . . : 2001:4898::1050:1050
                                       2001:4898::1050:5050
                                       10.125.148.62
                                       10.50.50.50
                                       10.50.10.50

As you can see that my machine address is 10.125.148.62, and is added as the third entry on the DNS Servers list after the IPv6 DNS servers. a lookup on the machine can't find the domain

nslookup -type=all service1.myfabricservices
Server:  UnKnown
Address:  2001:4898::1050:1050

*** UnKnown can't find service1.myfabricservices: Non-existent domain

A lookup directly to my machine works

nslookup -type=all service1.myfabricservices 10.125.148.62
Server:  UnKnown
Address:  10.125.148.62

service1.myfabricservices text =

"Https://localhost:11443/"
service1.myfabricservices internet address = 127.0.0.1
service1.myfabricservices SRV service location:
          priority       = 0
          weight         = 0
          port           = 11443
          svr hostname   = service1.myfabricservices
(root)  ??? unknown type 41 ???

Is there a way to get the DNSService to add the self address to the DNS list before the IPv6 DNS Servers? Is there another solution?

milvuko commented 6 years ago

Hi @sea1jxr, this is a bug in ServiceFabric. DnsService is not handling properly scenarios where there is an IPv6 address in the DNS chain. Essentially, IPv6 is preferred over IPv4 so the IPv4 address of the node is not the first IP address in the DNS chain. To work around the issue, you can try disabling TCP/IPv6 on the adapter in question (uncheck the "Internet Protocol Version 6 (TCP/IPv6)" box in the adapter properties. That should remove all IPv6 addresses from the DNS chain, which will result in IPv4 address of the node being the first address in the DNS chain.

sea1jxr commented 6 years ago

Thanks, I am only running IPv6 in my development environment so I workaround it there by using "localhost" for the host name. I use dns in production. It would be great to get a fix so I can clean up this code.

ninzavivek commented 6 years ago

Hi @sea1jxr, I am in process of validating a mitigation [using IPv6 address of the host machine and adding that to the DNS server chain of the preferred adapter at index 0 instead]. Based on the testing results we might consider adding to our product logic also.