This script allows you to manage the DNS zone records as well as update DNS zone SOA records.
Usage
Argument | Parameter | Description |
---|---|---|
--create or -c | <zone_name> | create records on the <zone_name> |
--remove or -r | <zone_name> | removes records from an existing <zone_name> |
--update or -u | <zone_name> | updates SOA settings of an existing Master <zone_name> |
and available <options> are:
Argument | Parameter | Description |
---|---|---|
--record_type or -t | <A|AAAA|CAA|CNAME|NS|MX|PTR|TXT|SRV|NAPTR> | the record type |
--record_status or -st | <0|1> | record status (0 is disabled, 1 is enabled) |
--record_host or -o | <host> | the record host |
--record_value or -v | <value> | the record value |
--record_auto_cname or -autocn | <0|1> | automatically generate CNAME records; for NS records of reverse zones only |
--record_services -srvcs | <services> | the record services (for NAPTR records only) |
--record_order or -ord | <order> | the record order (for NAPTR records only) |
--record_preference or -prf | <preference> | the record preference (for NAPTR records only) |
--record_search or -srch | <search> | the record search (for NAPTR records only - the regex condition part) |
--record_replace or -rpl | <replace> | the record replace (for NAPTR records only - the regex substitution part) |
--record_replacement or -rpl | <replace> | the record replacement (for NAPTR records only) |
--record_case or -ca | <'i' or '' > | the sufix of replace field (for NAPTR records only) |
--record_flag or -flg | <A|S|U|P> | the record flag (for NAPTR records only) |
--record_tag or -tg | <'issue, 'issuewild' or 'iodef'> | the record tag type (for CAA records only) |
--record_critical_flag or -cflg | <0-255> | the record critical flag (for CAA records only) |
--record_ttl or -ttl | <ttl> | the record TTL (for NAPTR and SRV records only) |
--record_service or -srv | <service> | the record service (for SRV records only) |
--record_protocol or -proto | <protocol> | the record protocol (for SRV records only) |
--record_priority or -prty | <priority> | the record priority (for SRV records only) |
--record_weight or -wgt | <weight> | the record weight (for SRV records only) |
--record_port or -prt | <port> | the record port (for SRV records only) |
--record_target or -tgt | <target> | the record target (for SRV records only) |
--record_opt or -p | <opt> | the record option (for MX records only) |
--transfer_ip or -s | <ip> | IP to allow transfer to (for master zones only) |
--master_ip or -m | <ip> | IP to allow transfer from (for slave zones only) |
Zone SOA options, available only for "-u" command:
Argument | Parameter | Description |
---|---|---|
--zone_serial or -sr | <number> | Serial for DNS Zone |
--zone_auto_serial or -asr | <0|1> | When this option is 1 serial will be automatically generated |
--zone_refresh or -zr | <number> | Refresh time for DNS Zone |
--retry_time or -rt | <number> | Retry time for DNS Zone |
--expire_time or -et | <number> | Expire time for DNS Zone |
--minimum_ttl or -mt | <number> | Minimum TTL for DNS Zone |
--default_ttl or -dt | <number> | Default TTL for DNS Zone |
Use parameter values embraced by quotes or double quotes!
Code Examples
In these examples, you are logged in as root and you call the scripts by their directory.
cd /usr/local/dnsmanager/bin
Add New Record
/usr/local/dnsmanager/bin/zone_prefs.sh --create "foo.bar." --record_type "A" --record_host "foo.bar." --record_value "123.213.123.123"
/usr/local/dnsmanager/bin/zone_prefs.sh --create "0/25.3.6.6.IN-ADDR.ARPA." --record_type "PTR" --record_host "10.0/25.3.6.6.IN-ADDR.ARPA." --record_value "foo.bar."
Add New Record Using Non FQDN Hosts
/usr/local/dnsmanager/bin/zone_prefs.sh --create "foo.bar." --record_type "A" --record_host "not-fqdn" --record_value "123.213.123.123"
/usr/local/dnsmanager/bin/zone_prefs.sh --create "0/25.3.6.6.IN-ADDR.ARPA." --record_type "PTR" --record_host "11" --record_value "foo.bar."
Add New NAPTR record
/usr/local/dnsmanager/bin/zone_prefs.sh --create "1.2.3.1.1.2.3.1.E164.ARPA." --record_type "NAPTR" --record_services "sip+E2U" --record_order "10" --record_preference "100" --record_search "^.*$" --record_replace "sip:information@foo.bar" --record_case "i" --record_flag "u" --record_replacement "."
Add New SRV Record
/usr/local/dnsmanager/bin/zone_prefs.sh --create "foo.bar." --record_type "SRV" --record_host "test" --record_ttl "10" --record_service "asr" --record_protocol "tcp" --record_priority "4" --record_weight "10" --record_port "123" --record_target "outside2.foo.bar."
Update Zone's SOA Records
/usr/local/dnsmanager/bin/zone_prefs.sh --update "foo.bar." --zone_serial "10000" --zone_refresh "10000" --retry_time "10000"
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.