一、准备工作: 首先进入win2k, DNS 服务管理器,选 查看--列表;
然后导出列表到一个文件: mydomain.txt
进入 \winnt\system32\dns 将所有文件打包,和mydomain.txt 一起复制到linux下。
二、开始迁移: 1、生成配置文件:
主域配置文件:
执行如下脚本:
#!/usr/bin/perl
##################################################################
$configfile = "/etc/named.conf";
$dnsfile = "/var/named";
$importfile = "mydomain.txt";
system("/bin/echo > $configfile");
open(OUTFILE,">>$configfile");
flock (OUTFILE,2);
print OUTFILE "options {\n";
print OUTFILE " directory \"$dnsfile\";\n";
print OUTFILE " forwarders {\n";
print OUTFILE " 202.96.199.133;\n";
print OUTFILE " 202.96.209.5;\n";
print OUTFILE " };\n";
print OUTFILE "};\n";
print OUTFILE "zone \".\" {\n";
print OUTFILE " type hint;\n";
print OUTFILE " file \"named.ca\";\n";
print OUTFILE "};\n";
open(INFILE,$importfile);
@lines = <INFILE>;
$num=0;
foreach $line (@lines) {
chop ($line);
print OUTFILE "zone \"$line\" {\n";
print OUTFILE " type master;\n";
print OUTFILE " file \"$line.dns\";\n";
print OUTFILE "};\n";
$num ++;
}
close(INFILE);
close (OUTILE);
print "$num Record convert!!\n";
exit;
生成备份域配置文件: 执行这个脚本:
#!/usr/bin/perl
##################################################################
$configfile = "/etc/named.conf";
$dnsfile = "/var/named";
$importfile = "mydomain.txt";
$masterns = "1.1.1.";
system("/bin/echo > $configfile");
open(OUTFILE,">>$configfile");
flock (OUTFILE,2);
print OUTFILE "options {\n";
print OUTFILE " directory \"$dnsfile\";\n";
print OUTFILE " forwarders {\n";
print OUTFILE " 202.96.199.133;\n";
print OUTFILE " 202.96.209.5;\n";
print OUTFILE " };\n";
print OUTFILE "};\n";
print OUTFILE "zone \".\" {\n";
print OUTFILE " type hint;\n";
print OUTFILE " file \"named.ca\";\n";
print OUTFILE "};\n";
open(INFILE,$importfile);
@lines = <INFILE>;
$num=0;
foreach $line (@lines) {
chop ($line);
print OUTFILE "zone \"$line\" {\n";
print OUTFILE " type slave;\n";
print OUTFILE " file \"$line.dns\";\n";
print OUTFILE " masters { $masterns; };\n";
print OUTFILE "};\n";
$num ++;
}
close(INFILE);
close (OUTILE);
print "$num Record convert!!\n";
exit;
2、复制DNS记录:将从windows下复制过来到dns文件复制到 /var/named 下;
主备域此操作相同。
3、在/var/named下执行:
mv CACHE.DNS named.ca #配置文件windows和linux命名不同。
chown named:named * #更改所有者
chmod 644 * #更改权限
4、编辑 /etc/resolv.conf 如下:
search mydomain.com.cn
domain mydomain.com.cn
nameserver 1.1.1.1
nameserver 202.96.199.133
nameserver 202.96.209.5
5、启动named服务。 /etc/init.d/named start
6、关闭原来的NS服务器。
7、将linux服务器的IP改成win2k的IP。
现在你可以把原来的NS服务器格式化,装个XP打CS啦。。。