dynamic dns

nsupdate

Dynamic DNS (DDNS) allows for automatic updates of DNS records as IP addresses change, commonly used for devices on networks with dynamic IP addresses. This ensures that the DNS records stay current without manual intervention, which is essential for services like websites or remote access that rely on correct DNS configurations.

The nsupdate command is used to interact with DNS servers to perform updates on the fly. This tool works with DNS servers that support dynamic updates to change or delete records in real-time, making it ideal for managing environments where IP addresses change frequently.

Field Descriptions

Zone Name
The zone is the DNS zone where the record update will occur. This is typically the domain that you are managing or updating records for.

  • Example: example.com
  • Input Type: Fully qualified domain name (FQDN) of the zone (domain).
  • Placeholder: example.com
    Enter the zone (e.g., domain name) for which you are applying the dynamic updates. This is necessary to identify which zone the DNS server will make changes to.

DNS Server
The DNS server field specifies the target server that will receive the dynamic updates. This should be the authoritative server for the zone where the DNS records are being updated.

  • Example: 8.8.8.8 (Google Public DNS)
  • Input Type: IP address or fully qualified domain name (FQDN) of the DNS server.
  • Placeholder: 8.8.8.8
    This is the server that will accept the DNS updates, and it must support dynamic updates for this to work.

Record Type
The record type refers to the type of DNS record being updated, such as A for an IPv4 address or MX for a mail server record.

  • Common Types:
    • A: Maps a domain name to its corresponding IPv4 address.
    • AAAA: Maps a domain name to its corresponding IPv6 address.
    • MX: Specifies the mail servers responsible for receiving email on behalf of the domain.
    • TXT: Contains arbitrary text data associated with the domain, often used for domain verification or security.
    • NS: Identifies the authoritative name servers for the domain.
    • CNAME: Maps a domain name to another domain name (alias), which can be useful for pointing multiple domains to a single resource.
  • Placeholder: Select from A, AAAA, MX, TXT, CNAME, etc.
    This specifies the type of DNS record being updated. Make sure to choose the correct type based on the kind of update you’re applying.

Record Value
This field contains the actual value for the DNS record. For instance, in the case of an A record, this would be the new IP address you want associated with the domain. For an MX record, it would be the mail server address.

  • Example for A record: 192.168.1.1
  • Example for MX record: mail.example.com
  • Input Type: IP address, FQDN, or text, depending on the record type.
  • Placeholder: 192.168.1.1 or mail.example.com
    Enter the appropriate value for the selected record type. For an A record, this will be an IP address; for a CNAME, this will be another domain name.

TTL (Time to Live)
TTL specifies how long the DNS record will be cached before it is refreshed. A shorter TTL means the record is updated more frequently, while a longer TTL reduces traffic to the DNS server but could result in outdated information being cached.

  • Example: 3600 (1 hour)
  • Input Type: Number (seconds)
  • Placeholder: 3600
    Set the TTL for the DNS record. The default is often set to 3600 seconds (1 hour), but you can adjust this based on your requirements for how often the record should be updated.

Additional Options

  • Update: Allows you to add or modify DNS records dynamically.
  • Delete: Removes existing DNS records for the domain.

Examples of Dynamic DNS Commands

  • Add an A record for example.com pointing to 192.0.2.1
    > nsupdate server your-dns-server zone example.com update add example.com 3600 A 192.0.2.1
  • Delete the A record for example.com
    > nsupdate server your-dns-server zone example.com update delete example.com A
  • Add an MX record for example.com pointing to mail.example.com
    > nsupdate server your-dns-server zone example.com update add example.com 3600 MX 10 mail.example.com
  • Query the DNS server for the current A record
    > nslookup example.com
  • Update an A record with a new IP address
    Update the example.com A record to point to 192.168.1.1 using the DNS server at 8.8.8.8.
    > nsupdate server 8.8.8.8 zone example.com update add example.com 3600 A 192.168.1.1 send
  • Update an MX record with a new mail server
    Update the example.com MX record to point to mail.example.com.
    > nsupdate server 8.8.8.8 zone example.com update add example.com 3600 MX 10 mail.example.com send
  • Delete an existing A record
    Remove an outdated A record for example.com.
    > nsupdate server 8.8.8.8 zone example.com update delete example.com A send