IgorKa - Information resource. How to make your own dynamic DNS server Dynamic dns

What is DNS?

DNS stands forDomain Name System or Domain Name Service. You specified a name, and DNS substitutes the IP address of the resource on which the site is located. The name in this case is the host name or IP address. Without DNS, you would have to remember the IP address of every website you want to visit. Today there are more than 300 million websites on the Internet, it is absolutely impossible to remember the IP address of the required site.

What is dynamic IP?

How to make a static IP address from a dynamic one?

There is no need to buy a static IP. Use our free Dynamic DNS to map a dynamic address or long URL to your resource so you can easily remember the hostname. Remote monitoring of your home via webcam on any port or launch own server in your home with a dynamic IP address - all this is available with the serviceDnsIP . If a provider allocates a dynamic IP, a service such as Dynamic DNS becomes necessary.

When registering on our service you receive domain name. A special client that needs to be downloaded is installed on the user's computer. This client periodically sends information to the DNS server, reporting its IP address. The DynDNS service server stores the user's last IP and, when accessing the user domain name received during registration, redirects the request to this IP.

Private network.

Regular services offer only third-level domain names. This may be inconvenient. If you have an external dynamic IP address, our innovative project allows you to get a domain name not only of the third, but also of the first level. Having installed special application on computers, you will have access to a private network in which you will be able to access services or programs using any protocol or port. In this case, no traffic will pass through our server. All information will be transferred between computers directly.

Remote computer and remote desktop.

By using DynDNS Secure service DnsIP allows you to connect to a remote computer through any program remote access using any port. In this case, you directly communicate with the remote computer, and our service only tells your programs the required IP address.

Network monitoring.

Using our service, you will have access to network monitoring. All connected users (their computer names) will be tracked only by you. You will be informed which computer is online and which has gone offline.

If any application is on remote computer is not responding and there is a need to safely reboot the remote machine, you can do this by pressing a button without using command line And special settings firewall and even if the remote network does not have an external IP address. All you need is an Internet connection.

Automatic click on the free access button when using Yota.

In case you use free access to the Internet from the Yota provider, once a day the connection is blocked and a window appears in the browser asking you to continue at a slow speed. This is extremely inconvenient when using remote access to this computer. In this case, it is enough to install ourfree program, and it will restore Internet access within a few minutes. This option is available without user registration on our website. In this case, you only need to install the program, you do not need to make any settings.

At any time you can find out the IP address of your resource.

At your service is the page http://dns-free.com/dns2ip.php?dns=xxxxxxx, where xxxxxxx is the domain name in the DnsIP system. Use it to organize links to your resource using the system dynamic dns. Or add to favorites, and with one click find out the current ip of your resource. Or enter manually in the form on the same

As a rule, the time that the system spends connecting to the DNS server when visiting web resources is small. Most often, those servers that the provider uses by default work stably and quickly. However, there are situations when standard DNS is not fast enough. In this case, you can try changing the server.

Google Public DNS

According to the developers themselves, this DNS can significantly speed up the loading of web pages. In order to use this server, in the connection settings you need to specify addresses 8.8.8.8 and 8.8.4.4 for the primary and secondary DNS, respectively.

If you are interested in servers or data storage systems, then Server City offers you to buy DELL, IBM servers, as well as data storage systems for favorable price. Here on the website server-city.ru you can read in more detail about all the services that the company offers.

Following Google's example, Yandex developed its own alternative DNS server. In addition, the developers have added family control capabilities in case there is a need to block potentially dangerous resources. To use DNS without filtering functions, you must enter the address 77.88.8.8 in the connection settings. If you enter the address 77.88.8.88, you can use the filtering functions for dangerous resources. If you enter the address 77.88.8.7, you will activate filtering of dangerous sites and porn resources.

This service is quite popular on the Internet and for good reason. OpenDNS allows you to use modern methods Internet protection, fast and has many nice features, for example, the function of correcting typos in typed addresses.

The service has paid and free modes.

