The best way to go about doing this is with a system like No-Ip, I use this personally on my MediaPC here at the home. This automatically updates your IP when it changes to no-ip's system and sets the subdomain there to your new IP.
The initial account is free to setup, and some routers actually have no-ip in their config, so no need for software on PC.
Now for software on PC they do offer Daemon based software:
Init.d startup script not working for No-IP
I had set this up myself as well. You can download their software from here:
Then setup the Daemon upstart script as I did in the post above and all works perfect at startup. I have it checking every 10 minutes myself.
The other thing that needs to be done is you need to go into your Modem or Router (depending on your ISP) and set Port Forwarding. For instance I use plex on my Media PC. So to connect from the outside I have to tell my router to forward port
32400 which is the plex default port to XXXX port on the outside world. I use another port than
32400 so it's not default.
This Port Forwading is crucial as it allows incoming access from the outside of our Router through the ISP.
Now for most Routers they do not have a
* for port forwarding, you must do each port manually. They do this for security, the only real way to allow all ports is set your Router up with no firewall or on some routers DMZ zones will allow all port forwarding, other routers it does not, it only disables filtering. You would need to check your routers manual to know if DMZ allows all port forwarding for your model.
A few links on setting up basic port forwarding for a router.
Now a quick solution is in some routers they will allow port ranges, for this you would enter port 1 as the first port and 65534 as the end range, this would allow ALL ports to forward to X ip address from the outside. This is again on some routers only, the cheaper ones or routers locked down by your ISP will only allow single port forwards.
Once changes are done most routers do require you to restart your router for changes to take effect, most new routers will ask you to do this and restart using software. If not you must unplug your router for a few seconds then plug back in after saving changes.