[Pdns-users] define several IP Subnet for one service in GeoIP backend

Hamed Haghshenas haghshenas at chavoosh.com
Tue Apr 24 06:27:22 UTC 2018


Thanks dears,

 

From: Brian Candler [mailto:b.candler at pobox.com] 
Sent: Monday, April 23, 2018 6:43 PM
To: Hamed Haghshenas <haghshenas at chavoosh.com>;
pdns-users at mailman.powerdns.com
Subject: Re: [Pdns-users] define several IP Subnet for one service in GeoIP
backend

 

On 23/04/2018 10:36, Hamed Haghshenas wrote:

I know, it's work with your example but I have many client subnet in my
network about 150 subnets .

 

So a little hard to write every subnet in separated line,I want to find a
way to combine these in one line for every service .

The configuration is YAML, so it's very easy to write a script to convert
from some local representation (in whatever format is convenient for you to
maintain) to the format that PDNS requires.

 

#!/usr/bin/python
import yaml

s1 = yaml.load("""
193.178.201.0/24,188.158.188.0/24: tcar.geo.gadgetworld.ir
""")
s2 = {}

for k, v in s1.items():
    for i in k.split(","):
        s2[i] = v

print(yaml.dump(s2, default_flow_style=False))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20180424/8f46af99/attachment.html>


More information about the Pdns-users mailing list