My current situation (if I wish to continue saving a few bucks by sharing a broadband line) forces me to operate a server through my landlord's router. All I did on the router was set the DMZ of the router to the IP of my server, so that any network traffic that is not specifically routed elsewhere by the router gets sent to my server.
Having found no way of extracting the public IP from the router, I am left with one option: dynamic DNS services that permit (do not penalize) regular polling. The highest profile service of this type is dyndns.com, however I have found that their service does not respond to clients in China. In fact, the only viable option I have found so far is 88ip.cn, which as you can see is a 100% Chinese site. So far it works very well for me though.
First click on 注册 and register an account on the site. Once logged in (the 登录 button) click on the 管理 button to access the "domains" area. There you get to select a sub-domain of 88ip.net, ie. "anything.88ip.net", then click on 确定. After that, selected domains should appear in the 地名 list. And that is about all you have to know about the website.
Setting up the client side on your server is a little more complicated, and definitely not well documented, at least for Linux users. They have a number of clients on offer for download. They offer three different Linux downloads, none of them a Debian .deb, and one of them even wanted to install a binary!! (A big no-no, especially in China.....) I will document what I believe to be the best client setup below, so you do not have to mess with their messy installers. First create the following /etc/ddns/xml/upddns.xml file (depending on your browser, you may have to "view source" to see the following file):
ActiveTestReq 1.0 your88ipUsername your88ipPassword
Username and password above should be the same as used to login to their website. Now create a small script /etc/ddns/sh/upddns.sh to ping 88ip.cn's server:
/usr/bin/curl -v -d "`cat /etc/ddns/xml/upddns.xml`" \
Note the reference above to /etc/ddns/xml/upddns.xml. Note that if you run this script from the command line, there is output, but there is no output if it is run in cron. I do not really understand this difference at the moment. And finally, create a cron job ("crontab -e") to run the script every five minutes:
0-59/5 * * * * /etc/ddns/sh/upddns.sh
88ip.cn's scripts actually were set to make this cron run every two minutes, but I think that is a bit excessive for my purposes. There is no output from this cron, so you will only see an e-mail if there is an error.
Now if you point your browser to your "anything.88ip.cn" URL, it should be directed to a web server running on your server. Since 88ip.cn's interface does not specify a URL, we can assume that all URLs in a given 88ip.cn account will be pointed to the same IP address.
You already have a broadband internet account at home, you have some unused hardware laying around, you know how to setup and configure a server, so why not save a few bucks and run your server at home?:
So if you are not intending on using an e-mail server on your server at home, and whatever service(s) you were planning on providing (website?) can absorb a little downtime from power and ISP outages, it is a go. Especially if you want to run some very particular software that is not commonly available from cheap hosting services, leaving you with the relatively more expensive option of renting your own server.
Dynamic DNS is really very simple. Computers understand numeric IP ("Internet Protocol") addresses of the form 111.222.333.444. Humans understand alphanumeric internet addresses of the form www.myname.com. When you type www.myname.com into your web browser (or any other network application) www.myname.com must be pointing at the correct 111.222.333.444 for it to work. That is all DNS ("Domain Name Service") really is. "Dynamic DNS" just refers to the situation where the numeric IP address changes frequently, and the slightly specialized methods used to keep www.myname.com and 111.222.333.444 in sync when this is the case.
In your home, you will be faced with two general options:
Why would you want the added complication of the second option? Because somewhere on your network you must run a piece of software that will update www.myname.com with the new 111.222.333.444 whenever the latter changes. That piece of information is a property of the network interface that is directly connected to the internet, located on your router. If you are using a commercial off-the-shelf router, that information can be hard or impossible to extract from it. Some routers are pre-configured to talk to certain Dynamic DNS providers, and maybe some of them actually work in this role. I have so far not been so lucky as to find one that does. If the router is your own machine, whose hardware and software you have complete control of, everything tends to be a bit easier.
That said, if you are sharing an internet connection, you might not have a choice in the router department.....
Just to be clear, while probably achieving the opposite, the usual way to tell your Dynamic DNS service that you have a new numeric IP address is to send it a very simple message using http, and that message AUTOMATICALLY must contain your current public IP address (your new numeric address). The Dynamic DNS service then just strips this new IP out of the message. The complication is, most Dynamic DNS services do not want you to waste their resources by sending them this http message every two minutes. Most will freeze your account if you do. They want to hear from you only when the address really has changed, which is why the Dynamic DNS software client running on your network must know when your IP address changes, so that it then will know it is time to tickle the Dynamic DNS service provider.