dominet

Active Member
Mar 23, 2002
29
0
301
Moved servers to another datacenter. Whats the easiest way to change all the ips inside httpd.conf and all dns zones ips?
 

moronhead

Well-Known Member
Aug 12, 2001
706
0
316
This is what I do if I am changing a handful of IPs:

[b:ddf58cc138]For httpd.conf:[/b:ddf58cc138]

# cd /usr/local/apache/conf
# cp httpd.conf cp httpd.conf.backup [backup httpd.conf]
# perl -p -i.bu -e &s/xx1.xx1.xx1.xx1/xx2.xx2.xx2.xx2/g;& *.conf [assuming httpd.conf is the only .conf file in that folder; repeat this step for each IP you want to change]
# rm -Rf *.conf.bu

xx1.xx1.xx1.xx1 = Old IP address
xx2.xx2.xx2.xx2 = New IP address

[b:ddf58cc138]For the zone files:[/b:ddf58cc138]

# cd /var/named
# cp -a ./ ../named-backup [backup the named folder]
# perl -p -i.bu -e &s/xx1.xx1.xx1.xx1/xx2.xx2.xx2.xx2/g;& *.db [Repeat this step for each IP you want to change.]
# rm -Rf *.db.bu

It takes just a few seconds to change each IP.

Norman