1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Does anyone have a Windows script to update DNS for failover to second server-not RR

Discussion in 'Networking' started by VictorMier, Jul 17, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. VictorMier

    VictorMier Thread Starter

    Joined:
    May 16, 2006
    Messages:
    6
    I am looking for a script that will dynamically update Windows 2003 DNS (AD) to the second server when the first server fails. The servers are appliance servers (not windows).

    Does anyone have a script to do this?

    Example of script function:
    1. ping first server every 10 seconds
    2. if no ping reply for 60 seconds DDNS the search.x.com DNS A and PTR record to the second box.
    3. if the first server becomes available again for 120 seconds then DDNS the search.x.com DNS A and PTR record to the first box again.
    end
     
  2. wisdum

    wisdum

    Joined:
    Dec 1, 2005
    Messages:
    131
    You should be able to set this all up in DNS itself. That is why they have primary/secondary features. I think you just need to dive a bit deeper into DNS.. I dont know off the top of my head how to do what you want, i just know it can be done, without a script.

    Also, you said you want 2003 AD's DNS to update between the two servers, but they aren't windows servers??? Please clarify.


    Sorry, i know im not much help... but maybe this will point you in the right direction:

    http://www.microsoft.com/windows2000/en/advanced/help/default.asp?url=/windows2000/en/advanced/help/sag_TCPIP_imp_AdvancedConfiguration.htm

    This covers some advanced DNS for 2000 server, but all the principles (as far as i know!) are the same.

    Good luck

    wis
     
  3. VictorMier

    VictorMier Thread Starter

    Joined:
    May 16, 2006
    Messages:
    6
    Wisdum,

    Thanks for the post.

    The DNS servers are 2003 AD with secure DDNS. The primary and secondary servers are Google appliances (non-windows).

    Currently have A & PTR records for each GSA using the same name.

    I.e.
    A record as search.domain.com 192.x.x.50
    A record as search.domain.com 192.x.x.51

    I did not see a way in the GUI, if you know how to set using another Windows tool that would be great.
     
  4. VictorMier

    VictorMier Thread Starter

    Joined:
    May 16, 2006
    Messages:
    6
    Wisdum,

    Sorry forgot to mention.

    The solution must be failover. NOT load balancing as it is currently.

    The GSAs have identical content.

    Thanks
     
  5. wisdum

    wisdum

    Joined:
    Dec 1, 2005
    Messages:
    131
    I know when i was first taking Windows Server classes in college that we did most of our DNS/DDNS from command line. Im sorry i can't be more help, i just dont remember as i dont have to deal with it on a daily basis.

    I would try and research command line DNS features for creating failover zones (man, im rusty!)

    good luck

    wis
     
  6. VictorMier

    VictorMier Thread Starter

    Joined:
    May 16, 2006
    Messages:
    6
    Wisdum,

    I appreciate your assistance. Please let me know if you or anyone else has a solution.

    I see that this forum is run on a Google GSA applicance. Does the forum owner know?

    Thanks in advance.
     
  7. O111111O

    O111111O

    Joined:
    Aug 26, 2005
    Messages:
    894
    A record as search.domain.com 192.x.x.50
    A record as search.domain.com 192.x.x.51

    Both IP's are entered as same hostname, therefore it's round robin.

    You can try disabling DNSCLIENT on the client systems in question, therefore they won't cache DNS entries. This will allow clients to truely round robin. Also set your TTL really low (i.e. 30 seconds)

    Usually I configure HA DNS entries with a content switch. If you're looking for high availability, I don't know that relying on a script is the way to go.
     
  8. O111111O

    O111111O

    Joined:
    Aug 26, 2005
    Messages:
    894
    Here. Install Perl5, connect to CPAN and download pdump/net modules. This'll allow you to test connection on the appliance with ICMP or TCP connect to port 80/443.

    Create batch file, execute script from batch file to destination host. Error code 1 = host not up. On error code 1, copy new DNS zone over your DNS server (you need to make those). Net stop/start the DNS server.

    #!/usr/bin/perl

    use pdump::Sniff;
    use Net::ping;

    die "usage: $0 <host>\n" unless @ARGV == 1;
    $| = 1;
    $tout = 10;
    $host = $ARGV[0];
    $dev = pdump::Sniff::lookupdev($tout);
    $ip = ${ifaddrlist()}{$dev};
    $packet_tcp = new pdump::Sniff({tcp=>{}});
    $filt_tcp = "ip proto \\tcp and src host $host and dst host $ip";
    $pcap_tcp = $packet_tcp->pcapinit($dev, $filt_tcp, 1500, 60, 0);
    $offset_tcp = linkoffset($pcap_tcp);
    $p = Net::ping->new("icmp");
    if ($p->ping($host, 2)) {
    die "ICMP reply from $host recieved, host is up\n";
    }
    $p->close();
    print "No ICMP reply...testing TCP\n";
    if ($fork1 = fork) {
    &send;
    }
    if ($fork2 = fork) {
    loop $pcap_tcp, -1, \&check_tcp, \@packet_tcp;
    }
    sub check_tcp{
    print "TCP reply from $host recieved, host is up\n";
    kill(9, $fork1);
    die "\n";
    }
    sub send {
    sleep 3;
    foreach (1 .. 65535) {
    $a = new pdump::Sniff;
    $a->set({
    ip => {
    saddr => $ip,
    daddr => $host,
    },
    tcp => {
    dest => $_,
    source => 1337,
    seq => 31337,
    syn => 1,
    },
    });
    $a->send;
    }
    die "No TCP reply...host seems to not be up\n";
    }
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/483964

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice