|
/Admin/dynamicDNS:
Dynamic DNS Behind a Router in China
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[1] 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[2], 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[4]. 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`" \
http://link.dipserver.com/elink/elink.dll/
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.
[1] http://en.wikipedia.org/wiki/Demilitarized_zone_(computing)
[2] http://www.dyndns.com/
[3] http://www.88ip.cn/
[4] http://www.88ip.cn/Download/
posted at: 08:17 | path: /Admin/dynamicDNS | permanent link to this entry