<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Microduino_ENC_Network_%286%29</id>
		<title>Microduino ENC Network (6) - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Microduino_ENC_Network_%286%29"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Microduino_ENC_Network_(6)&amp;action=history"/>
		<updated>2026-04-21T09:49:07Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=Microduino_ENC_Network_(6)&amp;diff=2500&amp;oldid=prev</id>
		<title>Pkj：Created page with &quot;{{Language | Microduino ENC网络（六）}} {| style=&quot;width: 800px;&quot; |- | ==Objective== This tutorial will show you how to write a sketch to update a DNS record hosted by one...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Microduino_ENC_Network_(6)&amp;diff=2500&amp;oldid=prev"/>
				<updated>2014-05-06T13:28:12Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Language | Microduino ENC网络（六）}} {| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== This tutorial will show you how to write a sketch to update a DNS record hosted by one...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Language | Microduino ENC网络（六）}}&lt;br /&gt;
{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
==Objective==&lt;br /&gt;
This tutorial will show you how to write a sketch to update a DNS record hosted by one of the most famous Dynamic DNS service providers, no-ip.&lt;br /&gt;
&lt;br /&gt;
==Equipment==&lt;br /&gt;
*'''[[Microduino-Core]]'''&lt;br /&gt;
*'''[[Microduino-FT232R]]'''&lt;br /&gt;
*'''[[Microduino-ENC28J60]]'''&lt;br /&gt;
*'''[[Microduino-RJ45]]'''&lt;br /&gt;
&lt;br /&gt;
*Other equipment&lt;br /&gt;
**USB cable &lt;br /&gt;
&lt;br /&gt;
==Dynamic IP addresses==&lt;br /&gt;
If you connect to Internet using a home or mobile connection, you’ll probably have a dynamic public IP address, that is it changes everytime you connect.&lt;br /&gt;
&lt;br /&gt;
If you need to talk to a device on Internet, you need to write – in the message you send on the net – its public IP address: if this IP is dynamic, you may not know it.&lt;br /&gt;
&lt;br /&gt;
==Dynamic DNS==&lt;br /&gt;
In Internet you can find free Dynamic DNS (DDNS) services: they allow you to associate a name you choose with an IP address and they allow you to keep that association updated.&lt;br /&gt;
&lt;br /&gt;
The update could be done in different ways:&lt;br /&gt;
&lt;br /&gt;
*using a client running on your PC;&lt;br /&gt;
*with a feature present in your router:&lt;br /&gt;
*asking Arduino to do it for us. &lt;br /&gt;
&lt;br /&gt;
==NO-IP==&lt;br /&gt;
One of the most used site offering dynamic DNS service is No-IP.&lt;br /&gt;
&lt;br /&gt;
If you register for free to No-IP Free service, you can configure up to 5 hosts for Hosts/Redirects feature:&lt;br /&gt;
&lt;br /&gt;
[[File:noipPhoto.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
For this tutorial, I registered the following host: enctutorial.no-ip.info.&lt;br /&gt;
&lt;br /&gt;
==DDNS Client==&lt;br /&gt;
Every DDNS client performs the following steps:&lt;br /&gt;
&lt;br /&gt;
*gets the actual public IP (asking the router, an external website…);&lt;br /&gt;
*compares that IP with the one resolved from DNS alias;&lt;br /&gt;
*if they are different, it updates the DNS record via service provider’s API.&lt;br /&gt;
&lt;br /&gt;
==Schematic==&lt;br /&gt;
*Microduino-ENC28J60&lt;br /&gt;
*Microduino-RJ45&lt;br /&gt;
*Microduino-Core&lt;br /&gt;
*Microduino-FT232R&lt;br /&gt;
Stack all modules and then connect the ethernet cable, as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:MicroduinoENCShow.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Program==&lt;br /&gt;
&lt;br /&gt;
Refer to ENCnetworksix&lt;br /&gt;
&lt;br /&gt;
==Debug==&lt;br /&gt;
Step 1：Download the EtherCard library and copy to your libraries fold of IDE, then restart IDE.&lt;br /&gt;
https://github.com/jcw/ethercard&lt;br /&gt;
&lt;br /&gt;
Step 2：Explain the program:&lt;br /&gt;
&lt;br /&gt;
Public IP:&lt;br /&gt;
To find the actual public IP, I wrote a simple PHP page on my website:&lt;br /&gt;
&lt;br /&gt;
[[File:getPublicIP.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
Microduino sketch gets that page and parse the IP address.&lt;br /&gt;
&lt;br /&gt;
DNS record and comparison:&lt;br /&gt;
&lt;br /&gt;
//Sketch calls dnsLookup() method to resolve actual IP for DNS record; it then converts the result in a String object to use its compareTo() method to compare the two IP addresses:&lt;br /&gt;
&lt;br /&gt;
      if(!ether.dnsLookup(noIP_host)) { &lt;br /&gt;
      [...]&lt;br /&gt;
      } else {&lt;br /&gt;
      for(int i = 0; i &amp;lt; 4; i++) {&lt;br /&gt;
        dnsIp = dnsIp + String(ether.hisip[i]);&lt;br /&gt;
        if(i &amp;lt; 3) dnsIp = dnsIp + &amp;quot;.&amp;quot;;&lt;br /&gt;
      }&lt;br /&gt;
      if(actualIp.compareTo(dnsIp) == 0) {&lt;br /&gt;
        Serial.println(&amp;quot;No update needed :)&amp;quot;);&lt;br /&gt;
        [...]&lt;br /&gt;
      } else {&lt;br /&gt;
        Serial.println(&amp;quot;Update needed :(&amp;quot;);&lt;br /&gt;
        actual_status = STATUS_NOIP_NEEDS_UPDATE;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
Authentication:&lt;br /&gt;
You have to authenticate to No-IP before being allowed to update any records.&lt;br /&gt;
&lt;br /&gt;
[[File:NoIPAuth.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
You have to assign to that constant the base64 encoded value of the string username:password.&lt;br /&gt;
You can use an online encoder:&lt;br /&gt;
http://tuxgraphics.org/~guido/javascript/base64-javascript.html&lt;br /&gt;
[[File:onlineEncode.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
Step 3：Compile the code and download it.&lt;br /&gt;
&lt;br /&gt;
Step 4：Check if can access the Microduino.&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
Arduino correclty found a difference between public IP and DNS record so it updated No-IP record. After a while, it performed another check and this time the two IP addresses were equals so no update was required.&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pkj</name></author>	</entry>

	</feed>