LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1979|回复: 10

求助,如何设置本机的域名?

[复制链接]
发表于 2006-2-5 10:37:09 | 显示全部楼层 |阅读模式
这个问题我一直没有搞明白,无论是在按书的做还是按这里的教程修改,现在我只是简单的把域名指向了我的IP地址.请大家帮帮忙看我哪部份做错了?

小弟机器的IP地址是192.168.1.2,网关是192.168.1.1,公网IP是221.203.145.165,域名是lybase.net,操作系统是centos4.0,现在是通过网关端口映射指向我的本机IP(192.168.1.2)我设置了如下几个文件,用nslookup检查时只显示一个>就什么反映也没有了.不知道是为什么?
named.conf
//
// named.conf for Red Hat caching-nameserver
//

options {
        directory "/var/named";
        dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  Previous versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
         // query-source address * port 53;
         forwarders {

     221.203.145.165; #转发的外部DNS服务器地址

   };
};

//
// a caching only nameserver config
//
controls {
        inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "localdomain" IN {
        type master;
        file "localdomain.zone";
        allow-update { none; };
};

zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.ip6.local";
        allow-update { none; };
};

zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
};

zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
};

zone "lybase.net" IN {
        type master;
        file "/var/named/lybase.net.hosts";
};

zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "/var/named/192.168.1.rev";
};

include "/etc/rndc.key";


resolv.conf
domain lybase.net
nameserver 202.96.64.68
nameserver 202.96.75.68
search localdomain



lybase.net.hosts
$TTL        38400
lybase.net                IN SOA        @  lybase.net.     root.mail.lybase.net. (
                                        1053891162                ; serial (d. adams)
                                        3H                ; refresh
                                        15M                ; retry
                                        1W                ; expiry
                                        1D )                ; minimum

                IN NS                mail.lybase.net
                IN MX 5 mail.lybase.net
          www.lybase.net. IN A 192.168.1.2 #正向解析A纪录
          mail.lybase.net. IN A 192.168.1.2
          ftp.lybase.net. IN A 192.168.1.2

                 mail.lybase.net. IN MX 192.168.1.2


192.168.1.rev
$TTL        38400
1.168.192.in-addr.arpa                IN SOA        @  lybase.net.     root.mail.lybase.net. (
                                        1053892104                ; serial (d. adams)
                                        1053892104
                                        3H                ; refresh
                                        15M                ; retry
                                        1W                ; expiry
                                        1D )                ; minimum


1.168.192.in-addr.arpa. IN PTR www.lybase.net

1.168.192.in-addr.arpa. IN PTR mail.lybase.net

1.168.192.in-addr.arpa. IN PTR ftp.lybase.net


localdomain.zone
$TTL        86400
@                IN SOA        localhost root (
                                        42                ; serial (d. adams)
                                        3H                ; refresh
                                        15M                ; retry
                                        1W                ; expiry
                                        1D )                ; minimum
                IN NS                localhost
localhost        IN A                127.0.0.1
               
hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
192.168.1.2           lybase.net lybase
发表于 2006-2-5 10:43:35 | 显示全部楼层
resolv.conf
domain lybase.net
nameserver 202.96.64.68
nameserver 202.96.75.68
你都把dns设置成外面的DNS了吧,不是局与网的dns,找不到的吧
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-5 12:00:17 | 显示全部楼层
那我该怎么设置??现在我的邮件都不好使
回复 支持 反对

使用道具 举报

发表于 2006-2-5 21:37:40 | 显示全部楼层
改成你的dns名字
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-5 22:36:39 | 显示全部楼层
resolv.conf
domain lybase.net
nameserver 202.96.64.68
nameserver 202.96.75.68
nameserver 192.168.1.2

请问是要变成这样吗?
回复 支持 反对

使用道具 举报

发表于 2006-2-5 22:56:38 | 显示全部楼层
把192.168.1.2 放在前边。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-6 08:20:34 | 显示全部楼层
domain lybase.net
nameserver 192.168.1.2
nameserver 202.96.64.68
nameserver 202.96.75.68
[root@lybase etc]# cat /home/coco/resolv.conf >resolv.conf
[root@lybase etc]# service named restart
停止 named:  确定  ]
启动 named:  确定  ]
[root@lybase etc]# nslookup
>

还是只提示一个大于号
回复 支持 反对

使用道具 举报

发表于 2006-2-6 08:59:05 | 显示全部楼层
。。。。。。。。

$ nslookup www.sina.com
Server:         194.168.4.100
Address:        194.168.4.100#53

Non-authoritative answer:
www.sina.com    canonical name = wwwus.sina.com.
Name:   wwwus.sina.com
Address: 71.5.7.191
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-6 10:59:25 | 显示全部楼层
老大,那麻烦你帮忙看看我的错在哪里了??我也知道设置正确的话肯定会有提示信息的。。。。
回复 支持 反对

使用道具 举报

发表于 2006-2-6 17:44:51 | 显示全部楼层
本机的域名不是保存在/etc/hosts中吗?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表