Forum Discussion
Create zonefile records on GTM using TMSH
Is it possible to create SOA records on the GTM using the command line tmsh?
I can create a new WIP with the following:
tmsh
gtm
create wideip test.example.com pools add { Test_Pool }
However, the above commands use the GTM hostname for the SOA details such as 'Master Server' and 'Email Contact'.
Instead of using the internal hostname, I want to create the SOA and NS records using a globally available domain name.
I can do this using Zonerunner from the web GUI but I want to be able to script it from the command line.
There is the following method that describes making modifications to the zonefile but I would prefer something from the tmsh that does not require manually freezing the zonefile:
https://support.f5.com/kb/en-us/solutions/public/5000/700/sol5739.html
Thanks
James
- Mark_Crosland_2Historic F5 AccountThere is currently no tmsh interface into the zonerunner/named/bind database. It is on a roadmap.
- TomL_122341NimbostratusHi, is this still on the roadmap or has this been released? I have been searching for an answer to this specific question and almost gave up until I found this thread. Thanks, Tom
- Jason_KeatingAltostratus
Bump - I have the same question as Tom.
- Faintly_Lucky_2Altocumulus
Gents, I know that this isn't exactly what you're looking for, but if you're handy with iControl, you can add a second step to your plan and write/run a script that will change the SOA values for you. Check out Management::ResourceRecord::update_soa in the iControl wiki. I use scripts to add/delete/modify A and MX records now instead of the GUI.
Even with the initial development time for the scripts, I've saved countless hours by not having to use the GUI. I can provide code samples in Perl because that's what I write in, but any other language and you're on your own.
- Nylgia_68484NimbostratusI would be interested in the perl scripts. Thanks!
- jg_abaituaAltostratusHello Faintly Lucky, can you please also let me see your perl scripts for managing DNS records over CLI?
- neenee_208438Nimbostratus
Same here, Faintly Lucky. Can you provide some perl samples?
- Faintly_LuckyNimbostratus
Gents, I know that this isn't exactly what you're looking for, but if you're handy with iControl, you can add a second step to your plan and write/run a script that will change the SOA values for you. Check out Management::ResourceRecord::update_soa in the iControl wiki. I use scripts to add/delete/modify A and MX records now instead of the GUI.
Even with the initial development time for the scripts, I've saved countless hours by not having to use the GUI. I can provide code samples in Perl because that's what I write in, but any other language and you're on your own.
- Nylgia_68484NimbostratusI would be interested in the perl scripts. Thanks!
- jg_abaituaAltostratusHello Faintly Lucky, can you please also let me see your perl scripts for managing DNS records over CLI?
- neenee_208438Nimbostratus
Same here, Faintly Lucky. Can you provide some perl samples?
- Brandon_12856Nimbostratus
I also wanted to control zonerunner. Specifically to create 'static' resource records like MX and TXT records. I stumbled across a little shell that seems to be what does the work for the configuration gui: zrsh. Variables, designated @VariableName@, are injected from my management tool- below are some examples of the format.
@Zone@ = 'example.com' @EscapedZone@ = 'example\.com' @RecordType@ = 'MX' @DesiredRecords@ = '"external example.com. example.com. 3600 MX 10 smtp.example.com." "external example.com. example.com. 3600 MX 20 smtp1.example.com." "external example.com. example.com. 3600 MX 20 smtp2.example.com."' @Authority@ = 'dns.example.com'
Here's the script I ended up with:
!/bin/sh ZoneFile=/tmp/newzone.external.@Zone@. Zone=@Zone@ RecordType=@RecordType@ ZoneExists=0 DesiredRecords=(@DesiredRecords@) Authority=@Authority@ Check if zone exists echo "listzones" | zrsh | awk '{ print $2 }' | grep '^@EscapedZone@\.$' && ZoneExists=1 If zone didn't exist, create it if [ $ZoneExists -eq 0 ]; then Create Zone File Defaults ISODate=`date +%Y%m%d` cat << EOF > ${ZoneFile} \$ORIGIN . \$TTL 500 ; 8 minutes 20 seconds ${Zone}. IN SOA ${Authority}. hostmaster.${Zone}. ( ${ISODate}01 ; serial (YYYYMMDDVV) 10800 ; refresh (3 hours) 3600 ; retry (1 hour) 604800 ; expire (1 week) 60 ; minimum (1 minute) ) \$TTL 0 ; 0 seconds NS ${Authority}. \$TTL 3600 ; 1 hour \$ORIGIN ${Zone}. \$TTL 0 ; 0 seconds EOF echo "addZoneFile external @Zone@. master db.external.@Zone@. \"${ZoneFile}\"" | zrsh rm -f ${ZoneFile} fi Strip existing static records echo "displayzone @Zone@." | zrsh | grep '@RecordType@' | awk '{ cmd=sprintf("echo ''delrr external %s %s %s %s %s %s'' | zrsh ", $1, $1, $2, $4, $5, $6); system(cmd) }' Set desired static records for i in "${DesiredRecords[@]}"; do echo "addrr $i" | zrsh; done
- Gilles_MOULIN_1Nimbostratus
Does anyone knows how to create a slave zone with zrsh ??
I have a hundreds of zone to create on my GTM as slave and I cannot resign myself to use the webUI !
Except this article, I found no other example of use of zrsh.
- san2hosh_306591Nimbostratus
Gilles MOULIN did you find answer for your question?
- Gilles_MOULIN_1Nimbostratus
no offically supported solution... only scripts.
- jba3126Cirrus
It baffles me to this day how this has not been accomplished for going on 12+ years now. Especially with Automation. It is painful to use the iControl SOAP interface. It works, but we know it is being deprecated and what then ... SSH again?
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com