Re: How to update DNS record
Andi Clemens wrote: > > It's working!!! > Yeah! > I don't know why I didn't get this the first time I tried dnspython, but now > its working! And it's so easy, 3 lines of code: > > def make_dns_entry(pix): > update = dns.update.Update(_DOMAIN) > update.replace(pix.name, 3600, 'a', pix.outbound) > response = dns.query.tcp(update, _NAMESERVER) > > Thank you for all your help! > > Andi Glad to be of service! -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: How to update DNS record
Andi Clemens wrote: > It's working!!! > Yeah! > I don't know why I didn't get this the first time I tried > dnspython, but now its working! And it's so easy, 3 lines of code: Great, thanks for reporting back. Regards, Björn -- BOFH excuse #310: asynchronous inode failure -- http://mail.python.org/mailman/listinfo/python-list
Re: How to update DNS record
Martin P. Hellwig wrote: > I'll looked at the perl function you mentioned and it seems to me (but > I'm not a pearl coder) that it uses the dynamic update procedure, which > is explained by the RFC 2136 (Bjoern mentioned that already). > > So I googled for "Python DNS dynamic update" and in the results the > following site looked promising, http://www.dnspython.org/. > > hth > > -- > mph It's working!!! Yeah! I don't know why I didn't get this the first time I tried dnspython, but now its working! And it's so easy, 3 lines of code: def make_dns_entry(pix): update = dns.update.Update(_DOMAIN) update.replace(pix.name, 3600, 'a', pix.outbound) response = dns.query.tcp(update, _NAMESERVER) Thank you for all your help! Andi -- http://mail.python.org/mailman/listinfo/python-list
Re: How to update DNS record
Andi Clemens wrote: > Hi, > > I want to update our DNS servers periodically with some IP addresses. But I > don't know how to do this. > I searched the Internet quite a while but I haven't found a good example how > to do this. > I want to change the A-Record for some IPs, this shouldn't be too hard. > I looked at dnspython and twisted, but I really don't have a clue how to do > this. > Has anyone done this before? > > Andi I'll looked at the perl function you mentioned and it seems to me (but I'm not a pearl coder) that it uses the dynamic update procedure, which is explained by the RFC 2136 (Bjoern mentioned that already). So I googled for "Python DNS dynamic update" and in the results the following site looked promising, http://www.dnspython.org/. hth -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: How to update DNS record
Hi, I'm just a trainee working here and I don't really know how the old Perl script worked. But I can post the function, maybe you can recognize what is going on there: my $domain = "wiv-dom.com"; my $nameserver = "bldc01.wiv-dom.com"; sub makeDNSEntry { my $res = new Net::DNS::Resolver; my $query = $res->query("$domain", "NS"); if ($query) { print "\nMaking entries into nameserver...\nSearching for nameservers...\n\n" if $opt{d}; foreach my $rr ($query->answer) { next unless $rr->type eq "NS"; print $rr->nsdname, "\n" if $opt{d}; } } else { print "query for Nameserver for $domain failed: ", $res- >errorstring, "\n"; } my $update = new Net::DNS::Update("$domain"); $update->push("pre", yxrrset("$snmpHostName.$domain. A")); $update->push("update", rr_del("$snmpHostName.$domain. A")); $update->push("update", rr_add("$snmpHostName.$domain. 3600 A $outbound")); $res = new Net::DNS::Resolver; $res->nameservers("$nameserver"); print "\nNameserver for $domain :" . $nameserver, "\n" if $opt{d}; my $reply = $res->send($update); if (defined $reply) { if ($reply->header->rcode eq "NOERROR") { print "Update for $snmpHostName.$domain. OK\n" if $opt{d}; } else { print "Update for $snmpHostName.$domain. ERROR : ". $reply- >header->rcode. "\n" if $opt{d}; } } else { print "RESERROR : No reply: ". $res->errorstring. "\n"; } } What I want to do is change the A-Record of existing entries in the DNS server. I'm getting all the IPs from a django database and ask them via SNMP what their outbound address is, then I want to change those settings in our DNS server like in the perl script above. Sorry for my bad explanation, but I never worked with DNS before... Andi -- http://mail.python.org/mailman/listinfo/python-list
Re: How to update DNS record
On 1 Mar 2007 04:14:23 -0800, [EMAIL PROTECTED] wrote: >On Mar 1, 10:33 am, Bjoern Schliessmann [EMAIL PROTECTED]> wrote: >> Read RFC 2136 (Dynamic updates in the DNS) and see if your server >> can be configured to do this. If not, you'll have to change the >> zone files manually and reload the DNS config. > >It worked before with a perl script, but now I'm using django for all >our web services so I want to implement this update function in Python >as well. >I don't know how to do this in Python, right now I'm trying it with >twisted, but I don't what to do exactly. It would be nice if somebody >has an example for doing this. > You need to provide more details. There is no one way to change the configuration of a DNS server. Different servers have different features and different interfaces. A start would be to specify which DNS server software needs to be reconfigured. You might also want to include an example of what kind of change you want to make. For example, do you want to add and delete records? Do you want to change the address of associated with an existing A record? Are all your changes in a single zone? etc. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: How to update DNS record
[EMAIL PROTECTED] wrote: > It worked before with a perl script, but now I'm using django for > all our web services so I want to implement this update function > in Python as well. > I don't know how to do this in Python, right now I'm trying it > with twisted, but I don't what to do exactly. It would be nice if > somebody has an example for doing this. No one here knows how the server is configured or how the perl script did it before, so there's little chance someone will have an example that works for you. Regards, Björn -- BOFH excuse #280: Traceroute says that there is a routing problem in the backbone. It's not our problem. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to update DNS record
On Mar 1, 10:33 am, Bjoern Schliessmann wrote: > Read RFC 2136 (Dynamic updates in the DNS) and see if your server > can be configured to do this. If not, you'll have to change the > zone files manually and reload the DNS config. It worked before with a perl script, but now I'm using django for all our web services so I want to implement this update function in Python as well. I don't know how to do this in Python, right now I'm trying it with twisted, but I don't what to do exactly. It would be nice if somebody has an example for doing this. Andi -- http://mail.python.org/mailman/listinfo/python-list
Re: How to update DNS record
Andi Clemens wrote: > I want to change the A-Record for some IPs, this shouldn't be too > hard. I looked at dnspython and twisted, but I really don't have a > clue how to do this. > Has anyone done this before? Read RFC 2136 (Dynamic updates in the DNS) and see if your server can be configured to do this. If not, you'll have to change the zone files manually and reload the DNS config. Regards, Björn -- BOFH excuse #203: Write-only-memory subsystem too slow for this machine. Contact your local dealer. -- http://mail.python.org/mailman/listinfo/python-list