cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.
Alex__Applebaum
F5 Employee
F5 Employee

Problem this snippet solves:

Here's a little command to add DNS Express Zones for all the zones in named.conf via tmsh. This has changed in 11.6 and possible 11.5 The syntax in 11.6 is: tmsh ltm dns create zone name dns-express-enabled no

How to use this snippet:

Login via bash:

[root@bigip1:Active] config # egrep zone /var/named/config/named.conf
    zone "f5se.com." {
    zone "dc-r-d.platarc.glbdns.example.com." {
    zone "0.70.10.in-addr.arpa." {

Regex Note: Have to remove the trailing root domain “.”

Test Regex:

[root@bigip1:Active] config # for i in `egrep zone /var/named/config/named.conf | sed -e 's/.*\"\(.*\)\.\".*/\1/g'`; do echo "tmsh create ltm dns dns-express zone $i transfer-target 172.24.0.1"; done
tmsh create ltm dns dns-express zone f5se.com transfer-target 172.24.0.1
tmsh create ltm dns dns-express zone dc-r-d.platarc.glbdns.example.com transfer-target 172.24.0.1
tmsh create ltm dns dns-express zone 0.70.10.in-addr.arpa transfer-target 172.24.0.1

To actually create the zones:

[root@bigip1:Active] config # for i in `egrep zone /var/named/config/named.conf | sed -e 's/.*\"\(.*\)\.\".*/\1/g'`; do echo "creating dns-express-zone $i"; tmsh create ltm dns dns-express zone $i transfer-target 172.24.0.1; done
creating dns-express-zone f5se.com
creating dns-express-zone dc-r-d.platarc.glbdns.example.com
creating dns-express-zone 0.70.10.in-addr.arpa

To do the same in 11.5.x as DNS Express zones are now just DNS Zones:

[root@bigip1:Active] config # for i in `egrep zone /var/named/config/named.conf | sed -e 's/.*\"\(.*\)\.\".*/\1/g'`; do echo "Creating dns zone $i"; tmsh create ltm dns zone $i dns-express-server 172.24.0.1; done

If pointing to local bind, just replace target ip "172.24.0.1" with localhost "127.0.0.1". In 11.5.x you need to define the nameserver you're transfering from before you can create the DNS zone.

Code :

# see above
Comments
Wand_97484
Nimbostratus
Nimbostratus
Thanks for sharing we are moving our ~7000 zone to DNS Express atm. If your named.conf contains zone with mixed case, convert it to to lower case with the additional awk: for i in `egrep zone /var/named/config/named.conf | sed -e 's/.*\"\(.*\)\.\".*/\1/g' | awk '{print tolower($0)}'`;
Version history
Last update:
‎10-Mar-2015 11:38
Updated by:
Contributors