Free mode with standard settings available at the following addresses:

  • 208.67.222.222
  • 208.67.220.220

SkyDNS

This service is a leader on the Russian-language Internet in the field of security and filtering of unwanted content. As the developer himself assures, the service is used by tens of thousands of users, large companies, Internet providers, etc. Paid and free modes are available.

Connecting to the free mode is available after completing the registration procedure, which does not take much time. To use SkyDNS, you will be asked to download a small SkyDNS Agent application, or provide your IP. However, you can use the service without installing the application.

To do this you will need to specify DNS address 193.58.251.251.

In addition, to find a suitable DNS, you can use the appropriate software, of which there is a lot on the Internet.

Sometimes it is necessary to register DNS for a computer with a dynamic IP address. A simple way to do this are services like dyndns, described in a recent topic. Sometimes this approach works quite poorly.

For example, in my situation, the provider Sometimes changes my public IP address. This sometimes happens usually once every few months. In addition, my home computer rarely reboots. During this time, the dyndns service, which I had previously used, managed to send me inactivity notifications a couple of times in order to disable the “unused” account. Switch to manually registered DNS zone It also doesn’t work because sometimes the address still changes. Moreover, you usually find out about this when you need access to home computer here and now.

To implement the described method, you will need a server on the Internet with DNS server om bind on it. As well as a domain zone, the subdomain of which we will allocate for our computer. An option is described for connecting a Linux computer to a Linux server. For use by others operating systems You will need to read the manuals and modify some steps.

So:
1. We have installed server bind9 with domain server.org
2. Create a zone client.server.org.zone:

