DDNS: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
Line 5: Line 5:


== DDNS on Debian servers ==
== DDNS on Debian servers ==
DOES NOT WORK FOR BAREIS -- Beldon has multiple IP addresses and manages them.


'''HE.net part: Create a key.''' You have to create a key on the DNS server so that
'''HE.net part: Create a key.''' You have to create a key on the DNS server so that
Line 22: Line 20:
# sudo apt-get install ddclient
# sudo apt-get install ddclient


=== /etc/ddclient.conf ===
<pre>
# /etc/ddclient.conf
protocol=dyndns2
use=cmd
# Read ip address from Mikrotik
cmd=/usr/local/sbin/get_ip.py
server=dyn.dns.he.net
login=bellman.wildsong.biz
password='eOYop3nMoEaT4a4U'
daemon=3600                # check every hour
syslog=yes                  # log update msgs to syslog
mail=root                  # mail all msgs to root
mail-failure=root          # mail failed update msgs to root
pid=/var/run/ddclient.pid  # record PID in file.
bellman.wildsong.biz
</pre>
=== Getting the outside IP address ===
/usr/local/sbin/get_ip.py contains
<pre>
#!/usr/bin/env python
#
#  Read our outside IP address from the Mikrotik router.
#
import sys,subprocess
import re
args = ['ssh', '[email protected]', '/ip address print']
re_ip = re.compile(r'^ 1 D ([\d\.]+)')
p = subprocess.check_output(args)
for line in p.split('\n'):
    mo = re_ip.search(line)
    if mo:
        print mo.group(1)
        exit(0)
exit(-1)
</pre>
== Mikrotik "/IP/Cloud" Service ==


This uses DDNS to talk to a service hosted by Mikrotik, we don't need it right now.




[[Category: Network]]
[[Category: Network]]
[[Category: System Administration]]
[[Category: System Administration]]

Revision as of 19:20, 17 November 2016

When a server is behind a firewall I want to know when the server's public IP address changes, and to communicate it back to my DNS servers at dns.he.net.

I need to know the outside IP address, not the private IP address of the server itself.

DDNS on Debian servers

HE.net part: Create a key. You have to create a key on the DNS server so that it will trust updates coming from the Debian server.

  1. Log into dns.he.net
  2. Go to the appropriate domain
  3. Click on the entry for the server (create one if it does not exist)
  4. Check the box "Enable entry for dynamic DNS. This will also clear the current IP address and set TTL to 5 minutes.
  5. Click Update.
  6. There will now be a "recycle" type icon for the entry. Click on it to either enter a key or generate a random key.

Debian part: Install and configure a DDNS package.

  1. sudo apt-get install ddclient

/etc/ddclient.conf

# /etc/ddclient.conf

protocol=dyndns2
use=cmd

# Read ip address from Mikrotik
cmd=/usr/local/sbin/get_ip.py

server=dyn.dns.he.net
login=bellman.wildsong.biz
password='eOYop3nMoEaT4a4U'

daemon=3600                 # check every hour
syslog=yes                  # log update msgs to syslog
mail=root                   # mail all msgs to root
mail-failure=root           # mail failed update msgs to root
pid=/var/run/ddclient.pid   # record PID in file.

bellman.wildsong.biz

Getting the outside IP address

/usr/local/sbin/get_ip.py contains

#!/usr/bin/env python
#
#   Read our outside IP address from the Mikrotik router.
#
import sys,subprocess
import re
args = ['ssh', '[email protected]', '/ip address print']
re_ip = re.compile(r'^ 1 D ([\d\.]+)')
p = subprocess.check_output(args)
for line in p.split('\n'):
    mo = re_ip.search(line)
    if mo:
        print mo.group(1)
        exit(0)
exit(-1)

Mikrotik "/IP/Cloud" Service

This uses DDNS to talk to a service hosted by Mikrotik, we don't need it right now.