实现智能dns为用户分配最佳线路
说明
服务器放在国外,不同线路质量不一样。如何根据访问者的所在地、运营商,智能的分配线路呢?
有些域名服务器上提供线路优先级,比如阿里云,如果是国外域名服务商,一般都不会提供。
所以通常要我们自己实现自动分配线路的功能。
例如
有一个网站www.yongqingking.top,它的真实服务器ServerA在海外。网站的部分用户在国内。
由于各种原因,在国内访问海外服务器的质量不是很好。为了改善状态,打算为国内用户提供多条访问线路。
用户访问时,自动分配合适线路,提供网站访问质量。
待解决问题
要解决上面问题,需要解决下面几个问题
1.如何实现多条访问线路?
2.如何自动分配线路?
3.如何知道线路质量最好?
如何实现多条访问线路?--端口映射
在合适的地区新建节点NodeA,将NodeA的80端口转发给ServerA的80端口。
firewall-cmd --add-forward-port=port=80:proto=tcp:toaddr=ServerA的ip:toport=80 --permanent
如何自动分配线路?--bind视图
1.分配给用户合适的节点ip就等于分配了线路。
2.分配ip是dns干的事情,我们必须要弄个自己的dns服务器。
3.dns服务器有很多,我们可以自己写一个,也可以用dnsmasq,chinadns,smartdns等,但是都不适合
4.最终我选择的是bind,比较常用的一个dns服务器,利用它的视图功能
- 安装
yum install bind
- 修改配置允许外部访问
options { listen-on port 53 { 127.0.0.1; 主机ip;}; allow-query { any;}; }
- 配置acl+视图
介绍bind视图的文章很多
- 定制bind视图
开发功能接口修改bind视图,并且bind支持热加载,不需要重启
如何知道线路质量呢?--反向扫描
1.通常的方法是,在各个地区布置探测节点。付出成本太高,不现实。
2.借助第三方的服务,例如站长工具等。
3.系统中记录了访问者ip,在节点上ping所有ip或扫描端口
定时扫描线路质量,然后再更新dns配置。
2023年8月21日 20:26
With our user-friendly interface and intuitive navigation, you'll easily find the information you need. We strive to provide detailed descriptions, helpful tips, and insider recommendations to enhance your experience. Our goal is to be your trusted companion, guiding you towards the most rewarding and enjoyable things to do near me in your area or any destination you're planning to visit.
2023年10月05日 14:40
my daughter have been doing some scrapbooking stuffs over the years and she really likes it~ 花藝師
2023年10月31日 18:34
You can also put a chatbox on your blog for more interactivity among readers.*.~;: 玫瑰花
\
=====================
The way you write, you are really a professional blogger.:.–~ 開張花籃花牌
======================
So next, click the Where’s The Money back guarantee website for the internet site. 網上花店
=======================
This is indeed my blue ribbon things sound here, indeed appropriate looking weblog. I discovered a karma of fascinating obstruct within your blog noticeably it’s discussion. From all the comments on your articles, it appears like this is in all honesty a completely well-liked network site. Store up the telling function. .Thank you respecting another mammoth article. Where else could anyone win that stripe of tidings in such a execute custom of writing? I be undergoing a presenting next week, and I am on the look an eye to such information. Hasta Bakicisi Bebek Bakicisi Yasli Bakicisi Cocuk Bakicisi 訂花
2023年11月11日 21:18
Have you tried twitterfeed on your blog, i think it would be cool.”*.“ احسن جامعة مصر
2023年11月16日 14:05
Youre so cool! I dont suppose Ive read like this before. So nice to find somebody by incorporating authentic applying for grants this subject. realy thanks for starting this up. this site is a thing that’s needed on the web, somebody after some bit originality. helpful problem for bringing something new on the web! https://lightinfitness.com/
2023年11月23日 23:35
That is a very good standpoint, yet seriously isn’t create any sence by any means preaching about which mather. Every means with thanks as well as pondered make an effort to promote your current publish in to delicius nevertheless it looks like it’s problems with all your blogs are you able to make sure you recheck the item. many thanks once more. iphone14 pro max回收價
2023年11月23日 23:35
You are so cool man, the post on your blogs are super great. apple回收價
2023年11月23日 23:36
I am just use very happy understand this. This can be the method of information which needs to be presented harmful . ” the actual random hype may possibly be inside the another webpages. Satisfaction from your individual sharing with us the following prime file. iphone trade in邊間好
2023年11月23日 23:36
Thanks for your article on this weblog. From my own personal experience, occasionally softening way up a photograph may provide the digital photographer with an amount of an artsy flare. Sometimes however, the soft clouds isn’t exactly what you had in mind and can in many cases spoil a normally good photograph, especially if you consider enlarging the item. 先達回收價
2023年12月01日 22:39
Magica By Rish Agarwal is the best wedding photographer in New Delhi, India who captures candid moments and has an award-winning portfolio in Indian Weddings
#Best Wedding Photographer India
2024年1月25日 14:45
Pavzi.com provides all the news about Gadgets, the Economy, Technology, Business, Finance and many more. The main concept or our aim behind this website has been the will to provide resources with full information on each topic which can be accessed through the Internet. To ensure that every reader gets what is important and worthy about the topic they search and link to hear from us. pavzi.com Our site is a multiple Niche or category website which will ensure to provide information and resources on each and every topic . Some of the evergreen topics you will see on our website are Career, Job Recruitment, Educational, Technology, Reviews and others. We are targeting mostly so it is true that Tech, Finance, and Product Reviews. The only reason we have started this website is to make this site the need for your daily search use.