dnspod / dnspod-sr Goto Github PK
View Code? Open in Web Editor NEWA faster recursive dns server from DNSPod
License: Other
A faster recursive dns server from DNSPod
License: Other
遇到一个问题,之前查询过一次,然后间隔了一段时间再次查询,会有明显的延时,就像第一次请求那么慢,ttl 没有过期
请 @dilfish 看一下
是否支持 *.test.com 这种解析?
默认运行方式是:
make
cd dnspod-sr/src
./dnspod-sr
在 src/config.h 中配置文件使用相对路径 ../*.z ,如果想使用 supervisor 来管理 dnspod-sr 进程是做不到的,因为不支持 cd dnspod-sr/src && ./dnspod-sr 的方式,如果想要使用全路径来运行 dnspod-sr :/full/path/to/dnspod-sr ,怎么做才比较好呢 ?
谁会说话,谁的程序使用率就高。作为一个开源项目,为什么 wiki 这么空白呢?
原谅我使用度娘,搜了一下,这个比作者说明可能还要来得详细:http://www.ttlsa.com/linux/dnspod-sr-little-dns/ 。望改善之。
[root@url1 dnspod-sr]# ./dnspod-sr
dbg:Error:log file error
在我使用dnspod-sr用作内网解析服务器的时候,发现一个问题,当我在root.z中配置好A记录,比如:
www.aaa.com. 60 IN A 192.168.1.21
api.aaa.com. 60 IN A 192.168.1.22
启动后刚开始是可以正常解析的,但是当ttl时间,60秒过期后,就会解析到公网的
正式地址去了,除了设置超长的ttl时间能否让这个解析长期保留呢?
records.z 这个文件是起什么作用的?配置了并没有起作用,谢谢。
看了看源码中不支持soa记录,是否要自己开发啊?
尝试修改源代码,发现注释的数量少的可怜,举步维艰。
尽管**的程序员不喜欢写注释,可毕竟这是开源项目了还在DNSPod官方博客做了宣传,多写一点注释好吗?
我看过BIND9的注释,很好,推荐参考
你好,我在公司内网需建一个内部用的域,如:n1.abc.xx n2.abc.xx
那我在 boot.z里按什么格式来添加这些域名?
运行的时候显示
set affinity fetcher failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
低配机器有没有办法跑?
在io.c文件中的read_records_from_file方法中,在保存最后一组记录时,缺少代码check_dns_name(tmpdomain, &lowerdomain);。
如果我想把某个域名转发到某个DNS服务器的特定端口上,可以实现吗?
sss
请问下“解析私有域名“该如何实现?
有没有相关的资料?
RT
dnspod-sr中使用了epoll,Google得知是Linux内核引入的I/O event notification facility,所以在非Linux系统中编译会出现下面的错误:
./net.h:36:10: fatal error: 'sys/epoll.h' file not found
不知道如何解决这个问题?望不吝赐教。
谢谢
运行一段时间后会出现segamentation fault
使用dnspod-sr后163的域名用dig或者nslookup能够解析,但是用浏览器去访问确访问不了,不知为啥?
1、只能做某一终端DNS的辅控DNS,仅支持转发,无法作为应用主DNS配置
2、若主DNS是基于IP来源(地域)的DNS服务器,则终端DNS仅可以解析到当前IP请求返回的DNS记录,若作为跨地域性质的DNS会造成主DNS的IP来源选择失效
3、启动时仅绑定在127.0.0.1上,且作为一个常量定义author.h:58 #define SRV_ADDR ("127.0.0.1"),为何不作为命令行参数在启动时传入?源码中的127.0.0.1是为了自己请求自己玩?
木有说明好痛苦。。。
在同一个网卡配置 2 个 IP:
# ip addr show em1
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a1:70:38 brd ff:ff:ff:ff:ff:ff
inet 192.168.190.129/24 brd 192.168.190.255 scope global em1
valid_lft forever preferred_lft forever
inet 192.168.190.130/24 brd 192.168.190.255 scope global secondary em1:0
valid_lft forever preferred_lft forever
当使用第二个 IP 来 dig @192.168.190.130 copybash.com,dig 失败,原因是请求从第一个 IP 返回来了,dig 认为这是欺骗行为:
;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53
;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53
;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53
; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7 <<>> @192.168.190.130 copybash.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
基于这样的原因,keepalive + LVS 的 VIP 无法正常提供域名解析服务。一个不够友好的解决方式就是在 /etc/resolv.conf 里面写多个 dnspod-sr 的 IP 作为 nameserver,来实现高可用。
我看你这里面构造了
struct event {
int size;
int onexit;
struct iner_event *ie;
struct event_data data[0];
};
选择一个epoll收到一个fd的时间,会设置和读取 event.event_data[fd], 这个fd会越界吗,超过size的值吗
您好,我对struct event对象中柔性数组成员data的使用方式有一个疑问,能否帮忙解答下?
在run_sentinel()函数中,dnspod调用create_event()函数创建了元素个数为size个的struct event_data类型的柔性数组data[],如下:
struct event *
create_event(int size)
{
struct event *ev =
malloc(sizeof(struct event) + sizeof(struct event_data) * size);
……
return ev;
}
所以该柔性数组的索引范围应该是[0, size-1],但是在后续使用该数组的时候,其使用的索引值是socket描述符,如下:
int
add_event(struct event *ev, struct event_help *help)
{
struct epoll_event e = {0};
int ret = 0;
int epfd = ev->ie->epfd;
e.data.fd = help->fd;
if (e.data.fd < 0)
return -1;
if (help->type == ET_READ)
e.events = EPOLLIN; // | EPOLLET;
if (help->type == ET_WRITE)
e.events = EPOLLOUT; // | EPOLLET;
/*
* 这个地方是不是会有点问题,因为ev->data这个柔性数组的大小为size(create_event()
* 中指定),那么索引这个柔性数组的索引范围应该是[0,size-1],但是这里却是用socket
* fd来索引这个数组,而socket fd是有可能会大于size的。
*/
ev->data[help->fd].cb = help->cb;
if (help->ext != NULL)
ev->data[help->fd].ext = help->ext;
ret = epoll_ctl(epfd, EPOLL_CTL_ADD, help->fd, &e);
if (ret < 0) {
printf("fd is %d\n", help->fd);
perror("epoll_ctl");
}
return ret;
}
而socket fd大小是有可能会大于size的,这样是不是会造成访问了未申请的内存呢?
Why do you use pthread? It's poor performance in linux and not the linux culture.
首先感谢开源这个产品,在Linux下面配置转发比BIND之类的方便很多,我已经安装成功。
考虑到国内国情,如果转发支持TCP方式的话,应该是可以绕过污染问题的。
如我的:
[root@jiling dnspod-sr]# dig twitter.com @127.0.0.1
; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> twitter.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37867
;; flags: qr ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;twitter.com. IN A
;; ANSWER SECTION:
twitter.com. 29492 IN A 203.98.7.65
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jun 1 14:12:04 2012
;; MSG SIZE rcvd: 45
sr.conf 无任何变动,默认的。
在内网搭了个 hadoop 集群,需要解析 hostname,不想把 DNS 请求转发到外网,怎么设置?
按我的理解,ttl 字段:
每隔一秒请求,会减一,600, 599, 598 这样,直到下次刷新。
但我测试,你们服务器始终返回 dnspod 面板里配置的值 600 不变:
$ dig www.xd.com @ns1.dnsv5.com A
// removed
xd.com. 600 IN NS ns2.dnsv5.com.
// removed
难道你们线上服务器每秒都在刷新?
lscpu
Architecture: x86_64
CPU(s): 12
Thread(s) per core: 2
Core(s) per socket: 6
厂商 ID: GenuineIntel
型号名称: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz
free -g
total used free shared buff/cache available
Mem: 31 5 0 0 25 24
Swap: 15 0 15
uname -a
Linux localhost 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
生成 10W 个测试域名
for i in {1..100000}; do echo "d${i}.test.com. A" >> test.d; done
for i in {1..100000}; do echo "d${i}.test.com. 172800 IN A 192.168.0.${i}" >> root.z; done
./src/dnspod-sr
使用 bind-9.10.4-P2/contrib/queryperf 测试
./queryperf -s 192.168.0.21 -d test.d
DNS Query Performance Testing Tool
Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $
[Status] Processing input data
[Status] Sending queries (beginning with 192.168.0.21)
[Status] Testing complete
Statistics:
Parse input file: once
Ended due to: reaching end of file
Queries sent: 100000 queries
Queries completed: 100000 queries
Queries lost: 0 queries
Queries delayed(?): 0 queries
RTT max: 0.002000 sec
RTT min: 0.000055 sec
RTT average: 0.000854 sec
RTT std deviation: 0.000324 sec
RTT out of range: 0 queries
Percentage completed: 100.00%
Percentage lost: 0.00%
Started at: Thu Sep 29 10:45:41 2016
Finished at: Thu Sep 29 10:45:45 2016
Ran for: 4.502813 seconds
Queries per second: 22208.339542 qps
添加新纪录后
只能杀死,在启动么?
修要修改哪里代码?谢谢。
环境 Debian 7.5 x64。
运行后直接killed,看日志一片空白
/Users/houlin/Downloads/dnspod-sr-master/src/utils.h:176:15: error: unknown type name 'pthread_spinlock_t'; did you mean 'pthread_rwlock_t'?
int test_lock(pthread_spinlock_t * lock);
DNSPod-sr在使用的过程中出现这个错误:refused nonrec (cache snoop) query from ip4 10.10..* 到底是什么原因?怎么解决呢?
Hi,
我只是大体看了下, 呵呵, 提几个不专业的小建议..
缩进比较乱, 可以统一到空格上来
编码规范需要统一, 严格点, 比如 if都需要用{} 括起来, 参数列表的参数间应该有空格
还有一些小问题, 我看到一个在util.c的:
int get_random_data(uchar *buffer,int len)
{
int fd = -1;
if((buffer == NULL) || (len < 0))
return -1;
fd = open("/dev/urandom",O_RDONLY);
if(fd <= 0)
return fd;
read(fd,buffer,len);
close(fd);
return 0;
}
fd <= 0 这个, 直接<0就可以了, 不会返回0的.
anyway, 是一个优秀的开源作品, 赞 :)
thanks
其它模块都编译通过只有下面这个不行,出错
[/tmp/make/src] # make
gcc -g -Wall -c -o memory.o memory.c
memory.c: In function 'rte_atomic32_cmpset':
memory.c:90: error: impossible constraint in 'asm'
make: *** [memory.o] Error 1
问题出在:
asm volatile(
"lock ; "
"cmpxchgl %[src], %[dst];"
"sete %[res];"
: [res] "=a" (res), /* output _/
[dst] "=m" (_dst)
: [src] "r" (src), /* input _/
"a" (exp),
"m" (_dst)
: "memory"); /* no-clobber list */
return res;
请问要怎么修改?
单核虚机表示开不起来
set affinity fetcher failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
killed
在内网搞了一个私有域名,正向解析是OK的,但是反解不行。配置如下:
offline01.hz. 172800 IN A 10.165.12.6
6.12.165.10.in-addr.arpa. 3600 IN PTR offline01.hz.
已经重启过dnspod-sr,使用host 10.165.12.6反解不成功
大概需求
全局默认走114
一部分国外域名走opendns
内网的域名走内网的dns服务器
我自己在vps上搭了一个,确实很简单,运行也正常。问题是得到的域名解析还是被污染的啊,不是说防污染么??难道我理解错了。
两台ns服务器配置都是最简单的A记录,做了进程退出的检查,发现2小时会挂一次进程,求指导。
顺便求教有没有配置的参考或者guid之类的。。
btw,/var/log/message也没有什么log。。
ns1:
check dnspod process success at Fri Jul 25 12:42:01 CST 2014
check dnspod process success at Fri Jul 25 12:43:01 CST 2014
restart dnspod at Fri Jul 25 12:44:01 CST 2014
check dnspod process success at Fri Jul 25 12:45:01 CST 2014
check dnspod process success at Fri Jul 25 12:46:01 CST 2014
check dnspod process success at Fri Jul 25 14:42:01 CST 2014
check dnspod process success at Fri Jul 25 14:43:01 CST 2014
check dnspod process success at Fri Jul 25 14:44:01 CST 2014
restart dnspod at Fri Jul 25 14:45:02 CST 2014
check dnspod process success at Fri Jul 25 14:46:02 CST 2014
check dnspod process success at Fri Jul 25 14:47:01 CST 2014
check dnspod process success at Fri Jul 25 16:43:01 CST 2014
check dnspod process success at Fri Jul 25 16:44:01 CST 2014
check dnspod process success at Fri Jul 25 16:45:01 CST 2014
restart dnspod at Fri Jul 25 16:46:01 CST 2014
check dnspod process success at Fri Jul 25 16:47:01 CST 2014
check dnspod process success at Fri Jul 25 16:48:01 CST 2014
check dnspod process success at Fri Jul 25 16:49:01 CST 2014
ns2:
check dnspod process success at Fri Jul 25 12:44:01 CST 2014
check dnspod process success at Fri Jul 25 12:45:01 CST 2014
restart dnspod at Fri Jul 25 12:47:01 CST 2014
check dnspod process success at Fri Jul 25 12:48:01 CST 2014
check dnspod process success at Fri Jul 25 12:49:01 CST 2014
check dnspod process success at Fri Jul 25 14:46:01 CST 2014
check dnspod process success at Fri Jul 25 14:47:01 CST 2014
restart dnspod at Fri Jul 25 14:48:01 CST 2014
check dnspod process success at Fri Jul 25 14:49:01 CST 2014
check dnspod process success at Fri Jul 25 14:50:01 CST 2014
check dnspod process success at Fri Jul 25 14:51:01 CST 2014
check dnspod process success at Fri Jul 25 16:47:01 CST 2014
check dnspod process success at Fri Jul 25 16:48:01 CST 2014
restart dnspod at Fri Jul 25 16:49:01 CST 2014
check dnspod process success at Fri Jul 25 16:50:01 CST 2014
check dnspod process success at Fri Jul 25 16:51:01 CST 2014
您好,请问“解析外部不可见的私有域名“该如何实现?
有没有相关的资料?
请问我可以自己在子网内设置域名吗?
就是说可能解析像 abc.cxx这种域名吗?
[root@localhost src]# make
gcc -o dnspod-sr -lm -lc utils.o datas.o net.o storage.o dns.o io.o event.o author.o init.o update.o control.o memory.o -lpthread -g# -O3
event.o: In function run_sentinel': /var/soft/dnspod-sr/src/event.c:270: undefined reference to
CPU_SET_S'
init.o: In function create_author': /var/soft/dnspod-sr/src/init.c:144: undefined reference to
CPU_SET_S'
init.o: In function create_fetcher': /var/soft/dnspod-sr/src/init.c:197: undefined reference to
CPU_SET_S'
collect2: ld returned 1 exit status
make: *** [all] Error 1
[root@localhost src]#
www.baidu.com. 1216 IN CNAME www.a.shifen.com.
www.a.shifen.com. 313 IN A 119.75.218.70
www.a.shifen.com. 313 IN A 119.75.217.109
类似于这样的,我在records.z里写www.douban.com. 172800 IN 222.222.222.222然后 ./client.c "hijack"
然后dig 域名还是以上的三条。文件里的222.222.222.222不生效。请问带有CNAME的域名如何劫持?
set affinity quizzer failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
[DBG:] dnspod-sr is successfully running now!!
[DBG:] max_ele_size is 1000000 - 1808
[DBG:] server may contain 332730 useful records
[DBG:] hash_table_size is 65536
[DBG:] we have 10 hash tables
[DBG:] we have 2 fetchers,2 quizzers
answer set Q sign
answer set Q sign
answer set Q sign
answer set Q sign
dnspod-sr: storage.c:263: get_val_from_he: Assertion `he->count > 0' failed.
set affinity quizzer failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
[DBG:] dnspod-sr is successfully running now!!
[DBG:] max_ele_size is 1000000 - 1808
[DBG:] server may contain 332730 useful records
[DBG:] hash_table_size is 65536
[DBG:] we have 10 hash tables
[DBG:] we have 2 fetchers,2 quizzers
answer set Q sign
answer set Q sign
set affinity quizzer failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
[DBG:] dnspod-sr is successfully running now!!
[DBG:] max_ele_size is 1000000 - 1808
[DBG:] server may contain 332730 useful records
[DBG:] hash_table_size is 65536
[DBG:] we have 10 hash tables
[DBG:] we have 2 fetchers,2 quizzers
answer set Q sign
answer set Q sign
answer set Q sign
[DBG:] we have 2 fetchers,2 quizzers
type is 448
type is 1800
sig number is 11
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.