dnsmasq

使用Dnsmasq搭建本地dns服务器上网

本小妞迷上赌 提交于 2019-12-09 22:05:55
导读 搭建一个属于自己的本地DNS服务器很有必要,利用Dnsmasq来搭建一个属于自己的本地DNS服务器,享受更干净无污染、更智能快速和没有广告干扰的DNS解析服务。 一、Dnsmasq安装 安装并启动Dnsmasq yum install -y dnsmasq service dnsmasq start 二、Dnsmasq配置 1、Dnsmasq的配置文件路径为:/etc/dnsmasq.conf # ll -d /etc/dnsmasq.conf -rw-r--r-- 1 root root 21237 Feb 23 00:17 /etc/dnsmasq.conf 2、编辑/etc/dnsmasq.conf resolv-file=/etc/resolv.dnsmasq.conf //dnsmasq 会从这个文件中寻找上游dns服务器 strict-order //去掉前面的# addn-hosts=/etc/dnsmasq.hosts //在这个目里面添加记录 listen-address=127.0.0.1,192.168.1.123 //监听地址 3、修改/etc/resolv.conf echo 'nameserver 127.0.0.1' > /etc/resolv.conf 4、创建resolv.dnsmasq.conf文件并添加上游dns服务器的地址 touch

手动配置 OpenWrt 路由器的 DNS 服务

核能气质少年 提交于 2019-12-09 21:49:38
刚配置好 PPPoE 拨号,想 ping 一下互联网,就遇到了 DNS 问题: $ ping www.baidu.com ping: bad address 'www.baidu.com' 查看本机的 DNS 配置: $ cat /etc/resolv.conf search lan nameserver 127.0.0.1 发现使用的是本机 DNS 服务器,即 dnsmasq。 查看 dnsmasq 配置: $ cat /etc/dnsmasq.conf conf-dir=/etc/dnsmasq.d 查看 dnsmasq.d 文件夹,为空。 搜索一番配置,在 dnsmasq.d 文件夹下创建了 dns.conf 文件: # 忽略默认解析文件 /etc/resolv.conf # 默认解析文件即本机的解析设置,可能是通过 DHCP 获取的,不推荐使用 no-resolv # 手动指定上游服务器 server=223.5.5.5 server=223.6.6.6 重启 dnsmasq 服务: $ /etc/init.d/dnsmasq restart 现在路由器能够成功查到 DNS 了,大功告成。 来源: oschina 链接: https://my.oschina.net/u/2313378/blog/907774

DNS劫持DNSmasq详细解析及详细配置

こ雲淡風輕ζ 提交于 2019-12-09 14:28:45
常用于测试使用,安装环境为MacOS 一、Dnsmasq介绍 Dnsmasq 提供 DNS 缓存和 DHCP 服务功能。作为 域名解析 服务器(DNS),dnsmasq可以通过缓存 DNS 请求来提高对访问过的网址的连接速度。作为DHCP 服务器, dnsmasq 可以用于为局域网电脑分配内网ip地址和提供路由。DNS和DHCP两个功能可以同时或分别单独实现。dnsmasq轻量且易配置,适用于个人用户或少于50台主机的网络。此外它还自带了一个 PXE 服务器。 二、Dnsmasq的主要作用 1)将Dnsmasq作为本地DNS服务器使用,直接修改电脑的本地DNS的IP地址即可。 2)应对ISP的DNS劫持(反DNS劫持),输入一个不存在的域名,正常的情况下浏览器是显示无法连接,DNS劫持会跳转到一个广告页面。先随便nslookup 一个不存在的域名,看看ISP商劫持的IP地址。 3)智能DNS加快解析速度,打开/etc/dnsmasq.conf文件,server=后面可以添加指定的DNS,例如国内外不同的网站使用不同的DNS。 国内指定DNS server=/cn/114.114.114.114 server=/taobao.com/114.114.114.114 server=/taobaocdn.com/114.114.114.114 国外指定DNS server=/google

Docker container can only access internet with --net=host

╄→гoц情女王★ 提交于 2019-12-09 11:47:36
问题 Just installed docker 1.10.1 today using their installation guide. However, none of my containers can access the internet unless I used --net=host in the docker run command. I have tried various workarounds from these posts: http://odino.org/cannot-connect-to-the-internet-from-your-docker-containers/ My docker container has no internet I can't get Docker containers to access the internet? Docker container cannot access internet Nothing has worked so far save for adding --net=host to the run

Dnsmasq 解析域名到内网IP

