“UbuntuHelp:DynamicDNS”的版本间的差异
来自Ubuntu中文
小 |
(→Dynamic DNS) |
||
第23行: | 第23行: | ||
Try first to find out if your modem/router supports Dynamic DNS reporting/notification/updating. If your modem has a built-in 'website' you may find the necessary information by entering its IP address into your browser, for example http://10.1.1.1/ or http://192.168.01/ | Try first to find out if your modem/router supports Dynamic DNS reporting/notification/updating. If your modem has a built-in 'website' you may find the necessary information by entering its IP address into your browser, for example http://10.1.1.1/ or http://192.168.01/ | ||
However, even if your modem/router does support dynamic DNS reporting, there are cases where you will need to use the second approach: perhaps you modem/router is too old, or perhaps you want the DNS entry to follow your *computer* around, rather than stay with your DSL/Cable connection. | However, even if your modem/router does support dynamic DNS reporting, there are cases where you will need to use the second approach: perhaps you modem/router is too old, or perhaps you want the DNS entry to follow your *computer* around, rather than stay with your DSL/Cable connection. | ||
+ | |||
== Using your Computer to perform Dynamic DNS Notification == | == Using your Computer to perform Dynamic DNS Notification == | ||
There are several alternatives. You may need to add the Ubuntu Universe to your set of software repositories. See [[UbuntuHelp:InstallingSoftware|InstallingSoftware]] for all the details. | There are several alternatives. You may need to add the Ubuntu Universe to your set of software repositories. See [[UbuntuHelp:InstallingSoftware|InstallingSoftware]] for all the details. |
2008年11月25日 (二) 00:42的版本
点击翻译: |
English |
请不要直接编辑翻译本页,本页将定期与来源同步。 |
Parent page: Internet and Networking
目录
Dynamic DNS
Every computer which is attached to the internet has an IP address. DNS is the process of relating a name to an IP address so that a website or other service can be accessed using an easily-remembered named (like 'www.google.com'), rather than a number (like '192.168.0.1'). Most servers on the internet have a fixed IP address that never changes. This means that a 'static' DNS record can be set once such that it always redirects the DNS name to right place. However, most home users will be assigned a dynamic IP address that will change periodically, or each time they connect to the internet. In the past this made it very difficult to make a home computer accessible from the broader Internet. But with an increasing number of "Dynamic DNS" service providers, this is not such a problem. Dynamic DNS services offer you a DNS entry with a hostname of your choice. You are then responsible for updating the DNS entry whenver your IP address changes. This pages gives details about how to do that.
Registering with a Dynamic DNS provider
Dynamic DNS requires that a server somewhere on the internet keep track of 'where you are'. That is, it records your host name, and records what the IP address is that corresponds to your hostname. Many Dynamic DNS provider offer a free service with a limited range of hostnames to choose from. Paid services will permit a larger selection of hostnames, including use of your own registered domain name. So before you can get started using Dynamic DNS, you'll need to register with one of these such services. Here is a selection:
- dyndns.com
- no-ip
- zoneedit
- easy DNS
- Afraid.org (free)
Upon registering, you will be provided with username and password, as well a hostname that you will be using as the DNS name that will allow external access to your machine.
Set up DNS Notification
Now that you have a DNS provider, you need to set up a way that your IP address will be updated whenever it is changed. There are two ways of doing this:
- using the built-in capabilities of your Cable/DSL modem or Router
- using dynamic DNS software that you install on your computer
Try first to find out if your modem/router supports Dynamic DNS reporting/notification/updating. If your modem has a built-in 'website' you may find the necessary information by entering its IP address into your browser, for example http://10.1.1.1/ or http://192.168.01/ However, even if your modem/router does support dynamic DNS reporting, there are cases where you will need to use the second approach: perhaps you modem/router is too old, or perhaps you want the DNS entry to follow your *computer* around, rather than stay with your DSL/Cable connection.
Using your Computer to perform Dynamic DNS Notification
There are several alternatives. You may need to add the Ubuntu Universe to your set of software repositories. See InstallingSoftware for all the details.
inadyn
Install the inadyn
package using Synaptic Package manager, then:
The following will allow your Ubuntu Linux machine to be accessible anywhere that you are given an externally-accessible IP address. This includes most ISPs but excludes many office LANs.
First edit the file /etc/inadyn.conf
:
gksudo gedit /etc/inadyn.conf
It should contain something like to the following:
--username myusername --password mypassword --update_period 60000 --alias myhost.dyndns.org --background
Now test that it works by typing
sudo /usr/sbin/inadyn
Next, add inadyn to your 'crontab':
export EDITOR=gedit sudo crontab -e
Edit the file to add the following additional line:
@reboot /usr/sbin/inadyn
Then save and exit the editor. Verify using
sudo crontab -l
When you reboot, you should see indyn listed when you type
ps -A | grep inadyn
You should be able to log in to your Dynamic DNS provider's website and verify that the DNS entry is being updated. Certainly this is possible with www.dyndns.org, in any case. Alternatively you can type your hostname into a service like http://www.dnsstuff.com/.
ddclient
More details required here. The documentation is good however, and there is a Ubuntu package for ddclient in the Ubuntu Universe. Install ddclient and the package installer scripts will ask you for your information. http://ddclient.sourceforge.net/?page=0
The following instructions is a wiki formatted excerpt from the ubuntu-users mailing list on the issue of repairing a ddclient setup: http://linux.derkeiler.com/Mailing-Lists/Ubuntu/2007-12/msg01412.html Author: Unknown 1. Remove/purge all of the previous install attempts:
sudo apt-get remove --purge ddclient
2. Install ssh & ssh socket so that you can send your password via ssh instead of in the clear:
sudo apt-get install ssh libio-socket-ssl-perl
Note: ssh w/ddclient won't work without libio-socket-ssl-perl, so make sure that you install that even if you have ssh already installed. 2. Reinstall ddclient from the repo:
sudo apt-get install ddclient
At the prompts enter the appropriate values, for example: Dynamic DNS service provider: www.dyndns.com DynDNS fully qualified domain names: your-hostname.dyndns.org Username for dynamic DNS service: your-username Password: your-password Enter the interface which is used for using dynamic DNS service: web 3. Modify the /etc/ddclient.conf to send the password using ssh and to properly check for the IP address:
gksu gedit /etc/ddclient.conf
Add entries for "daemon", "ssl" and replace "use=if, if=web" with "use=web" to match the following example:
# Configuration file for ddclient generated by debconf # # /etc/ddclient.conf daemon=300 pid=/var/run/ddclient.pid ssl=yes use=web, web=checkip.dyndns.com/, web-skip='IP Address' login=your-username password=your-password protocol=dyndns2 server=members.dyndns.org your-hostname.dyndns.org
Reference for secure updates: https://www.dyndns.com/support/kb/using_ddclient_with_dyndns_services.html Now ddclient is set to run as a daemon. Because you had other ddclient configs previously, check:
gksu gedit /etc/default/ddclient
Check to make sure it contains the following lines:
run_ipup="false" run_daemon="true" daemon_interval="300"
Note: you can set the interval shorter or longer, but if you do, also reset your /etc/ddclient.conf to match. https://bugs.launchpad.net/ubuntu/+source/ddclient/+bug/152875 Now, just to be sure everything sticks I generally reboot at this point, then check the status afterwards:
sudo /etc/init.d/ddclient status
You should see:
Status of Dynamic DNS service update utility: ddclient is running
However, that may not always catch problems in the ddclient.conf file, so issue:
sudo /etc/init.d/ddclient restart
if you do not get an error similar to the following you probably are good to go:
WARNING: file /etc/ddclient.conf, line x
Then I obtain a new IP address/lease from my service provider (shutting off the modem, having my router request a new lease, whatever) & monitor https://www.dyndns.com/account/services/hosts/ to see if the change actually makes it to dyndns. Also monitor /var/log/syslog to watch the changes there as well.
no-ip
This is another Dynamic DNS reporting client.
sudo no-ip -C Please enter the login/email string for no-ip.com: <your_login> Please enter the password for user 'your_login': <your_password> Please enter an update interval:[30] <interval time in minutes> Do you wish to run something at successful update?[N] <N>
Next, start the no-ip client
sudo no-ip
Using your Modem/Router for Dynamic DNS Reporting
Here are some example screenshots from Wireless Routers that support dynamic DNS reporting: Example: Another example: Yet another example: with port forwarding: