ESP8266 set dns

I have a problem with WiFiClientSecure, it can’t make a connection to HTTPS and HTTP servers (port 443 and 80). I know that I have to set the DNS server IP, however, since we have many nodes that connect to a router, dedicating a static IP for each one is not a good solution. All of them have the same code and the IP must be set dynamically by the router. The point is, I want to set the DNS server IP manually but there is not such a command for this purpose.
I’ve read about the Arduino WiFi shield and it has a command to set one or two DNS servers without setting static IP. I want to know how to set the dns server like “Wifi Shield”?!!

Example:
WiFi.setDNS(dns1); or WiFi.setDNS(dns1, dns2);

So does your router provide a DHCP server? If yes, this already distributes an IP to each node and pretty much always also the DNS server of the network (aka, your router).