风流意气都作罢 提交于 2019-12-09 10:53:10
目标: 局域网的人访问某个域名时,拦截下来到指定的ip,做缓存节省带宽 配置: 1 ;>yum install dnsmasq -y 2 ; >vi /etc/dnsmasq.conf resolve-file=/etc/dnsmasq.resolv.conf addn-hosts=/etc/dnsmasq.hosts resolve-file指定dnsmasq从哪里获取上行DNS Server, 默认是从/etc/resolv.conf获取。 addn-hosts指定dnsmasq从哪个文件中读取“地址 域名”记录, 默认是系统文件/etc/hosts; listen-address默认是监控在所有网卡上的 3;cp /etc/resolv.conf /etc/dnsmasq.resolv.conf cp /etc/hosts /etc/dnsmasq.hosts 4;vi /etc/dnsmasq.hosts 10.6.0.210 www.baidu.com 5; 测试 echo my ip is 210 >/var/www/html/index.html service httpd restart 客户端指定dns为 10.6.0.210 访问 www.baidu.com 来源: oschina 链接: https://my.oschina.net/u/1791256

Docker container internal vs external dns resolution issue using Traefik

谁说我不能喝 提交于 2019-12-06 15:08:48
Docker 18.06.1-ce, traefik 1.7.3, dnsmasq, Mac 10.14 I have docker-compose setup with Traefik and need to access several services from inside the docker network/containers and externally. On a linux box (with Let'sEncrypt and http redirected to https), everything works using the same FQDN for both docker container internal and external access, and I don't have to use the service names. When I run curl http://belapi.dev.biodati.test from inside the pipeline container using docker-compose exec belapi /bin/bash I get the following error (and I don't see it showing up in the Traefik access logs):

基于 DNS 动态发现方式部署 Etcd 集群

爷,独闯天下 提交于 2019-12-06 14:47:19
使用discovery的方式来搭建etcd集群方式有两种: etcd discovery 和 DNS discovery 。在 「 基于已有集群动态发现方式部署etcd集群 」一文中讲解了 etcd discovery 这种方式,今天我们就来讲讲 DNS discovery 这种方式的实现。 etcd在基于DNS做服务发现时,实际上是利用DNS的SRV记录不断轮训查询实现的。 DNS SRV 是DNS数据库中支持的一种资源记录的类型,它记录了哪台计算机提供了哪个服务这么一个简单信息。 本文采用 dnsmasq 作为 dns 服务器,关于 dnsmasq 搭建可参考 「 利用Dnsmasq部署DNS服务 」。 创建DNS记录 增加DNS SRV记录 $ vim /etc/dnsmasq.conf #增加内容如下 srv-host=_etcd-server._tcp.hi-linux.com,etcd1.hi-linux.com,2380,0,100 srv-host=_etcd-server._tcp.hi-linux.com,etcd2.hi-linux.com,2380,0,100 srv-host=_etcd-server._tcp.hi-linux.com,etcd3.hi-linux.com,2380,0,100 增加对应的域名解析 $ vim /etc/dnsmasq

wildcard paths in dnsmasq?

好久不见. 提交于 2019-12-06 12:09:27
Is it possible to set a wildcard * in a path pattern? address=.example.com/foo/*/bar does not seem to work. address=.example.com/foo/xxx/bar works but I have random characters I need to match for and I don't know what they are ahead of time. Not possible. dnsmask is about the resolution of the host name only. Everything after the slash is between the web browser (or client) and the web server, the name servers don't ever get to see this part. It can get confusing, because dnsmasq uses '/' as its separator character in a lot of its settings, but this is nothing to do with the path part of a url

Dnsmasq MacOS使用介绍

徘徊边缘 提交于 2019-12-04 10:24:26
Dnsmasq MacOS使用介绍 问题: pc端开发时,需要在/etc/hosts里配置各种本地环境;当开发移动的界面时,除了使用浏览器的"手机模式"查看效果,还可以直接使用手机进行查看。但是修改手机的/etc/hosts就比较麻烦了。 解决办法: 使用dnsmasq在pc上搭建dns服务器 设置dnsmasq,使其dns解析时,先读取/etc/hosts,然后读取/etc/resolv.conf里配置,使用其配置的dns server做为上有dns server 在手机上设置wifi网络的dns服务器地址为上步搭建的dns地址(建议设置为唯一的一个dns server地址,避免干扰) dnsmasq安装 brew install dnsmasq 配置文件位置: /usr/local/etc/dnsmasq.conf 端口 port=53(默认值) 上游dns服务配置读取 resolv-file=/etc/resolv.conf 读取/etc/hosts里的配置 addn-hosts=/etc/hosts 监听地址,127.0.0.1和局域网地址都必须设置;这两个都是dnsmasq的dns服务器地址,127.0.0.1是方便本地测试使用的 listen-address=127.0.0.1,x.x.x.x(本机的局域网地址) sudo brew services start

Setting Up Docker Dnsmasq

隐身守侯 提交于 2019-12-04 09:30:54
问题 I'm trying to set up a docker dnsmasq container so that I can have all my docker containers look up the domain names rather than having hard-coded IPs (if they are on the same host). This fixes an issue with the fact that one cannot alter the /etc/hosts file in docker containers, and this allows me to easily update all my containers in one go, by altering a single file that the dnsmasq container references. It looks like someone has already done the hard work for me and created a dnsmasq