Aug 29

ECS (edns-client-subnet)的支持上,国内 DNS派,国外 Google 支持最好,而 Overture 支持上发 EDNS 信息,基于这几个特点,可以在 VPS (无论在国内还是国外)建立一个 CDN 友好的 DNS 服务器。

国外 VPS 配置范例:

{
"BindAddress": ":5353",
"DebugHTTPAddress": "127.0.0.1:5555",
"PrimaryDNS": [
{
"Name": "DNSPaiS",
"Address": "218.30.118.6:53",
"Protocol": "udp",
"SOCKS5Address": "",
"Timeout": 6,
"EDNSClientSubnet": {
"Policy": "auto",
"ExternalIP": "223.73.56.110",
"NoCookie": true
}
},
{
"Name": "DNSPaiM",
"Address": "101.226.4.6:53",
"Protocol": "udp",
"SOCKS5Address": "",
"Timeout": 6,
"EDNSClientSubnet": {
"Policy": "auto",
"ExternalIP": "223.73.56.110",
"NoCookie": true
}
}
],
"AlternativeDNS": [
{
"Name": "GoogleM",
"Address": "8.8.8.8:53",
"Protocol": "udp",
"SOCKS5Address": "",
"Timeout": 3,
"EDNSClientSubnet": {
"Policy": "auto",
"ExternalIP": "223.73.56.110",
"NoCookie": true
}
},
{
"Name": "GoogleS",
"Address": "8.8.4.4:53",
"Protocol": "udp",
"SOCKS5Address": "",
"Timeout": 3,
"EDNSClientSubnet": {
"Policy": "auto",
"ExternalIP": "223.73.56.110",
"NoCookie": true
}
}
],
"OnlyPrimaryDNS": false,
"IPv6UseAlternativeDNS": false,
"WhenPrimaryDNSAnswerNoneUse": "PrimaryDNS",
"IPNetworkFile": {
"Primary": "./cn.zone",
"Alternative": "./ip_network_alternative_sample"
},
"DomainFile": {
"Primary": "./domain_primary_sample",
"Alternative": "./domain_alternative_sample",
"Matcher": "regex-list"
},
"HostsFile": "./hosts_sample",
"MinimumTTL": 0,
"DomainTTLFile" : "./domain_ttl_sample",
"CacheSize" : 10000,
"RejectQType": [255]
}

国内/路由器等配置范例:(注意与国外的主要差别,使用了 Google 的 DNS-Over-TLS,否则会被污染)

{
"BindAddress": "0.0.0.0:5554",
"DebugHTTPAddress": "0.0.0.0:8081",
"PrimaryDNS": [
{
"Name": "DNSPaiS",
"Address": "123.125.81.6:53",
"Protocol": "udp",
"SOCKS5Address": "",
"Timeout": 3,
"EDNSClientSubnet": {
"Policy": "auto",
"ExternalIP": "223.73.56.110",
"NoCookie": true
}
},
{
"Name": "DNSPaiM",
"Address": "101.226.4.6:53",
"Protocol": "udp",
"SOCKS5Address": "",
"Timeout": 3,
"EDNSClientSubnet": {
"Policy": "auto",
"ExternalIP": "223.73.56.110",
"NoCookie": true
}
}
],
"AlternativeDNS": [
{
"Name": "GoogleM",
"Address": "dns.google:853@8.8.8.8",
"Protocol": "tcp-tls",
"SOCKS5Address": "",
"Timeout": 6,
"EDNSClientSubnet": {
"Policy": "auto",
"ExternalIP": "223.73.56.110",
"NoCookie": true
}
},
{
"Name": "GoogleS",
"Address": "dns.google:853@8.8.4.4",
"Protocol": "tcp-tls",
"SOCKS5Address": "",
"Timeout": 6,
"EDNSClientSubnet": {
"Policy": "auto",
"ExternalIP": "223.73.56.110",
"NoCookie": true
}
}
],
"OnlyPrimaryDNS": false,
"IPv6UseAlternativeDNS": false,
"WhenPrimaryDNSAnswerNoneUse": "AlternativeDNS",
"IPNetworkFile": {
"Primary": "/opt/etc/cn.zone",
"Alternative": "/opt/etc/empty"
},
"DomainFile": {
"Primary": "/opt/etc/empty",
"Alternative": "/opt/etc/empty"
},
"HostsFile": "",
"MinimumTTL": 300,
"DomainTTLFile" : "/opt/etc/domain_ttl.txt",
"CacheSize" : 8192,
"RejectQtype": [255]
}

:cool: :cool: :cool:


May 04

CoreDNS 1.5 彻底废除了 Proxy 插件,用 Forward 插件替代,但想不到怎么写才能实现分流,它不允许一个服务器块中用两次 forward。

只好重新把 Proxy 插件编译进去,添加原 coredns/proxy 插件,编译会出错:

proxy.go:107:22: state.ErrorMessage undefined (type request.Request has no field or method ErrorMessage)

暴力修改过的版本,可以编译通过并且可用:https://github.com/rampageX/proxy

编译方法:

按照官方的方法,git clone 下来后,修改 plugin.cfg ,添加一句:

proxy:github.com/rampageX/proxy

然后 make 即可。

root@phicomm-n1:/devel/src/coredns# ./coredns -plugins
Server types:
dns

Caddyfile loaders:
flag
default

