Results 1 to 6 of 6

Thread: Change dns ip

  1. #1
    Join Date
    Aug 2002
    Posts
    1,632

    Change dns ip

    Hi

    i have use this to change the ip in all the files inside /var/named

    perl -pi.bak -e "s/[99.79.184.90]/[88.79.184.90]/g" *.hosts

    but when i edit a zone i see

    fortius[88.79.184.90]it[88.79.184.90] IN SOA ns[88.79.184.90][88.79.184.90]dnsdomi[88.79.184.90]com[88.79.184.$
    [88.79.184.90][88.79.184.90][88.79.184.90]32[88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90]$
    [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90]
    3[88.79.184.90][88.79.184.90][88.79.184.90]
    [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90]
    [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90] )
    NS ns[88.79.184.90][88.79.184.90]dnsdominio[88.79.184.90]com[88.79.184.90]
    NS dns3[88.79.184.90][88.79.184.90][88.79.184.90]
    A [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][8$
    * A [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][8$

    why?

  2. #2
    Join Date
    Apr 2000
    Location
    California
    Posts
    3,051

    Re: Change dns ip

    Originally posted by adapter
    Hi

    i have use this to change the ip in all the files inside /var/named

    perl -pi.bak -e "s/[99.79.184.90]/[88.79.184.90]/g" *.hosts

    but when i edit a zone i see :(

    fortius[88.79.184.90]it[88.79.184.90] IN SOA ns[88.79.184.90][88.79.184.90]dnsdomi[88.79.184.90]com[88.79.184.$
    [88.79.184.90][88.79.184.90][88.79.184.90]32[88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90]$
    [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90]
    3[88.79.184.90][88.79.184.90][88.79.184.90]
    [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90]
    [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90] )
    NS ns[88.79.184.90][88.79.184.90]dnsdominio[88.79.184.90]com[88.79.184.90]
    NS dns3[88.79.184.90][88.79.184.90][88.79.184.90]
    A [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][8$
    * A [88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][88.79.184.90][8$

    why?
    I'm pretty sure you meant to type:

    perl -pi.bak -e "s/99.79.184.90/88.79.184.90/g" *.hosts

    rather than:

    perl -pi.bak -e "s/[99.79.184.90]/[88.79.184.90]/g" *.hosts

    Because the one with the [charcater class] is why you see that problem. That's picking up anything that's any character that's 0, 1, 4, 7, 8, 9 and . (dot) with the full IP you're replacing it with.

  3. #3
    Join Date
    Aug 2002
    Posts
    1,632
    yes thanks it work fine now, do u know also how can i change the refresh value in dns zone? i have try this but dont work

    perl -pi.bak -e "s/86400/600/g" *.db

  4. #4
    Join Date
    Apr 2000
    Location
    California
    Posts
    3,051
    That all depends on how it's in the zone file, how it's formatted, etc. What do your zone files look like in their current form? Are they are set to the same value now? Do you have any ; comments in there after the value, or are you using the $TTL variable? You need something specific to find and replace.

  5. #5
    Join Date
    Aug 2002
    Posts
    1,632
    ; cPanel
    ; Zone file for domain.com
    $TTL 14400
    @ IN SOA ns1.domain.com. webmaster.domain.com. (
    2005052401 ; serial, todays date+todays
    14400 ; refresh, seconds
    7200 ; retry, seconds
    3600000 ; expire, seconds
    86400 ) ; minimum, seconds

    domain.com. IN NS ns1.domain.com.
    domain.com. IN NS ns2.domain.com.

    domain.com. IN A 00.00.00.00

    localhost.domain.com. IN A 127.0.0.1

    domain.com. IN MX 0 domain.com.

    mail IN CNAME domain.com.
    www IN CNAME domain.com.
    ftp IN A 00.00.00.00

  6. #6
    Join Date
    Apr 2000
    Location
    California
    Posts
    3,051
    For some reason, I thought you meant TTL only. Anyway, that should change the 86400 value to 600 in the zone, on any occurrence it finds. What problems are you seeing where it's not working?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •