个人工具
登录
查看“UbuntuHelp:Dnsmasq”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:Dnsmasq”的源代码
来自Ubuntu中文
←
UbuntuHelp:Dnsmasq
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/Dnsmasq}} {{Languages|UbuntuHelp:Dnsmasq}} ==== Worth a note here: ==== I didn't use dnsmasq for its dhcp - I used it for its dns. If dhcp help added would be A Good Thing, just let me know and I'll work it out :) Note from Ubuntu:HervéFache: you can find additional information on how to setup Dnsmasq on the UbuntuWirelessRouter page. === Preparation === First we are going to do something seemingly unrelated - we will make a new resolv.conf, but call it '/etc/nameservers' (the filename is arbitary, but seemed like a good choice). To do this, open a terminal, and run 'host' on your ISP's nameservers (mine are just below) <pre><nowiki> kgoetz@server:~$ host ns1.on.net ns1.on.net has address 216.200.145.64 kgoetz@server:~$ host ns2.on.net ns2.on.net has address 192.231.203.2 kgoetz@server:~$ host ns3.on.net ns3.on.net has address 192.83.231.19 kgoetz@server:~$ host ns4.on.net ns4.on.net has address 192.231.203.3 </nowiki></pre> Now takes those lines, and add them to /etc/nameservers In a terminal <pre><nowiki> sudo vi /etc/nameservers </nowiki></pre> and in that file paste lines like to these, but using the output you got above. <pre><nowiki> nameserver 216.200.145.64 nameserver 192.231.203.2 nameserver 192.83.231.19 nameserver 192.231.203.3 </nowiki></pre> If you dont have 4 thats fine, but more nameservers=less chance of failure. Having done that, we can move on to the actual install === Setup for dnsmasq === Like much of the Ubuntu packages, dnsmasq is in universe. Make sure its enabled, then run these commands <pre><nowiki> sudo apt-get update sudo apt-get install dnsmasq </nowiki></pre> dnsmasq can be configured by editing the file <pre><nowiki> /etc/dnsmasq.conf </nowiki></pre> On the first page of options is one to "... filter useless windows-originated DNS requests which can trigger dial-on-demand links needlessly." If your in that situation, you might want to uncomment `filterwin2k`. How about making use of that file we made before? Uncomment the next option in the config file, and add your nameserver file to the end. `resolv-file=/etc/nameservers` Now we can be sure our nameserver is getting its dns from a trusted upstream source, and isnt going to go walkabout. Now we dont need to really worry about any settings untill we get down to "# Add domains which you want to force to an IP address here.". This one is fun, as we can point any dns request that comes in to any ip we want. In the mood to spread Ubuntu love? How about all requests to Microsoft.com go... astray? All we need is this option and an ip to redirect to. <pre><nowiki> address=/microsoft.com/82.211.81.158 </nowiki></pre> With this line added to your dnsmasq, visits to Microsoft are a thing of the past. ( Its now pointing to ubuntulinux.org ;) ) Heres my current list, perhaps it will grow as needed: <pre><nowiki> address=/doubleclick.net/192.168.0.2 address=/googlesyndication.com/192.168.0.2 address=/google-analytics.com/192.168.0.2 address=/googleadservices.com/192.168.0.2 address=/decideinteractive.com/192.168.0.2 # Not blocking redirects (google.com -> google.com.au) address=/google.com/216.239.39.104 </nowiki></pre> Its a short list, mainly because with stuff like [[UbuntuHelp:Privoxy|privoxy installed]] there isn't much call for a long one. This is just to weed out servers that privoxy misses, you dont want people visiting, or to put in simple redirects :) Heading down a few lines and we are looking at the interface line. This specifies which Ethernet device to bind to (`eth0`, `eth1` etc), or if you would rather you can use the bind-address just below it and bind it to an IP instead (`127.0.0.1`, `192.168.0.1`, 10.0.1.254`, etc). === Guess what? We just finished! === Save and exit the file, restart the daemon and you should be running. <pre><nowiki> sudo /etc/init.d/dnsmasq restart </nowiki></pre> The last thing that has to be done is editing your /etc/resolv.conf to point to the IP address of dnsmasq - this is the last option you set, so I hope you still remember it :) To your local dns cache address being overwritten in /etc/resolv.conf, you can add the line <pre><nowiki> prepend domain-name-servers 127.0.0.1 </nowiki></pre> to /etc/dhcp3/dhclient.conf ---- [[category:CategoryDocumentation]] [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:Dnsmasq
。