Other plugins:
dns.alternate
dns.any
dns.auto
dns.autopath
dns.bind
dns.cache
dns.cancel
dns.chaos
dns.debug
dns.dnssec
dns.dnstap
dns.erratic
dns.errors
dns.etcd
dns.federation
dns.file
dns.forward
dns.grpc
dns.health
dns.hosts
dns.k8s_external
dns.kubernetes
dns.loadbalance
dns.log
dns.loop
dns.metadata
dns.nsid
dns.pprof
dns.prometheus
dns.proxy
dns.ready
dns.reload
dns.rewrite
dns.root
dns.route53
dns.secondary
dns.template
dns.tls
dns.trace
dns.whoami
on

:mrgreen: :mrgreen: :mrgreen:


Dec 04

LiteServe 是一款强大的综合服务器,小小一个软件同时支持充当 Web,FTP,Mail,Telnet 服务器,而且通过 ISAPI 扩展,它的 Web 服务器还可以支持 PHP,MySQL,Perl 等主流的动态编程语言,配搭上内置的动态的域名更新支持,专业的 FTP 支持以及电子邮件,终端操作,LiteServe 简直就是一个虚拟服务器提供商嘛~

Serva 看起来更加强大,1M 左右(32 位的只有 700 多 K)的大小,居然同时支持充当 HTTP,FTP,TFTP,DHCP, proxyDHCP, DNS, SNTP, SYSLOG 服务器!还可以作为 TFTP 客户端使用~!

Serva 是用 C/C++ 编写的多线程程序,可以很好的工作在 Windows 2000 - Windows 7 下,不需要管理员权限,不需要安装,不写注册表。



Aug 28

Unbound 是一款免费的相当轻量的 DNS 本地服务器软件,以前曾经做过介绍 Config Unbound On Windows

经过测试,原来只要改一下 Unbound 的配置文件,也可以把它当 PWX-DNS-Proxy 用!

方法很简单,安装完 Unbound 后,打开安装目录下的 service.conf 文件,修改(添加)以下两行内容:(注意,此方法只适用于 Unbound 1.4.12 及其以下版本,新版的官方给出了直接参数支持的方法,详见文末

# Enable UDP, "yes" or "no".
do-udp: no

# Enable TCP, "yes" or "no".
do-tcp: yes

这样就强制 Unbound 只监听 TCP 的 53 端口了。

优点: Unbound 是一款专业的 DNS 服务器软件,标准功能和稳定性比 PWX-DNS-Proxy 强,查询速度较快,内存占用也比 PWX-DNS-Proxy 少;

缺点: 没有 PWX-DNS-Proxy 那样可以自定义某些网站使用特定的 DNS 服务器功能,而且由于关闭了 UDP 端口监听,nslookup 命令使用默认格式不能查询域名了,必须加 -vc 参数。

更新:在 forward-zone 中可以设置怎样的域名用哪个服务器查询,类似:

# forward-zone:
# name: "."
# forward-addr: 8.8.4.4
# forward-addr: 192.168.2.1@5355 # forward to port 5355.
# forward-zone:
# name: "cn"
# forward-host: 202.96.134.133

顺便说下,路由器是 Tomato,DD-WRT 那样使用 DNSMasq 的,可以把 Unbound 或者 PWX-DNS-Proxy 的查询服务器设置为路由器 IP,利用 DNSMasq 来进行更加灵活的配置。

2011-09-19 更新,新版的 Unbound 1.4.13 应该如此配置 DNS-Over-TCP:

# if yes, perform prefetching of almost expired message cache entries.
prefetch: yes

# Enable IPv4, "yes" or "no".
do-ip4: yes

# Enable IPv6, "yes" or "no".
do-ip6: no

# Enable UDP, "yes" or "no".
do-udp: yes

# Enable TCP, "yes" or "no".
do-tcp: yes

# upstream connections use TCP only (and no UDP), "yes" or "no"
# useful for tunneling scenarios, default no.
tcp-upstream: yes

注意 do-udp 一定要是 yes,但是实际上游查询会使用 tcp;还有一个切记先用 -vc 的 nslookup 确定你的上游 DNS 服务器支持 TCP 查询,国内的貌似全关了 :mrgreen:

Unbound 1.4.13 下载


Mar 26

About Deadwood

Deadwood is the code that will eventually become MaraDNS’ next recursive resolver; right now it is a stable and functioning non-recursive cache. Deadwood, unlike MaraDNS, does not need threads to resolve queries, and has features MaraDNS’ recursive cache doesn’t have, such as “resurrections” and the ability to read and write the cache to disk.

Only 34.3k ,it can write DNS items to the file and load on next start.Easy to config.(Default config can work well like a charm.)

http://maradns.org/deadwood/stable/Deadwood-3-0-02-win32.zip

My config example:



# Forward Servers we connect to

upstream_servers[“.”]=”202.14.67.4, 202.14.67.14”

#In order to enable DNS-over-TCP, this variable must be set and have a value of 1.

tcp_listen = 1

# The IP this program has

bind_address = “127.0.0.1”

# The IPs allowed to connect and use the cache

recursive_acl = “127.0.0.1/16”

# The file containing a hard-to-guess secret

random_seed_file = “secret.txt”

# This is the file Deadwood uses to read the cache to and from disk

cache_file = “dw_cache”


[1/2]  1 2 >