Wednesday, March 6, 2019

Automating forward and reverse DNS records for all L3 interfaces directly from NPM

Spent some time over the past few months looking at another aspect of network automation: DNS records management.

I started out looking to clean up our stale BIND9 zones, and ended up with a script that mostly automates the whole process, reading node/interface data from the SolarWinds NPM API and spitting out BIND9 zone/config files for both forward and reverse lookup zones.

My pings and traceroutes are much prettier now :)

$ ping example-router PING example-router-1g-te-1-1-8.example.net (10.250.20.66) 56(84) bytes of data. 64 bytes from example-router-1g-te-1-1-8.example.net (10.250.20.66): icmp_seq=1 ttl=252 time=1.69 ms 64 bytes from example-router-1g-te-1-1-8.example.net (10.250.20.66): icmp_seq=2 ttl=252 time=2.03 ms 64 bytes from example-router-1g-te-1-1-8.example.net (10.250.20.66): icmp_seq=3 ttl=252 time=1.92 ms 64 bytes from example-router-1g-te-1-1-8.example.net (10.250.20.66): icmp_seq=4 ttl=252 time=1.86 ms [austind@prod ~]$ traceroute 8.8.8.8 traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets 1 idf4-1g-v-10.example.net (172.16.32.1) 0.484 ms 0.547 ms 0.593 ms 2 agg1-10g-eth-2-48.example.net (10.250.20.6) 0.444 ms 0.549 ms 0.666 ms 3 pa-10g-eth-1-22.example.net (10.250.34.34) 0.616 ms 0.592 ms 0.578 ms 4 border-in-40g-hu-1-0-49.example.net (205.155.219.50) 0.872 ms 0.855 ms 0.779 ms 5 border-out-1-te-0-0-2-2.example.net (205.155.198.240) 1.504 ms 1.673 ms 1.650 ms 6 sac-agg2--but-coe-1-10g.cenic.net (137.164.50.236) 7.160 ms 6.515 ms 5.411 ms 7 oak-agg4--sac-agg4--100ge.cenic.net (137.164.46.34) 6.554 ms 7.099 ms 7.045 ms 8 74.125.48.172 (74.125.48.172) 7.528 ms 7.539 ms 7.516 ms 9 108.170.242.225 (108.170.242.225) 8.148 ms 108.170.242.81 (108.170.242.81) 7.972 ms 108.170.243.1 (108.170.243.1) 9.379 ms 10 209.85.240.169 (209.85.240.169) 7.957 ms 209.85.240.175 (209.85.240.175) 8.027 ms 108.170.232.69 (108.170.232.69) 8.049 ms 11 google-public-dns-a.google.com (8.8.8.8) 7.728 ms 7.787 ms 7.718 ms 

The codebase is premature and built around our environment (SolarWinds & BIND9), but I thought I'd share in case it's helpful.

github



No comments:

Post a Comment