Script to update DNS Entry
I have a domain name for free from dyndns, but I don't have a static IP. I imagine that it could be updated every once in a while with a cron entry activating a script to automatically collect my current IP and update it on the dyndns page.
My abilities with scripting go little beyond basic commands and purely local operations. If anyone could could point me to some good resources to figure out how to do it, or write the script for me, I would be much obliged.
nogoma wrote:The dyndns site recommends a couple of tools here; I used to used one of them. However, nowadays I use the functionality built into my router for this. A lot of modern routers do this, you might want to check that out if you have one.
+1 for everything in there
Don't reinvent the wheel unless you have to
Similar Messages
-
I am looking for ways to update DNS entries in our DNS server on the fly from a Java web app. For example: Users can select a domain and modify its ip on the Java web site, then the DNS record is updated automatically.
Is this possible? Please help...812256 wrote:
I am looking for ways to update DNS entries in our DNS server on the fly from a Java web app. For example: Users can select a domain and modify its ip on the Java web site, then the DNS record is updated automatically.
Is this possible?This is what happens when 'bind' and 'dhcp' work together - dhcp submits updates to bind.
You want to submit updates to 'bind' yourself - that should be possible but
you will need to "open up" your dns server so 'bind' accepts these updates from the machines that are allowed to submit them
and you will need to implement the appropriate protocol or find a library that does it. -
DNS entry for DC not dynamically updating (Server 2008 R2)
Windows Server 2008 R2. I've got a single DC (I'm preparing to install the 2nd in the next few days). The host (A) record for the DC shows to be static for some reason. I changed the name of the DC recently, then brought down the Exchange server and rebooted
and it successfully connected again. I might have entered in a static DNS entry for the new server name before renaming the server, but I'm not sure.
I've tried to delete the static DNS record for the DC and then reload, but it continues to appear as a static entry. The mail server's DNS record still appears as a dynamic entry.
What am I doing wrong?
Noel Stanford Oveson
jeremyNLSO
MCTS, MCITP, CCENT, CNE, MCSE, CLSE
Berlin, GermanyHello,
Like Mike suggested, it is normal that it is a static record.
However, if your DC with its new name is not updating its DNS record, check that "Register this connection' addresses in DNS" is checked on the DC's adapter and then run
ipconfig /registerdns using an elevated prompt.
This
posting is provided "AS IS" with no warranties or guarantees , and confers no rights.
Microsoft
Student Partner 2010 / 2011
Microsoft
Certified Professional
Microsoft
Certified Systems Administrator: Security
Microsoft
Certified Systems Engineer: Security
Microsoft
Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
Microsoft
Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration
Microsoft
Certified Technology Specialist: Windows Server 2008 Applications Infrastructure, Configuration
Microsoft
Certified Technology Specialist: Windows 7, Configuring
Microsoft
Certified Technology Specialist: Designing and Providing Volume Licensing Solutions to Large Organizations
Microsoft Certified IT Professional: Enterprise Administrator
Microsoft Certified IT Professional: Server Administrator
Microsoft Certified Trainer -
Server 2008 RRAS Internal adaptor causing duplicate DNS entry for host
I have Server 2008 configured with AD, DNS, DHCP and Routing and Remote Access. The Server is set-up with a static IP address 192.168.127.2 and the DHCP allocates addresses in the range 192.168.127.100/199 to clients. The RRAS is automatically configured with three adaptors "Loopback" (127.0.0.1), "Local Area Connection" (192.168.127.2) and "Internal" (192.168.127.112 allocated by DHCP).
The problem is that there are two entries created in DNS for the host, MYSERVER 192.168.127.2 and MYSERVER 192.168.127.112. This cause a problem with the client computers when they do a DNS lookup in that the MYSERVER ip address is sometimes returned as 192.168.127.112 at logon causing network shares assignment in the logon script to fail (among others). If the DNS entry is deleted manually everything functions again for a while until the DNS entry is mysteriously created again.
Can anyone help???I agree with Bill, you should not run RRAS service on DC.
If you need workaround
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Adapters\<Interface name>\MaxNumberOfAddressesToRegister
Data type: REG_DWORD
Range: 0x0 - 0xFFFFFFFF
This setting determines the maximum number of IP addresses that can be registered in DNS for this adaptor.
If the value of this entry is 0, IP addresses cannot be registered for this adaptor.
OR
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\<Interface name>\DisableDynamicUpdate
0 Enables DNS update registration
1 Disables DNS update registration
Please place one of above registry key for adapter that you don't want to register in DNS.
Hope this helps. -
Active Directory client not dynamically updating DNS
Hi,
There has been some other issues mentioned on other threads regarding the Active Directory Plugin within Lion, it does appear to be flaky.
I just wanted to make sure that the issue I'm having is not down to a mis-config by myself.
We have several Macs running 10.7.1 and are bound into Active directory (Windows 2008 r2) however, it appears that the DNS records for these machines are not being dynamically created within AD. (All Zones are AD intergrated) All 10.6.x clients seem to work fine and records are created and updated dynamically as IPs change etc.
Is anybody else having this issue? If not, any ideas why this is happening?
Thanks in advance.Hi!
I'm having exactly the same problem and nobody seems to have an answer.
Regarding the reply you got, this has nothing to do with Lion Server. We're talking about Lion clients bound to an AD (Windows Server 2008 R2, in my case) not dynamically registering their DNS entries.
I also noticed that the DHCP entries for those clients are missing the "Name" property, which is already symptomatic of something going wrong.
Anyone? -
Hi all,
I would like to know if there exists any API method to add a DNS entry from an authorized client on a DNS server in the network. The DNs server supports dynamic updation.
thanks in advance
SudheeshDo you get any solution ?
-
I recently had a server that's ip changed. I set it up as static, the hostname appeared fine. I ran changeip -checkhostname and got the new ip address with the hostname x.x.x and it said that the dns entries were bad and needed to be repaired. I did changeip old ip new ip and it said I needed to match the hostname too so I did changeip o n o n for both. It looked like everything went fine. Still able to connect and I rebooted too I think. Then I went to dns and edited the primary zone, a record, web service and reverse zone. I removed them all at one point and tried to re-add them. Whatever I tried whenever I tried to enter all the information for both after pressing save it deleted all entries except the primary zone which didn't have a nameserver listed. I'm sure that I entered all the information correctly except the primary zone name may be x.x.x where before it was x.x. I tried both x.x.x and x.x and neither would save. At one point I restarted and there weren't any entries listed there save the one incomplete one and now I can't access the server because I think its dns info isn't valid. A ping brings nothing. So I have to help someone change the information. Can anyone help with this? changeip -checkhostname and host both came back fine with the exception that the dns entries needed to be changed in the first.
Also, the hostname is a registered hostname but because the ip changed recently when setting up a new router dyndns hasn't been updated. I don't know if this causes a problem when trying to save a dns record without it being able to identify the hostname or not.One other thing is that whenever it would auto create a reverse zone or even in the primary one, the default ip listed before I change it is always 10.0.0.1 instead of 10.0.1.7 which is what it is now. It has never been the former that I know of. When setting up the reverse zone, the entry looked correct but I couldn't change it It had the reverse ip minus 7. at the beginning. That didn't seem right and when I tried to change it it just kept what was listed.
-
Servermgr_dns: no reverse DNS entry for server
Hi all,
After installing and configuring OS X Server, Tiger, I realized I had given the machine the wrong IP-address. After changing it, I'm getting the following errors every half hour:
Jun 28 12:54:26 g4 servermgrd: servermgr_dns: no name available via DNS for 10.0.0.3
Jun 28 12:54:26 g4 servermgrd: servermgr_dns: no reverse DNS entry for server, various services may not function properly
Can anyone enlighten me, as to wether this is something serious or not. The server is running fine, so it isn't mission critical, but you know, nobody likes error messages
PowerMac G4, Dual 1.25, 768 MB RAM, Pro ADSL 4096/768 Mac OS X (10.4.6) Mac OS X Tiger Serverlook at changeip
<pre>
~>man changeip
changeip(8) BSD System Manager's Manual changeip(8)
NAME
changeip -- Change IP adress related configuration.
SYNOPSIS
changeip -checkhostname
changeip [directory-node | -] old-ip new-ip [old-hostname new-hostname]
DESCRIPTION
changeip is used to update configuration records when a server's IP
address changes or check/fix the hostname of the server. It needs to be
run by root on the machine who's IP address is changing. If the machine
is hosting a parent directory (NetInfo or LDAP) or is connected to a par-
ent directory, then the Open Directory path to the node must be used (eg
/LDAPv3/192.12.0.43). Otherwise use a dash ("-") for the directory node
argument. The tool may prompt for an admin user name and password for
the directory node. After the tool has successfully completed, change
the network settings in the Network Control Panel and reboot the server.
</pre>
you need to run this when you change your servers ip
hope this helps. -
Event Manager question. Monitoring DNS entry.
Hello everybody,
I want to use Cisco Embedded Event Manager in a router for monitoring a DNS entry that normally resolves 1.1.1.1 but if it changes to 2.2.2.2 the router has to change some access list automatically in order to permit different routes.
I know how to configure de "action" sentences for change the ACLs but I dont know how to configure a track or a SLA in order to check the DNS entry and react if it changes.
Someone knows how to do that?
event manager applet ChangeRoutesWhenDNSEntryChanges
event track 21 state ??????????????????????????????????????????????????<----------
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "ip access...
Thank you in advance!!
Marcos.Indeed, I just provided the above example to demonstrate how we can force a DNS lookup and parse the IP address...
I was actually thinking about using the IP SLA DNS probe, but I could not find a way to get the IP address from the results... It just shows the response time.
In order to make the script work, we would most likely need to use some timer to trigger it periodically.
This is an adaptation of my previous example to actually accomplish a periodic check:
event manager applet CHECK-DNS
event timer watchdog time 60
action 1.0 cli command "ena"
action 1.1 cli command "ping host1 repeat 1 timeout 0"
action 2.0 regexp "ICMP Echos to (.*), timeout is 0 seconds:" "$_cli_result" _match _ip
action 3.0 if $_ip ne 1.1.1.1
action 4.0 syslog msg "host1 is now $_ip"
action 5.0 end
If you want to do something as a reaction to detecting the change, that would have to go into the "4.0" block (you can use 4.1, 4.2 etc)
Another thing to consider is that this script would run every minute, so as long as the DNS query resolves to anything but 1.1.1.1 we would re-apply the config changes, which is not that good...
A way to solve this can be seen in the next example:
event manager applet HOST1-NOT-1.1.1.1
event timer watchdog time 60
action 1.0 cli command "ena"
action 1.1 cli command "ping host1 repeat 1 timeout 0"
action 2.0 regexp "ICMP Echos to (.*), timeout is 0 seconds:" "$_cli_result" _match _ip
action 2.1 track read 100
action 3.0 if $_ip eq 1.1.1.1
action 4.0 if $_track_state eq down
action 4.1 track set 100 state up
action 4.2 syslog msg "host1 is now 1.1.1.1 again"
action 4.9 end
action 5.0 else
action 6.1 if $_track_state eq up
action 6.2 track set 100 state down
action 6.3 syslog msg "host1 is not 1.1.1.1, new ip is $_ip"
action 6.9 end
action 7.0 end
Basically we are using a stub tracking object to maintain state. Track object 100 would be up if we know host1=1.1.1.1, but if we detect it is something else we change it to down. Only after we detect that host1=1.1.1.1 again we change the track object back to up, which would enabled detecting another change...
Any actions you want to take should go into section "6" and any clean up (when host1=1.1.1.1 again) has to go into section "4".
It is possible to make this detect any change and not just have a static 1.1.1.1 value by assigning the newly detected value to a variable and basically look for a change... Not sure what is your requirement.
The output below shows how this works...
Router#show run | inc ip host
ip host host1 1.1.1.1
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip hos
Router(config)#ip host host1 2.2.2.2
Router(config)#^Z
Router#
*Nov 9 18:23:18.009: %TRACKING-5-STATE: 100 stub Up->Down
*Nov 9 18:23:18.021: %HA_EM-6-LOG: HOST1-NOT-1.1.1.1: host1 is not 1.1.1.1, new ip is 2.2.2.2
Router#
*Nov 9 18:23:18.065: %SYS-5-CONFIG_I: Configured from console by console
Router#
Router#
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip host host1 1.1.1.1
Router(config)#^Z
Router#
*Nov 9 18:23:42.805: %SYS-5-CONFIG_I: Configured from console by console
Router#
*Nov 9 18:24:18.025: %TRACKING-5-STATE: 100 stub Down->Up
Router#
*Nov 9 18:24:18.033: %HA_EM-6-LOG: HOST1-NOT-1.1.1.1: host1 is now 1.1.1.1 again -
Lil' script to update adblockfilter, adblocking via /etc/hosts file
hi, i've recently changed to adblocking via the hosts file (which works great btw), but i was missing filtersetupdating like in firefox, so i've created with my limited scripting skills this one...
# lil' script to update /etc/hosts adblock-filter
#hosts adblock filter taken from this site...
wget --directory-prefix=/tmp http://www.mvps.org/winhelp2002/hosts.txt
#Backup /etc/hosts to /tmp
cp /etc/hosts /tmp
#standard static hosts file
echo '# /etc/hosts: static lookup table for host names' > /etc/hosts
echo '#' >> /etc/hosts
echo '#<ip-address> <hostname.domain.org> <hostname>' >> /etc/hosts
echo '127.0.0.1 localhost.localdomain localhost' >> /etc/hosts
#add custom statc host configuration here
echo ' ' >> /etc/hosts
echo '###Ad-Blocking###' >> /etc/hosts
cat /tmp/hosts.txt >> /etc/hosts
echo '# End of file' >> /etc/hosts
rm /tmp/hosts.txt
enjoy!hosts_udate
#!/bin/bash
# 2012 Ontobelli for this script
# make hosts temporal directory
HOSTSDIR=~/.hostsupdate
mkdir -p "${HOSTSDIR}"
# make temporary directory
TMPDIR=/tmp/hostsupdate
mkdir -p "${TMPDIR}"
# set output file
OUTPUTFILE="${TMPDIR}/hosts"
# set temporal file
TMPFILE="${TMPDIR}/tmpfile"
if [ ! -f "${HOSTSDIR}/hosts.local" ]; then
echo "You need to create "${HOSTSDIR}"/hosts.local containing the hosts you wish to keep!"
exit 0
fi
# download the mvps.org hosts file.
wget -c -O "${HOSTSDIR}/hosts.mvps" "http://winhelp2002.mvps.org/hosts.txt"
# download hpHOSTS
wget -c -O "${HOSTSDIR}/hosts.hphosts" "http://support.it-mate.co.uk/downloads/HOSTS.txt"
# download hpHOSTS Partial
wget -c -O "${HOSTSDIR}/hosts.partial" "http://hosts-file.net/hphosts-partial.asp"
# download hpHOSTS ad/tracking servers
wget -c -O "${HOSTSDIR}/hosts.adservers" "http://hosts-file.net/ad_servers.asp"
# download the pgl.yoyo.org hosts Peter Lowe - AdServers
wget -c -O "${HOSTSDIR}/hosts.yoyo" "http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext"
# download SysCtl Cameleon hosts
wget -c -O "${HOSTSDIR}/hosts.sysctl" "http://sysctl.org/cameleon/hosts"
# cat entries in a single file
cat "${HOSTSDIR}/hosts.mvps" > "${TMPFILE}0"
cat "${HOSTSDIR}/hosts.hphosts" >> "${TMPFILE}0"
cat "${HOSTSDIR}/hosts.partial" >> "${TMPFILE}0"
cat "${HOSTSDIR}/hosts.adservers" >> "${TMPFILE}0"
cat "${HOSTSDIR}/hosts.yoyo" >> "${TMPFILE}0"
cat "${HOSTSDIR}/hosts.sysctl" >> "${TMPFILE}0"
# tabs to space
sed -e 's/ / /g' "${TMPFILE}0" > "${TMPFILE}1"
# find relevant lines without comments
grep ^127.0.0.1 "${TMPFILE}1" > "${TMPFILE}2"
# remove duplicate spaces
cat "${TMPFILE}2" | tr -s [:space:] > "${TMPFILE}3"
# remove carriage returns
cat "${TMPFILE}3" | tr -d "\r" > "${TMPFILE}4"
# 0.0.0.0 is nicer than constantly knocking on localhosts' door.
sed -e 's/127.0.0.1 /0.0.0.0 /g' "${TMPFILE}4" > "${TMPFILE}5"
# remove inline comments
cut -d ' ' -f -2 "${TMPFILE}5" > "${TMPFILE}6"
# sort blocklist entries and remove duplicates
sort "${TMPFILE}6" | uniq > "${TMPFILE}7"
# remove unneeded blocked sites
grep -Ev ' dl.dropbox.com| host_you_want_to_whitelist' "${TMPFILE}7" > "${TMPFILE}9"
# write the user's hosts.local to head, then the blacklists
cat "${HOSTSDIR}"/hosts.local > "${OUTPUTFILE}"
cat "${TMPFILE}9" >> "${OUTPUTFILE}"
echo -e "# end of file" >> "${OUTPUTFILE}"
# move to /etc/hosts
mv "${OUTPUTFILE}" /etc/hosts
# delete temporary directory
rm -r -f "${TMPDIR}"
hosts.local
# /etc/hosts: static lookup table for host names
#<ip> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost YOURHOSTSNAMEHERE
::1 localhost.localdomain localhost YOURHOSTSNAMEHERE
# YOUR PERSONAL list
# blocked list
Create an alias in your ~/.bashrc
alias hu='sudo /root/.hostsupdate/hosts_update'
Run
# hu <enter>
Script and cache must be located in /root/.hostsupdate or modify scrip accordingly
Cheers.
Last edited by ontobelli (2012-02-15 09:15:17) -
Dear All,
I have formed a CAS Array (two members servers are part of it.
DNS entry for CAS array with IP address is "cas.testlab.local" and IP address is 10.10.10.1
As mentioned above Two members are part of my Array that is
Memsrv-1 and memsrv-2 with ips respectively (10.10.10.1 & 10.10.10.2)
What I wish is if Member server 1 goes down then IP address or CAS array should change to 10.10.10.2
and when member server 2 goes down then IP address or CAS array should change to 10.10.10.1
is it possible thru Powershell scripting I am not sure so requesting help
TheAtulAIf by 'CAS' you're referring to an Exchange Client Access Server array, use NLB. That's how I handle this and it works very well.
EDIT: While what Robert has posted may work, you'll have to be running the script constantly and is most likely not how the product is intended to be load balanced.
Example documents:
Exchange 2013:
https://technet.microsoft.com/en-us/library/jj898588%28v=exchg.150%29.aspx
Exchange 2010:
https://technet.microsoft.com/en-us/library/ff625247%28v=exchg.141%29.aspx
I highly recommend looking into the documentation and using a supported method.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
Hi,
I am setting up the WRT54GS to use my own static DNS servers inside the
text fields "Static DNS 1-3" under the setup tab. I just want to confirm
the router will use the DNS servers in numerical order? That is DNS server 1 will be used first and DNS server 3 will be used as a last resort. It seems intuitive the router would work this way BUT I want to confirm this before relying upon the feature.
Also can the router automatically use the DNS servers provide by the ISP
if user specified DNS servers noted are not operational?
Thanks,Assuming you are using DHCP, configure your router with the DNS servers in the order you want. From your PC go to a command prompt and insure you have the updated IP config by typing in ipconfig /renew. Then type ipconfig /all. The output provided will tell you the order of DNS servers that will be tried.
Your second question:
The router will not use the default ISP DNS servers if your hardcoded DNS servers fail. By typing in DNS entries in the router, your are overidding the DHCP feature in your router. -
Hi
I've heard that by updating the primary and alternate DNS entries for mobile browsing, the speed of pages loading can be increased. The article is here (www.pcpro.co.uk/links/155mob1) but only includes instructions on how to do this for Pocket PC/Windows Mobile devices.
I'd like to try this on my N73, but the problem seems to be that the Contract Internet settings are protected and can't be updated or even copied.
Is there a way to find these settings and set up a new access point then enter the new DNS addresses?
I've looked on the net for these without success.
Thanks for any help.Hi Shawn,
I am looking for another feature:
As the ISA akts as an DNS forwarder, I want to add specific DNS records to the Box. This scenario is especially for small networks not having a DNS server implemented, to resolve internal services - or this can be used for a special DNS rewriting.
How can I add hosts records to the DNS resolver?
Regards Mike -
Content query web part is not working after chaning the DNS entry
Hi all,
We have a content query web part in the sharepoint site but it is not working after changing the DNS Entry for the web site ipaddress from one server to other . But it is working fine on the server, if we try to access the site from other system content
quey server its not working fine and its giving error message as bellow.
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Can anyone help me to fix this issue please.I have custom XSLT . But it is working fine before changing the dns entry as soon as we change the DNS entry the content quey web part is not working. I tried to delete the content query web part and add it once again to the page, As soon as content query
web part is added to the page the fallowing error message is displayed.
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Can anyone help me to fix this issue please. -
How to add DNS entry Post Installation in Solaris 10?
Hi, I have installed Solaris 10 without mentioning the DNS entry while installation. How do I add that now in order to make that Solaris 10 to get connected to Internet ?
Thanks in Advance.
Girish Prabhakara.Solaris 10 changed the way that some things work regarding networking, but this should still work.
1. Change the hosts: line in /etc/nsswitch.conf to include dns.
For example, change:
hosts files
to
hosts files dns
2. Create /etc/nsswitch.conf with the IP addresses of your DNS servers:
Example:
nameserver 192.168.1.100
nameserver 192.168.2.100
3. kill -HUP 1
4. Run nslookup or ping another server via host name (not IP address) to determine if the system is properly communicating with your DNS servers.
Maybe you are looking for
-
No HDMI Audio, Failed to Play Test Tone, Can't Change Default Playback Device
Hello, I'm experiencing some real trouble with my HP Pavilion dv6-2160us (with the i3-330M, no dedicated graphics) Windows 7-64 bit, SP1 PC, and I would greatly appreciate some assistance. I've created a new thread because, despite the fact that many
-
This has probably been asked before but I can not see any posts relevant, I purchased a BlackBerry 8320 off eBay and I am trying to see up email, when I put the Pin & IMEI in it says already registered, I have spoken to the old owner to get him to re
-
problem arise as soon as i start firefox only firefox is freezing while i can do other things with my pc, ie run with out any problem, but i'm prefer firefox want to get it to work again,only clue ihad is that erroe msg ,please help me.
-
Problem in MD04 with schedule lines ME38
Hello gurus, I've got a problem with ME38 and MD04. ME38 shows some quantity schedules on a date but in MD04 these schedules are not shown. Thanks for support.
-
What is organizational structure?
Hi All, I searched in sap help, found the definition of "Organizational Structure"(such as company code, purchase organization and so on) is hard to understand. Could you provide answers to my questions below: 1. what is org. structure in sap? 2. dif