So I’ve never bothered to get a static IP address from my ISP.. this makes it a bit of a challenge when wanting to access files from work, that are sitting on my home pc.
However.. I do have a website hosted elsewhere..
So what I have done (actually for about 15 years now).. is run a little scheduled task on my home PC, that obtains it’s IP address, creates a little web page, and FTPs that page to the website. Then, I can access the website and link to my home PC. The odd time I want to make a slight change to this, I have to relearn what I’ve done.. So I’m writing it up here finally…in case I actually remember to check here 😉
Its changed a little over the years.. pending my ISP, and changes to how I connect to them. These days I have a router connected to them.. So my home PC never actually gets the external IP address assigned.
SO.. it takes a mapping in my router to forward the requests to the static LAN IP, and it also take a little trick to find out what the external IP address is..
Here is the script I use to do that:
set "header=^<head^>^<body^>^<a href=http://"
set "footer=^>my place^</a^> update at: %DATE% %TIME% ^</body^>^</head^>"
FOR /F "tokens=1 delims=" %%A in ('call wget -q -O - http://myexternalip.com/raw') do SET ip=%%A
echo.%header%%ip%%footer% > linkhome.html
FTP -v -i -s:ftpscript.txt
The website I use has changed a couple times (they seem to come and go).. but this one is working great right now (myexternalip.com).
I also use wget, which is just a handy thing to obtain websites as a file for parsing.
The only other thing is serving it up. For this, I use Apache. I set it up to have an alias to the folder I want to allow access to, and enforce authentication based on a specific local user.
The funny thing is that trying to access it within my LAN (ie. from my other PC), won’t work using the external IP address.. (it will if I just use the local machine name / lan ip address).. but it works fine when coming externally.