How to remotely connect Macs across different networks? I'm trying to connect two Macs that are not in the same Wi-Fi network.
I'd like to use terminal instead of available Remote Desktop programs.

My remote Mac had already all the preferences active in "sharing" prefs.
Problem is... while I can do that from the same network using 

open vnc://name.IpAddress


But I have no idea how to do that from different networks. I'd like to be able not only to enter the remote Mac, but also see the screen.

I do have full control over the hardware and software from beginning to end. The Mac will never have a monitor attached and runs my scripts and my software only. I buy the hardware, install my software, and ship. I am able to have the machine connect to their Wi-Fi so that I have all the system info needed uploaded to the database. Like local IP address... and basically everything I tell the script to do. 

How can I remotely connect to the Mac from a different network ?
Assuming you have a central and stationary management unit (a Mac) and several remote Macs (1:n relationship), I would choose an inverted VPN-approach:


Set up a VPN-server on your central Mac. The network address of the VPN-net mustn't collide with local network addresses. Port-forward all necessary ports to your Mac on your local router. Depending on your Internet service provider and your Internet connection get a dynamic DNS-address.
Set up VPN-clients on the remote Macs and connect them to your central VPN-server. The clients mustn't route all traffic via the VPN-connection.
Enable Screen Sharing on the clients
Connect "locally" with your VNC-app.




Since the question misses some details (e.g. macOS versions/number of remote Macs/safety rules in the remote networks/24-7 service/Internet &amp; network stability locally and remote etc.), I can't answer the question in all its particulars.