架构根据电信、网通用户自动解析不同IP的DNS服务器

Show All   1 2 3

注:已经提供了免费的DNS解析服务。并且VERYCD已经在使用了。地址:http://www.dnspod.com

/*
* 架构根据电信、网通用户自动解析不同IP的DNS服务器
* 本文介绍了如何让DNS服务器根据用户的IP地址解析出不同的镜像服务器IP

* 版本: 1.1.0
* 作者: 声仔(奶罩)
* 网站: http://wuhongsheng.com
* 版权: (C) 1999-2006 wuhongsheng.com
* 修订: 2006-01-19 23:13
* 原始出处: http://wuhongsheng.com/blog/?p=235
*/

本文档基于FreeBSD、BIND平台,Win用户请回避,没有FreeBSD基础的用户请回避。Linux或者其他Unix用户可以作为参考文档。

修订记录:
2006-01-19 修订了部分网通用户的IP地址,修正了NS部分,修正了一些错误,增加了常见问题。

配置步骤:
1. 前言
2. 软件列表
3. 安装BIND 9
4. 配置BIND 9
5. 测试BIND 9
6. 添加一个NS地址
7. 添加一个域名
8. 测试域名
9. 常见问题

一、 前言
本文假设你有一定的FreeBSD操作经验,懂得日常的FreeBSD操作,有良好的耐心,可以
把文档看完,可以处理突发的问题。
本文再假设你已经有了一个域名,并且已经指向所操作的服务器,服务器的/etc/rc.conf
已经正确的设置此域名。在本文里面,此域名为ns.naizhao.com,IP为219.132.1.1。
/etc/rc.conf如下所设置
hostname=”ns.naizhao.com” #机器的域名,请酌情修改
ifconfig_fxp0=”inet 219.132.1.1 netmask 255.255.255.0″ #此行可能有所不同,
请别照抄。fxp0为我机器上面的网卡。

二、 软件列表
本文所用到的软件可从以下地址获取。连接地址最后更新为2005/12/12

BIND 9.3.1
ftp://ftp.isc.org/isc/bind9/9.3.1/bind-9.3.1.tar.gz

三、 安装BIND 9
我们假设你已经把BIND 9使用fetch或者wget到/root/下,并且已经su为root。
# tar zxvf bind-9.3.1.tar.gz
# cd bind-9.3.1
# ./configure
# make
# make install
# make clean
到此,BIND 9已经安装上了。如果安装过程中出现什么问题,一般不会是你的人品有问题,
请分析错误信息,把缺少的包给安装上。

四、 配置BIND 9
先别急,看看你的BIND版本再说。
# named -v
如果你是FreeBSD 4,估计你看到的提示类似下面的
named 8.3.7-REL Sun Dec 12 04:15:36 CST 2004
如果你是FreeBSD 5,估计你不会看到上面的信息。然后我们再来输入
# /usr/local/sbin/named -v
这次,不管你是FreeBSD 4还是FreeBSD 5,都会看到下面的信息
BIND 9.3.1
所以在这里,我们统一使用/usr/local/sbin/named
废话少说,开始配置吧。
# cd /etc/namedb
# chmod +x make-localhost
# ./make-localhost
会在当前目录生成一个localhost.rev和localhost-v6.rev。后者是用于IPv6
生成rndc的key
# /usr/local/sbin/rndc-confgen >rndc.conf
打开rndc.conf,把
# Use with the following in named.conf, adjusting the allow list as needed:
……
# End of named.conf
之间的内容,去掉注释#,添加到named.conf中
编辑named.conf
# ee named.conf
找到
zone “.” {
type hint;
file “named.root”;
};

zone “0.0.127.IN-ADDR.ARPA” {
type master;
file “localhost.rev”;
};

// RFC 3152
zone “1.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” {
type master;
file “localhost-v6.rev”;
};

