I recently had my Comcrap Cable shut off for downloading too much. Apparently, my 'unlimited' service did not protect me at all because I use cable. Basically, since the whole neighborhood shares one main cable connection, if I 'overuse' bandwidth, I am affecting other peoples service too. Its better anyway... AT&T DSL is faster in my dense neighborhood anyway.
The only problem I had to deal with after the switch was getting back into my Server at home. Comcrap uses a dynamic IP, but it only changes once... if ever. AT&T changes your IP several times a week. If I want to access my home machine and the IP has changed, I have no way to do so until I get home. There are services you can pay for that will monitor your external IP and such and such, but I wanted an easier way out. I setup my home machine to send its IP out and store it on another server, then I setup an alias from my laptop to read that server:
On the Home Server (sendip.sh):
|
#!/bin/bash
curl www.whatismyip.com/automation/n09230945.asp > /tmp/homeip.txt
scp /tmp/homeip.txt server_username@example_server:/path/to/homeip.txt
rm /tmp/homeip.txt
|
A cronjob setup on the Home Server:
|
0,15,30,45 * * * * /Content/Other/Scripts/sendip.sh
|
This calls my script every 15 minutes. The script gets the IP from whatismyip.com, writes it to a temp file, sends the temp file to my server and then deletes the temp file. I also setup a alias on my remote machine that reads this file and lets me ssh back home!
|
alias home='ssh home_username@`curl http://example_server.com/path/to/homeip.txt`'
|
I sent my homeip.txt file to a webserver so I use curl to read it, but you can use whatever you want in your alias to read that file.
I hope this helped somebody... there may be better ways but this works and takes 5 lines.
Was this page helpful for you? Buy me a slice of 🍕 to say thanks!
Comments