macOS Sierra: Use a dynamic global hostname
If your service provider supports secure dynamic DNS update (RFC 3007), you can give your Mac a global DNS hostname so other computers outside your local network can refer to it by name.
Even if the IP address for your Mac changes at regular intervals, your Mac automatically updates its global DNS hostname to point to its current IP address.
Choose Apple menu > System Preferences, then click Sharing.
Click Edit, then select “Use dynamic global hostname.”
Enter the hostname, user, and password for the account.
Ask your service provider or domain administrator for the user and password so your Mac can update its hostname every time its address changes.
If your service provider supports Wide-Area Bonjour registrations, you can also select “Advertise services in this domain using Bonjour” to advertise your computer’s active sharing services in its domain.
If Bonjour browsing is enabled for this domain, other computers see the services listed automatically in their apps, based on the Search Domains entered in their Network preferences or based on information returned by DHCP.