Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision Next revisionBoth sides next revision | ||
| zh:docs:guide-user:base-system:dhcp.dnsmasq [2019/11/04 09:41] – created longgenxing | zh:docs:guide-user:base-system:dhcp.dnsmasq [2019/11/05 04:17] – longgenxing | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
| - | |||
| ====== Dnsmasq ===== | ====== Dnsmasq ===== | ||
| + | ====== Dnsmasq软件 ===== | ||
| [[wp> | [[wp> | ||
| It is designed to provide DNS and, optionally, DHCP, to a small network. | It is designed to provide DNS and, optionally, DHCP, to a small network. | ||
| Line 8: | Line 7: | ||
| Dnsmasq supports static and dynamic DHCP leases and BOOTP for network booting of disk-less machines. | Dnsmasq supports static and dynamic DHCP leases and BOOTP for network booting of disk-less machines. | ||
| It is already installed and preconfigured on OpenWrt. | It is already installed and preconfigured on OpenWrt. | ||
| + | |||
| + | **中文翻译**: | ||
| + | [[wp> | ||
| + | 它用来为小型网络提供DNS解析的,以及DHCP地址分发。 | ||
| + | 它还可以用来解析那些公网上没有的,本地网络的主机名称的IP地址。 | ||
| + | DHCP服务器整合了一个DNS服务器,以及一个用来分配地址DHCP分配器;不管DNS的解析名字是配置在各个主机里,还是统一配置在一个文件里。 | ||
| + | Dnsmasq可以支持动态或者静态的地址分配,以及用于BOOTP这样无盘系统的场景下。 | ||
| + | OpenWrt内置,且默认配置了该软件。 | ||
| ===== Configuration ===== | ===== Configuration ===== | ||
| + | ===== 配置方法 ===== | ||
| The configuration is done with help of the uci-configuration file: ''/ | The configuration is done with help of the uci-configuration file: ''/ | ||
| Depending on the setting in the uci-file, you may also use the files ''/ | Depending on the setting in the uci-file, you may also use the files ''/ | ||
| + | |||
| + | **中文翻译**: | ||
| + | |||
| + | 配置方法可以使用统一的配置文件“/ | ||
| + | |||
| + | 只要在uci的配置文件里做了相应的设置,你也可以使用“/ | ||
| ==== / | ==== / | ||
| + | ==== / | ||
| -> [[docs: | -> [[docs: | ||
| Almost all settings can be configured with it! | Almost all settings can be configured with it! | ||
| + | |||
| + | **中文翻译**: | ||
| + | -> [[docs: | ||
| ==== / | ==== / | ||
| + | ==== / | ||
| It is possible to mix the traditional ''/ | It is possible to mix the traditional ''/ | ||
| Line 29: | Line 48: | ||
| By default, Dnsmasq comes configured to put your hosts into the '' | By default, Dnsmasq comes configured to put your hosts into the '' | ||
| This is specified in the configuration file as: | This is specified in the configuration file as: | ||
| + | |||
| + | **中文翻译**: | ||
| + | 统一的配置文件“/ | ||
| + | 而“dnsmasq.conf”文件默认是不存在的,但是dnsmasq软件再启动的时候,如果发现有该文件,那么它就会去处理。 | ||
| + | 注意,在配置文件最终转换成dnsmasq配置命令参数的时候,“/ | ||
| + | |||
| + | 例如: | ||
| + | 默认情况下,Dnsmasq可以将你的主机解析到“.lan”的域名下 | ||
| + | 这个可以在配置文件里就指定了: | ||
| <code bash> | <code bash> | ||
| Line 45: | Line 73: | ||
| Without this setting, you'll have to add //.lan// entries to your ''/ | Without this setting, you'll have to add //.lan// entries to your ''/ | ||
| + | **中文翻译**: | ||
| + | 在这个参数里你可以随便定义自己的主机域名。 | ||
| + | 同样的,如果你想让你定义的域名访问到你的本地机器,又不想在“/ | ||
| + | |||
| + | 举例说,如果不使用“expand-hosts”选项设置,你就只可以访问到 //router, ubuntu-desktop and ubuntu-laptop// | ||
| + | 而如果使用了“expand-hosts”选项,那么你可以访问到除了// | ||
| + | 这个特点可能正是你想要的。 | ||
| + | |||
| + | 如果不用这个选项来设置的话,你要达到同样的效果,就需要你在“/ | ||
| ==== /etc/ethers ==== | ==== /etc/ethers ==== | ||
| + | ==== / | ||
| In ''/ | In ''/ | ||
| See -> [[docs: | See -> [[docs: | ||
| + | **中文翻译**: | ||
| + | |||
| + | 在“/ | ||
| + | 详情请参考-> | ||
| ==== /etc/hosts ==== | ==== /etc/hosts ==== | ||
| + | ==== / | ||
| In ''/ | In ''/ | ||
| Dnsmasq will utilize these entries to answer DNS queries on your network. | Dnsmasq will utilize these entries to answer DNS queries on your network. | ||
| + | |||
| + | **中文翻译**:在“/ | ||
| + | Dnsmasq软件将使用这些条目来响应来自网络的DNS查询请求。 | ||
| + | |||
| + | DNS条目的编写格式如下: | ||
| Format: | Format: | ||
| <code bash> | <code bash> | ||
| - | [IP_address] host_name host_name_short | + | [IP地址] 主机名称 主机名称缩写 |
| </ | </ | ||
| - | Example: | + | 例如: |
| <code bash> | <code bash> | ||
| Line 68: | Line 116: | ||
| ===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
| + | ===== 特殊问题排除 ===== | ||
| ==== DHCP response missing due to network overload ==== | ==== DHCP response missing due to network overload ==== | ||
| + | ==== 因网络过载引起的 DHCP 响应丢失 ==== | ||
| Sometimes when an interface is on the edge of the capacity (especially WiFi over longer distances) a DHCP request could be not replied in time. | Sometimes when an interface is on the edge of the capacity (especially WiFi over longer distances) a DHCP request could be not replied in time. | ||
| Therefore the DHCP client will not be able to receive proper network settings. | Therefore the DHCP client will not be able to receive proper network settings. | ||
| A possible workaround is using static IPs or very long DHCP leases (more than 12h). | A possible workaround is using static IPs or very long DHCP leases (more than 12h). | ||
| This is particularly important when one has several WiFi repeaters that use DHCP and are distant from each other or not easily accessible. | This is particularly important when one has several WiFi repeaters that use DHCP and are distant from each other or not easily accessible. | ||
| + | |||
| + | **中文翻译**: | ||
| + | 有些时候,当一个网络接口快达到它的处理能力的时候(特别是因为WiFi因为超出其稳定信号的范围),DHCP的请求可能不会及时响应。 | ||
| + | 因此DHCP客户端就没法收到网络地址的配置。 | ||
| + | 一种折中的解决办法设置静态IP地址,或者加长DHCP租用时间(比如大于12小时)。 | ||
| + | 这在存在很多WiFi中继的场景中很重要,因为它们之间很远或者连接不稳定。 | ||
| ==== Log spammed with DHCPINFORM/ | ==== Log spammed with DHCPINFORM/ | ||
| + | ==== DHCP通知/ | ||
| Windows 7 among others ask for proxy settings using DHCP. | Windows 7 among others ask for proxy settings using DHCP. | ||
| The issue is that they do not stop asking until they have received an answer. | The issue is that they do not stop asking until they have received an answer. | ||
| Line 80: | Line 137: | ||
| Solution: | Solution: | ||
| + | |||
| + | **中文翻译**: | ||
| + | Windows7跟其他系统之间,使用DHCP来配置代理的情况里; | ||
| + | 因为客户端不停的发送请求,直到收到回复才会停止; | ||
| + | 结果就是,在日志里充满了这些重复的请求,下面就是这么一个例子的解决(参看[[http:// | ||
| + | |||
| + | 解决方法如下: | ||
| <code bash> | <code bash> | ||
| Line 88: | Line 152: | ||
| ==== Static lease issues ==== | ==== Static lease issues ==== | ||
| + | ==== 静态地址绑定的问题 ==== | ||
| Windows 7 has introduced a new [[http:// | Windows 7 has introduced a new [[http:// | ||
| It won't assign IP address obtained from a DHCP server to an interface, if the IP was used before for another interface, even if that other interface is **NOT** active currently (i.e. cable disconnected). | It won't assign IP address obtained from a DHCP server to an interface, if the IP was used before for another interface, even if that other interface is **NOT** active currently (i.e. cable disconnected). | ||
| Line 93: | Line 158: | ||
| If you try configure MAC address hot swap on your router, Windows 7 clients will end up in an infinite [[http:// | If you try configure MAC address hot swap on your router, Windows 7 clients will end up in an infinite [[http:// | ||
| + | |||
| + | **中文翻译**: | ||
| + | Windows7包含一个新的功能 [[http:// | ||
| + | 系统不会把一个之前已经由DHCP服务器分配给另外一个接口(对应网卡)的IP地址,再配置给当前接口;即使是这个接口现在已经关闭了(比如该接口的网线已经拔了)。 | ||
| + | 这个处理思路很清奇,在老版本的Windows、Mac OS、Linux里都没听说过。 | ||
| + | |||
| + | 如果你尝试在你的路由器里配置MAC地址绑定和解绑定的功能,Windows7客户端就会无休止的循环请求。 | ||
| + | |||
| Solution: | Solution: | ||
| Line 101: | Line 174: | ||
| * When you plug the ethernet cable in, disable wireless interface in control panel (power off wireless won't do it). | * When you plug the ethernet cable in, disable wireless interface in control panel (power off wireless won't do it). | ||
| * When you unplug ethernet cable, enable wireless and disable ethernet. | * When you unplug ethernet cable, enable wireless and disable ethernet. | ||
| + | |||
| + | **中文翻译**: | ||
| + | |||
| + | 解决方案如下: | ||
| + | - 创建一个Windows7种的有线网卡跟无线网卡的网桥,然后: | ||
| + | * 给这个网桥添加MAC地址,并写到“/ | ||
| + | * 因为你的网桥可能会占用或者改变你的MAC地址,你可能会在WiFi接口上丢失SLAAC状态,这样,你如果想用无线网络,就得在你的笔记本上(假设你的客户机就是笔记本)禁掉IPv6. | ||
| + | - 另一种对IPv6兼容一点的做法是,你可以不要添加网桥的配置,也不用手工去dnsmasq软件里添加MAC地址,但是却要做别的配置: | ||
| + | * 如果你要用有线网络,你插网线的前,先去控制面板把无线网卡禁用掉。 | ||
| + | * 如果你要用无线网络,你拔网线的前,再把无线网卡启用,然后把有线网卡禁用。 | ||
| <code bash> | <code bash> | ||
| Line 112: | Line 195: | ||
| ===== Notes ===== | ===== Notes ===== | ||
| + | ===== 相关信息 ===== | ||
| * Project Homepage: [[http:// | * Project Homepage: [[http:// | ||
| * Tutorial http:// | * Tutorial http:// | ||
| * Tutorial http:// | * Tutorial http:// | ||
| + | |||
| + | ===== 翻译信息 ===== | ||
| + | LongGenxing 20191105 第一次翻译 | ||