Address Yun beyond local router

This is probably a basic networking question, but I am new to networking.

I can address my Yun at xxx.local or 192.168.1.x but how do I connect to it when it is connected to a WiFi router across town or 1000 miles away? Do I use its MAC address? Just how do I do that?

You need to configure your router and open ports you need to connect to your Yun. Opening ports means that you allow external connections to a specific port and forward them to a device inside the local network.

Once you configure the router you can access to your Yun through the router's public IP.

Can I have a Yun controlled box that for example measures water temperature, and connect it to a marina's WiFi using their WiFi ssid and password. Then connect to the Yun from my home PC across town to read water temperature at the marina, all without having to configure the marina's router?

In my case I actually need minimal 2-way communication so in the example I would have to be able to send a signal from my home PC to turn on a light on the Yun when fishing is expected to be good.

There are some services that allows you to do that. I never tried any of those but I heard about Yaler and Spacebrew.

SherpaDoug: Can I have a Yun controlled box that for example measures water temperature, and connect it to a marina's WiFi using their WiFi ssid and password. Then connect to the Yun from my home PC across town to read water temperature at the marina, all without having to configure the marina's router?

You're going to have trouble with a scheme like this. The easiest way (but not necessarily secure) is to update the router in front of the Yun so that it opens a port such that incoming connections on that port get routed to the Yun. In your case, that will require updates to the marina's router: odds are you don't have that access, and the marina personnel are not going to want to open a port on their router and introduce a potential security risk.

The work-around to this is to have both the Yun and your PC connect to a server that acts as a store and forward intermediary. Basically, the Yun periodically reads water temperature and sends it to the server, and then reads the desired light status and controls the output accordingly. Your PC connects to the same server to read the water temperature and set the desired light status.

If you have access to an appropriate server you could code something like this yourself. But there are already services out there that handle this. SpaceBrew is one such service, I'm sure Temboo can do something similar.

If you want to log historical data and be able to see more than the current temperature, you can use a cloud data service. There are several, one I've used is ThingSpeak.com which not only would allow the Yun to log data, but also allows you to use your computer to send messages (or even tweets) back to the Yun to control the light. It has some powerful features that aren't too hard too implement, and I'm sure there are other cloud data services that can do much the same.