$ORIGIN.
$TTL 10 ; 10 seconds
client.server.net IN SOA ns1.server.net. hostmaster.server.net. (
18; serial
10800 ; refresh (3 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
10 ; minimum (10 seconds)
$TTL 3600 ; 1 hour
NS ns1.server.net.
NS ns2.server.net.
MX 10 client.server.net.

Here the servers ns1.server.net and ns2.server.net are the DNS servers for our zone, client.server.net is the address of our home computer

3. generate keys on the client:
client# cd /etc/namedb/keys
client# dnssec-keygen -b 512 -a HMAC-MD5 -v 2 -n HOST client.server.net.

4. Create a file with the key on the server:
server# cd /var/named/chroot/etc
server# vim keys.conf:

Key client.server.net. (
algorithm "HMAC-MD5";
secret "omr5O5so/tZB5XeGuBBf42rrRJRQZB8I9f+uIIxxei8qm7AVgNBprxtcU+FQMzBvU/Y+nyM2xbs/C8kF3eJQUA==";
};

In this case, a symmetric key is used, which is unsafe: if someone has access to the key file on your server, they can use your key to change your zone data. In this case, you can use an asymmetric key.

Set the access rights to the file with the keys:
server# chmod 640 keys.conf
server# chown root:named keys.conf

5. add our zone to named.conf:
include "/etc/keys.conf"
zone "client.server.net" (
type master;
file "zones/client.server.net";
allow-update(
key client.server.net;
};
};

Here is a parameter that allows you to update zone data. In general, after reading the manuals, you can find options for this parameter that allow you to update only one record in the zone for given key. That is, you can have a zone with the subdomains client1, client2, etc. registered in it. which will be authorized with the keys key1, key2, etc.

6. Restart the DNS server:
server# /etc/init.d/named reload

7. Create a script on the client that will update the zone data:
#!/bin/bash
IFACE="wlan0"
TTL=3600
SERVER=ns1.example.com
HOSTNAME=foo.example.com
ZONE=example.com
KEYFILE=/root/ddns-keys/Kfoo.example.com.+157+12345.private

New_ip_address=`ifconfig $IFACE | grep "inet addr:" | awk "(print $2)" | awk -F ":" "(print $2)"`
new_ip_address=$(new_ip_address/ /)

Nsupdate -v -k $KEYFILE<< EOF
server$SERVER
zone $ZONE
update delete $HOSTNAME A
update add $HOSTNAME $TTL A $new_ip_address
send
EOF

At the beginning of the script, the corresponding parameters are described: interface, server and zone names, location of the file with the key.

8. All that remains is to configure autostart/automatic address change when changing DNS.
We will do this using a script for NetworkManager:
create a file /etc/NetworkManager/dispatcher.d/20-dyndns.sh:
#!/bin/sh

Iface=$1
state=$2

If [ "x$state" == "xup" ] ; then
/etc/namedb/ddns-update
elif [ "x$state" == "xdown" ]; then
true
fi

Let's make it executable and owned by the root user.

Let's launch, check, use.

Upd: If it doesn’t work, check (set) on the server the rights of named to write to the folder in which the file client.server.org.zone is located
named will create a client.server.org.zone.jnl file there

The following materials were used.

Greetings, brain engineers! Shouldn't we unite our Internet devices in the house using a DNS server made by with your own hands from the WiFi module and Foscam webcam interface? I think it will be interesting, so let's go!

Selected for this homemade products The Foscam webcam is controlled directly from your smartphone, has its own web interface, works in any browser and on any device, even with your phone’s 3G connection, does not require third-party applications and is password protected.

Video streams from cameras are broadcast in separate windows, quickly and flawlessly, and under complete control.

Just a heads up - I AM NOT RESPONSIBLE for misuse or damage caused by this project in any way! You act at your own peril and risk!

What's for this brain project necessary:

  • web server with PHP support with a domain name,
  • wi-fi module Esp8266 ESP-01,
  • push button - 2 pcs.,
  • pull-up resistor 2k2 or similar - 2 pcs.,
  • USB-TTL adapter (for programming the wi-fi module) and several pin connectors (“female”),
  • voltage regulator Ams1117 3.3V (to reduce the voltage of 5V to 3.3V to power the wi-fi module),
  • power supply 5V 1-2A (preferably 2A),
  • in the first layout option: if there is enough space inside the power supply case, then the wi-fi module is placed inside this case,
  • in the second layout option: the power supply has a female USB connector, then you will have to add a male USB connector to the module board and use it to supply power,
  • broken USB flash drive,
  • updated Arduino IDE program
  • additionally: Foscam webcams for working with the web interface
  • to ensure: blinking LED, to indicate successful download and waiting for download
  • internal server allowing WAN IP (this version connects to an external site to obtain IP: checkip.dyndns.org).

Step 1: Preparing the Wi-Fi module for programming

In order for the module to be programmable, it needs to be slightly modified:

  • solder two resistors - one to the CH-PD contact, the second to RST, solder both free leads of the resistors to the 3.3V contact,
  • solder two push buttons - one between the GPIO0 and Ground pins, and the other between RST and Ground.

It is better to solder from the top side of the module board, so that the contacts on the bottom side are left for mounting pin connectors. If desired, the circuit can be assembled using a breadboard, but brain solder still more durable, although see for yourself.

In the next step, the power supply will be modified, but I warn you right away: the USB output of your computer is not suitable for powering the ESP module!!!

Step 2: Modifying the power supply - lowering the voltage from 5 to 3.3V

The 5V power supply should produce a “reliable” 1A, or better yet 2A, since the module is quite “gluttonous” during Wi-Fi signal transmission.

IN homemade We use an Ams1117 3.3V voltage regulator, because a voltage divider assembled from resistors will most likely “produce” too little current, and even if we get 3.3V to power the module, we will still be disappointed. And this regulator is an inexpensive and best solution.

I did not use the capacitor and resistor that according to the instructions should be added to the regulator, because it operates from a stable power source, and I will say that this brain option has been working reliably for several years.

pin 3 - 5V (orange wire)
pin 2 - 3.3V (yellow wire)
pin 1 - GND (two blue wires)

You can solder several wires with pin connectors to the contacts, thereby simultaneously obtaining two voltage sources of 5V and 3.3V, which is very useful when assembling on a breadboard. In this case, do not forget to add two grounding wires, for +3 and +5V, and for reliability, fasten all the wiring with a plastic tie.

To connect these wires to the ESP module (which has male connectors), you will need intermediate wires with female pin connectors at the ends.

Step 3: Connecting the Wi-Fi module to the USB-TTL adapter and 3.3V voltage regulator

Connections (module - adapter - regulator)

GND — — — — GND- — — — GND
TX — — — — — RX
RX — — — — — TX
3,3 — — — — — — — — — — — — — 3,3

We connect the grounding contacts (Ground) of the voltage regulator, module and adapter together, connect the 3.3V coming from the regulator to the input of the ESP module.

Under no circumstances should we connect the ESP module to the 3.3V pin of the adapter, even if it has them, since this can damage the computer’s USB port, because it does not have protection against current of the same rating as is used in this brain work! And to power the ESP module, always use a power source with the required parameters.

You should know that some TTL-USB adapters have a 5V logic circuit, which is not suitable for our craft, only 3.3V logic is needed, otherwise the ESP module will be damaged. The type of logic can be determined using a voltmeter by connecting its probes to the TX and Ground pins, and if necessary, the voltage can be reduced by adding a level shift or voltage divider.

Step 4: Setting up files on web hosting

Create a folder “/ip” (the name is case sensitive) in the root directory of your public_html folder, and unpack the /ip files into it with a resolution of 644.

The .htaccess restriction does not allow users to list files in this folder because it cannot be password protected, otherwise the ESP8266 module would not be able to access it and execute files inside it.

input.php and input2.php generate according to the browser URLs ip.txt and ip2.txt with the updated IP of the ESP8266 module, the current code supports 2 different locations, and to add something else you only need to edit these files.

To control the FOSCAM camera, you need to create a folder “/cam” (again, case sensitive) in the root directory of the public_html folder, and unpack /cam files into it with a resolution of 644. Protect this folder brain password, if cpanel is available on your server, then you can find the “password protection” icon and set a password that will be requested when you tell the browser to go to www.yourhost/cam, then a dialog box will pop up in any browser asking for this password, all this will protect access to cameras.

foscam.php contains the camera interface, as well as the date/time stamp of the IP files and the current IP location. By the date/time stamp you can see whether the module is working. In this case, the time zone may not be displayed correctly, since it shows the time on the server.

The IP can be changed manually, it will be recorded in ip.txt and ip2.txt, and to do this you need to enter the ip in the field and click update ip.

interface.png and interface2.png are transparent images that tell the interface how the screen will be displayed. You need to edit foscam.php and set the value, static or ptz, corresponding to your FOSCAM camera. The default resolution is 320x240, but clicking on the control center opens only this camera with a better refresh rate at 640x480 resolution.

To edit foscam.php, you can use a code editor or an HTML editor that can work in WYSWYG mode.

During work brain boards The files ip.txt and ip2.txt will be automatically written, containing the updated ip of two locations where two different boards can work. Every hour (or whenever you specify) the board will connect to the router via Wi-Fi, receive an IP address and register it in a txt file on the server. And even if the Internet connection is lost or the power is turned off, after these problems are resolved, the ip will be periodically updated.

Step 5: Setting up FOSCAM cameras and router

On the TP-LINK router configuration page:

Let's look at the settings in the photo, they will help to avoid a conflict when linking a MAC address and LAN-ip; the router will provide only assigned LAN-ip MAC addresses for this.

Virtual servers - you need to add the local IP of your camera and the corresponding ports.

We set the DHCP server to be enabled, and also check whether UpnP is enabled.

You can also configure remote control of your router; there is a corresponding firewall sub-item for the TP-Link router.

Do not change the default login, as the router must be public. Further in the corresponding brain fields should be set to 255.255.255.255 and the port is usually 8080.
On the FOSCAM camera settings page:

Name and password - you should set a new name and password, and do not forget to “find and replace” them in foscam.php instead of admin and password.

For “Basic Network settings” set: “Obtain IP from DHCP Server”.
In the Http Port item, set: 8081, 8082 8083 sequentially to your cameras.
In UPnP Settings set: Using UPnP to Map Port. This will help restore the connection after a power outage.

After setting up the router and cameras, in order for the settings to be updated, they should all be rebooted, the router first.

If the cameras and router are configured correctly, then they can be accessed remotely from your Wan IP address, for example this: http://187.34.157.22:8081. You can check your Wan IP at https://www.whatismyip.com/

Step 6: Coding and Programming the ESP8266 Module Using Arduino IDE

For programming homemade products you need to open the attached sketch in the Arduino IDE, and in the appropriate lines specify the ssid “//your wifi ssid” and the password “//your wifi pwd” of your WiFi router, as well as your host name “//your host without /IP” and the path to the “/ip” folder containing the server files; you do not need to change it.

You may need to change the line

url += “input.php?ip=”;

which appears twice in the sketch, and if you have a second module, then simply change it to input2.php.

Before you start downloading the code, you must set the board type correctly; for this, select “Generic ESP8266” from the tools submenu, and if this is not the case, then add additional boards in the preferences.

To boot, you need to hold down the GPIO0 button, quickly press the RST button, and then release the previous one (GPIO0 button). Next, run compilation in the IDE and brain load.

If everything is going correctly, when you open the serial port monitor at 9600 baud (bit/s), you will see the following:

Connected To:
IP address: 192.168.0.103 (LAN IP)
Connected - Acquiring WAN IP:

connecting to
Requesting IP Update: /ip/input.php?ip=xxx.xxx.xxx.xxx
Ok

Step 7: Mounting the boards into the case

After checking homemade products To make it work, you need to place its electronics in a housing, thereby making it an independent, complete device.

If in the case you have chosen for brain games If there is enough free space, then the resistors and buttons can be connected as shown in the photo, but if you plan to reprogram it later, then you should not place the board inside the case.

First option: Placement inside the case
To do this, you need to open the case of the old power supply, unsolder the black (outgoing) wire with the connector, and then place the module board and voltage regulator in the case, having previously insulated them, and “power” them from the contacts to which the outgoing wire was soldered. You can insulate the components using suitable foam tape or hot glue.
The result should be a power supply, without any wires, and in this version the power supply can be 5V 1A.

A variation of this layout method could be to place the boards inside a power supply that has a female USB connector at the output. Then the boards should also be secured inside the case, insulated, and powered from the contacts of the USB connector. Thus, with this modified power supply you can still charge your phone, but the power supply must produce 5V 2A.

Option 2: Placed outside
If you have a non-working flash drive, the housing of which can accommodate boards homemade products, then you can use it.

You need to disassemble the flash drive, remove the memory board, and in its place place the WiFi module and voltage regulator, and power them through the USB connector of this flash drive. In this case, you will also need to trim the pin contacts of the module so that it fits into the flash drive housing. And NEVER CONNECT this modified flash drive to the USB port of your computer!

Then you need to connect the flash drive with the module inside to the power supply and check for a WiFi signal using your smartphone. In general, check the functionality of the finished brain games You can use your browser by going to /cam/foscam.php of your server. And also, it should be updated with the current ip and date/time stamp.
That's all, I hope this information brain articles will be useful to you!

Dynamic DNS- a technology that allows information on the DNS server to be updated in real time and, if desired, automatically. It is used to assign a permanent domain name to a device (computer, network storage device) with a dynamic IP address. This can be an IP address obtained via DHCP or via IPCP in PPP connections, such as remote access via a modem. Other machines on the Internet may be connecting to this machine by domain name and not even know that the IP address has changed.

The time to live (TTL) for a dynamic entry is made very small (no more than two to three minutes), otherwise other DNS servers will put it in their cache, and when it changes, their clients will receive outdated information for a long time.

Dynamic DNS is also often used on local networks, where clients obtain an IP address via DHCP and then register their names with a local DNS server.

Configuration via GUI

The setup is very simple:

Within a minute, the received DNS name will be displayed in the “DNS name:” line.

Share