openwrt编译smartdns_LEDE/OpenWRT 部署SmartDNS
SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端的DNS查询请求,从多个上游DNS服务器获取DNS查询结果,并将访问速度最快的结果返回给客户端,提高网络访问速度。 同时支持指定特定域名IP地址,并高性匹配,达到过滤广告的效果。
与dnsmasq的all-servers不同,smartdns返回的是访问速度最快的解析结果。 (详细差异请看FAQ)
支持树莓派,openwrt,华硕路由器,windows等设备。
软件效果展示
阿里DNS
使用阿里DNS查询百度IP,并检测结果。
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com 223.5.5.5
Server: 223.5.5.5
Address: 223.5.5.5#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 180.97.33.108
Name: www.a.shifen.com
Address: 180.97.33.107
pi@raspberrypi:~/code/smartdns_build $ ping 180.97.33.107 -c 2
PING 180.97.33.107 (180.97.33.107) 56(84) bytes of data.
64 bytes from 180.97.33.107: icmp_seq=1 ttl=55 time=24.3 ms
64 bytes from 180.97.33.107: icmp_seq=2 ttl=55 time=24.2 ms
--- 180.97.33.107 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 24.275/24.327/24.380/0.164 ms
pi@raspberrypi:~/code/smartdns_build $ ping 180.97.33.108 -c 2
PING 180.97.33.108 (180.97.33.108) 56(84) bytes of data.
64 bytes from 180.97.33.108: icmp_seq=1 ttl=55 time=31.1 ms
64 bytes from 180.97.33.108: icmp_seq=2 ttl=55 time=31.0 ms
--- 180.97.33.108 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 31.014/31.094/31.175/0.193 ms
smartdns
使用SmartDNS查询百度IP,并检测结果。
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 14.215.177.39
pi@raspberrypi:~/code/smartdns_build $ ping 14.215.177.39 -c 2
PING 14.215.177.39 (14.215.177.39) 56(84) bytes of data.
64 bytes from 14.215.177.39: icmp_seq=1 ttl=56 time=6.31 ms
64 bytes from 14.215.177.39: icmp_seq=2 ttl=56 time=5.95 ms
--- 14.215.177.39 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
从对比看出,smartdns找到访问www.baidu.com最快的IP地址,这样访问百度比阿里DNS速度快5倍。
下载配套安装包
一般LEDE/openwrt下载以下对应SmartDNS安装包即可
smartdns.xxxxxxxx.x86_64.ipk 支持x86_64路由器
luci-app-smartdns.xxxxxxxxx.xxxx.all.ipk openwrt管理统一界面
下载请前往Release页面:点击此处下载
openwrt/LEDE
安装将软件使用winscp上传到路由器的/root目录,执行如下命令安装
opkg install smartdns.xxxxxxxx.xxxx.ipk
opkg install luci-app-smartdns.xxxxxxxx.xxxx.all.ipk
修改配置登录openwrt管理页面,打开Services->SmartDNS进行配置。
在Upstream Servers增加上游DNS服务器配置,建议配置多个国内外DNS服务器。
在Domain Address指定特定域名的IP地址,可用于广告屏蔽。
启用服务SmartDNS服务生效方法有两种,一种是直接作为主DNS服务;另一种是作为dnsmasq的上游。
默认情况下,SmartDNS采用第一种方式。如下两种方式根据需求选择即可。
启用方法一:作为主DNS(默认方案)
启用smartdns的53端口重定向登录路由器,点击Services->SmartDNS->redirect,选择重定向53端口到SmartDNS启用53端口转发。
检测转发服务是否配置成功使用nslookup -querytype=ptr smartdns查询域名
看命令结果中的name项目是否显示为smartdns或主机名,如smartdns则表示生效
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
smartdns name = smartdns.
界面提示重定向失败
检查iptable,ip6table命令是否正确安装。
openwrt 15.01系统不支持IPV6重定向,如网络需要支持IPV6,请将DNSMASQ上游改为smartdns,或者将smartdns的端口改为53,并停用dnsmasq。
LEDE之后系统,请安装IPV6的nat转发驱动。点击system->Software,点击update lists更新软件列表后,安装ip6tables-mod-nat
使用如下命令检查路由规则是否生效。
iptables -t nat -L PREROUTING | grep REDIRECT
如转发功能不正常,请使用方法二:作为DNSMASQ的上游。
方法二:作为DNSMASQ的上游
将dnsmasq的请求发送到smartdns登录路由器,点击Services->SmartDNS->redirect,选择作为dnsmasq的上游服务器设置dnsmasq的上游服务器为smartdns。
检测上游服务是否配置成功
方法一:使用nslookup -querytype=ptr smartdns查询域名
看命令结果中的name项目是否显示为smartdns或主机名,如smartdns则表示生效
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
smartdns name = smartdns.
方法二:使用nslookup查询www.baidu.com域名,查看结果中百度的IP地址是否只有一个,如有多个IP地址返回,则表示未生效,请多尝试几个域名检查。
pi@raspberrypi:~ $ nslookup www.baidu.com 192.168.1.1
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 14.215.177.38
启动服务勾选配置页面中的Enable(启用)来启动SmartDNS
注意:
如已经安装chinaDNS,建议将chinaDNS的上游配置为SmartDNS。
SmartDNS默认情况,将53端口的请求转发到SmartDNS的本地端口,由Redirect配置选项控制。
openwrt编译smartdns_LEDE/OpenWRT 部署SmartDNS相关推荐
- 最新版OpenWrt编译教程,解决依赖问题
最新版OpenWrt编译教程,解决依赖问题 参考文章: (1)最新版OpenWrt编译教程,解决依赖问题 (2)https://www.cnblogs.com/jzssuanfa/p/7400840. ...
- 【物联网】OpenWrt编译和修改基础--预科
该文章讲解一下在AR9331上使用Openwrt的编译修改方法,前面先介绍一下硬件平台特点,为后面的代码修改做铺垫,然后描述一下Openwrt的编译烧写流程,最后再重点讲述编译配置.代码修改细节. 1 ...
- mysql openwrt 编译_如何编译OpenWrt
(!文末,附加人生如戏写的编译OPENWRT的TXT内容,可直接跳至末尾,有例子) Openwrt 官方正式的发行版是已编译好了的映像文件(后缀名bin或trx.trx2),此映像文件可从Openwr ...
- OpenWrt 编译分割
本文主要参考:http://macbruins.com/2011/05/08/downloading-sources-for-building-openwrt/ OpenWrt系统在buildroot ...
- UBUNTU环境下编译的openwrt
UBUNTU环境下编译的openwrt 请执行这个命令以安装编译依赖包:sudo apt-get update 然后再输这个: sudo apt-get install gcc g++ binutil ...
- 极路由刷个人编译的openwrt固件全过程
说明 以下是极1s刷机的整个流程,包括openwrt 极路由固件的编译和升级流程,主要是为了方便发烧友或者开发人员. 准备工作 极壹S(型号HC5661)一台 串口板和串口线(如果是高级玩家) 电脑. ...
- linux下下载openwrt源码,OpenWrt下载编译
不想啰嗦直接肝,依次执行: git clone git://github.com/openwrt/openwrt.git cd openwrt ./scripts/feeds update -a ./ ...
- OpenWrt 编译及batman-adv组件选择(for Netgear WNDR3800)
OpenWrt 编译(ubuntu)及batman-adv配置(for Netgear WNDR3800) 一.编译openwrt固件 1.下载源码,如15.05(Chaos Calmer)这个版本 ...
- OpenWRT编译 -- 出现‘...net/mac80211/mac80211.ko‘ is missing的错误
1.背景 1.在 ubuntu 环境下搭建好 OpenWRT 的开发环境使用良久之后(具体的搭建可以查阅 OpenWRT 编译 – 搭建属于自己的 OpenWRT 的开发环境),心血来潮想要换一下 ...
- openwrt编译固件流程
openwrt编译固件分为环境配置以及固件编译两个部分,下面将按步骤介绍编译固件的方法流程 1.环境配置 编译固件需要先配置环境,自己所需的环境在官网中可以找到.选择适合自己的分支,默认的分支为mas ...
最新文章
- C语言中流程图的主要作用是,C语言 三大流程控制
- 消息中间件RocketMQ源码解析-- --调试环境搭建
- nhibernate事务锁表的问题
- qtxlsx编译报错_Qt5安装Qxlsx模块,以及Qxlsx模块的简单使用,附资源例程下载
- python编程入门第3版pdf-Python编程入门第三版
- 【转】开发板上修改时间方法
- 关于彻底卸载流氓 “趋势科技防毒网络版客户端”最详细步骤,亲测有效
- 深度森林DF21、deep forest、gcForest
- python qq自动接收文件_python学习之 实现QQ自动发送消息
- 数学建模:评价性模型学习——层次分析法(AHP模型)
- qt 字体旋转90_如何识别图片和视频上文字的字体
- python读写excel文件(xls格式)
- 电影推介2017-01-07
- HCIE-Routing Switching认证
- 1334: PIPI计数
- C# Winform窗体切换与关闭
- 【每日一题】蜗牛爬井问题
- Unity3D魔方游戏如何完成魔方的旋转
- 深入理解德语动词变化(一)
- 雅思口语-Part1练习