// RFC 1886 — deprecated
zone “1.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.INT” {
type master;
file “localhost-v6.rev”;
};
把上面的内容全部用/**/注释
/*
zone “.” {
type hint;
……
file “localhost-v6.rev”;
};
*/
在named.conf文件的最后,把刚才rndc.conf里面的内容添加进去
key “rndc-key” {
algorithm hmac-md5;
secret “ILzfx8ONk2444ix9jnDfKA==”;
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { “rndc-key”; };
};
(上面的内容只供参考)
接下来的,就是文章里面的重头戏了。

Show All   1 2 3
Category: 其他技术
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
3 Responses
  1. 红薯 says:

    其实bind的配置远不需要这么复杂,里面的很多东西都是没必要的,例如对localhost的解析以及IP地址反解析等等

  2. Michael says:

    [Comment ID #24324 Will Be Quoted Here]

    bind的确有些臃肿,djbdns和tinydns都挺好使的。

  3. xwl says:

    功能不难实现,难的是如何动态,实时更新IP表。

  4. minecraft says:

    First of all I would like to say terrific blog! I had a quick question which I’d
    like to ask if you do not mind. I was curious to know how you center
    yourself and clear your head prior to writing.
    I have had trouble clearing my mind in getting my ideas out there.
    I truly do take pleasure in writing but it just seems like the first 10 to 15 minutes tend to be
    wasted just trying to figure out how to begin. Any recommendations or hints?
    Many thanks!

  5. minecraft says:

    It’s going to be end of mine day, but before finish I am reading this impressive
    piece of writing to increase my knowledge.

  6. minecraft says:

    Do you mind if I quote a couple of your posts
    as long as I provide credit and sources back to
    your blog? My blog is in the very same niche as yours and
    my visitors would truly benefit from a lot of the information you present here.
    Please let me know if this alright with you.
    Cheers!

  7. minecraft says:

    Does your website have a contact page? I’m having a tough time locating it but, I’d like
    to send you an e-mail. I’ve got some creative
    ideas for your blog you might be interested in hearing.
    Either way, great blog and I look forward to seeing it
    grow over time.

  8. Hello, i think that i saw you visited my blog thus i came to
    “return the favor”.I’m trying to find things to enhance
    my site!I suppose its ok to use some of your ideas!!

  9. I was excited to uncover this great site. I need to
    to thank you for your time for this particularly wonderful read!!

    I definitely enjoyed every little bit of it and i also have you book-marked to see new stuff
    on your website.

  10. I was curious if you ever considered changing
    the page layout of your blog? Its very well written; I love what youve
    got to say. But maybe you could a little more in the way
    of content so people could connect with it better. Youve got
    an awful lot of text for only having 1 or 2 images. Maybe you could space it out better?

  11. I don’t even know the way I stopped up here, however I
    assumed this put up was once great. I do not understand who
    you’re but definitely you’re going to a well-known blogger
    when you are not already. Cheers!

  12. I have been surfing online more than three hours today, yet I never
    found any interesting article like yours. It
    is pretty worth enough for me. Personally, if all website owners and bloggers made good content as you
    did, the internet will be much more useful than ever before.

  13. Great post. I used to be checking continuously this blog
    and I’m impressed! Very helpful info particularly the closing
    section 🙂 I care for such information a lot.
    I was looking for this certain info for a long time. Thanks and best of luck.

  14. I every time emailed this webpage post page to all my associates, for the reason that if like to read
    it afterward my friends will too.

  15. Admiring the commitment you put into your blog and in depth information you provide.
    It’s awesome to come across a blog every once in a while that isn’t the
    same outdated rehashed information. Wonderful read!
    I’ve saved your site and I’m including your RSS feeds
    to my Google account.

  16. Sling TV says:

    Howdy! I’m at work browsing your blog from my new iphone 4!
    Just wanted to say I love reading through your blog and
    look forward to all your posts! Carry on the outstanding work!

  17. WOW just what I was looking for. Came here by searching for What Equipment is Needed for Sling TV

  18. Sling TV says:

    Hello! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest authoring a blog post
    or vice-versa? My blog discusses a lot of the same subjects as yours and I think we could greatly benefit from each other.
    If you happen to be interested feel free to send me an e-mail.
    I look forward to hearing from you! Great blog by the way!

  19. minecraft says:

    It’s going to be finish of mine day, but before ending I am reading this
    great piece of writing to improve my know-how.

  20. minecraft says:

    Hey very interesting blog!

  21. tinyurl.com says:

    Pretty section of content. I just stumbled upon your site and in accession capital to assert that I acquire actually
    enjoyed account your blog posts. Anyway I’ll be subscribing to your feeds and even I achievement you access consistently
    rapidly.

  22. tinyurl.com says:

    Hi there I am so happy I found your blog page, I really
    found you by mistake, while I was searching on Yahoo for something else, Anyways I am here now and would just like to say
    many thanks for a marvelous post and a all round entertaining
    blog (I also love the theme/design), I don’t have time to read it all
    at the minute but I have book-marked it and also included your RSS feeds,
    so when I have time I will be back to read much more, Please
    do keep up the great work.

  23. minecraft says:

    Fastidious response in return of this query with firm arguments and
    describing all on the topic of that.

  24. minecraft says:

    Thanks , I’ve just been looking for information about this subject for a while and
    yours is the greatest I’ve found out till now. But, what in regards to the bottom line?
    Are you certain in regards to the supply?

  25. tinyurl.com says:

    Hi there, I discovered your web site by the use of Google while
    looking for a related matter, your site came up, it looks great.
    I have bookmarked it in my google bookmarks.
    Hello there, just become alert to your blog thru Google, and found that it is truly informative.
    I am gonna watch out for brussels. I’ll be grateful should you
    continue this in future. Many other folks will probably be benefited from your writing.
    Cheers!

  26. minecraft says:

    magnificent points altogether, you simply received a emblem new reader.
    What may you recommend about your submit that you just made some days in the past?
    Any sure?

  27. minecraft says:

    Hi to every body, it’s my first pay a visit of this weblog; this webpage includes awesome and
    truly excellent stuff designed for visitors.

  28. I’m not sure the place you’re getting your information, however good
    topic. I needs to spend a while studying much more or working
    out more. Thank you for excellent info I was searching
    for this info for my mission.

  29. whoah this weblog is great i love reading your posts.
    Keep up the good work! You know, lots of individuals are looking around
    for this information, you can help them greatly.

  30. You actually make it appear so easy with your presentation but
    I find this topic to be actually something that I think I would by no
    means understand. It sort of feels too complicated and
    extremely broad for me. I am looking forward to your next submit,
    I will attempt to get the hold of it!

  31. g says:

    Keep on writing, great job!

  32. Hello there I am so excited I found your blog page, I really found you by mistake, while I was looking on Google for something
    else, Anyways I am here now and would just like to say thank you for a marvelous post and a
    all round exciting blog (I also love the theme/design), I don’t
    have time to read it all at the moment but I have book-marked it and also added
    your RSS feeds, so when I have time I will be back to read much more, Please do keep up the great work.

  33. Hey I know this is off topic but I was wondering if
    you knew of any widgets I could add to my blog that automatically tweet my
    newest twitter updates. I’ve been looking for a plug-in like
    this for quite some time and was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy
    reading your blog and I look forward to your new updates.

  34. Hi, I check your blog like every week. Your humoristic style is awesome,
    keep doing what you’re doing!

  35. hello there and thank you for your information – I’ve
    certainly picked up anything new from right here. I did however expertise a few technical issues using this website,
    as I experienced to reload the site many times previous to I could get it to load correctly.

    I had been wondering if your hosting is OK? Not that I’m complaining, but slow loading instances times will very frequently
    affect your placement in google and could damage your high
    quality score if advertising and marketing with Adwords.
    Anyway I am adding this RSS to my e-mail and could look out for a lot more
    of your respective intriguing content. Ensure that you update this again soon.

  36. Very nice write-up. I absolutely appreciate this website.
    Continue the good work!

  37. Your way of telling everything in this paragraph is actually
    fastidious, every one can without difficulty understand it, Thanks a lot.

  38. Great beat ! I wish to apprentice while you amend
    your website, how can i subscribe for a blog website?
    The account helped me a acceptable deal. I had been tiny bit acquainted of this your
    broadcast offered bright clear concept

  39. Good day I am so happy I found your web site, I really found you by error, while I was searching on Yahoo for something else, Anyways I am here now and would just like to say many thanks for a fantastic post and a all round enjoyable blog (I also love the theme/design), I
    don’t have time to read through it all at the moment but I have book-marked
    it and also added in your RSS feeds, so when I have time I will be back to read a lot more, Please do
    keep up the superb job.

  40. Hey! I could have sworn I’ve been to this blog before but after browsing through
    some of the post I realized it’s new to me. Anyhow, I’m definitely delighted I found it and I’ll be bookmarking and checking back often!

  41. WOW just what I was looking for. Came here by searching for plenty of
    fish dating site

  42. I got this site from my friend who told me concerning this site and at the moment this time I am browsing this website
    and reading very informative articles or reviews at this place.

  43. Hi there just wanted to give you a quick heads up and let you know
    a few of the images aren’t loading correctly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different internet browsers and both
    show the same results.

  44. Everything is very open with a really clear description of the challenges.

    It was definitely informative. Your website is extremely
    helpful. Many thanks for sharing! pof natalielise

  45. Your style is really unique compared to other people I have read stuff from.
    Many thanks for posting when you’ve got the opportunity,
    Guess I will just book mark this site.

  46. Larrysquab says:

    Thanks a lot. I appreciate this.
    mexican online pharmacies
    top rated canadian pharmacies online
    canadapharmacy
    canadian pharmacies online
    cheap medications – https://www.pharmacyonline-canadian.com/

    canada pharma limited llc Jen 41cf48e

  47. Hi there! Someone in my Facebook group shared this website with us so I came to
    give it a look. I’m definitely enjoying the information. I’m bookmarking and will be tweeting
    this to my followers! Great blog and amazing style and design.

  48. Pingback: Type fences
  49. Hello! I could have sworn I’ve been to this website before but after browsing through some of the post
    I realized it’s new to me. Anyways, I’m definitely delighted I found it and I’ll
    be bookmarking and checking back frequently!

  50. Yes! Finally something about quest bars cheap.

  51. Excellent goods from you, man. I have take note your stuff
    prior to and you’re simply too excellent. I actually like
    what you’ve received right here, certainly like what you are stating and the best way wherein you
    say it. You are making it enjoyable and you still take care of to keep it smart.
    I can not wait to read much more from you. This is really a great website.

  52. Valuable information. Fortunate me I discovered your web site by accident,
    and I’m surprised why this coincidence did not took place in advance!

    I bookmarked it.

  53. GeorgeNeoto says:

    Useful info. Cheers.

    cialis discount coupons
    cialis kopen pakjegemak
    cialis prescription limits
    http://ciaonlinebuymsn.com/

  54. Magnificent goods from you, man. I’ve take into account your stuff prior to and you are simply too
    great. I really like what you have obtained here,
    certainly like what you are saying and the best way by which you say it.
    You make it enjoyable and you still take care of to stay it wise.
    I can not wait to learn much more from you. This is actually a wonderful
    site.

  55. Greetings! I’ve been following your blog for a long time now and finally got the
    bravery to go ahead and give you a shout out from Kingwood Texas!
    Just wanted to tell you keep up the good job!

  56. Excellent, what a web site it is! This blog presents useful information to us, keep it up.

  57. CharlieVem says:

    Terrific postings. Appreciate it!

    3 day cialis
    cialis 20mg
    cialis female experience
    cialis without a doctor prescription

  58. CharlieVem says:

    Incredible loads of great facts.

    how do i get cialis prescription
    buy cialis pills
    il cialis aumenta la pressione
    black cialis 800mg

  59. No matter if some one searches for his vital thing, so he/she wants to be available
    that in detail, therefore that thing is maintained over here.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image