Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
zh:docs:guide-user:base-system:dhcp.dnsmasq [2019/11/04 22:44] longgenxingzh: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软件 ===== ====== Dnsmasq软件 =====
Line 75: Line 73:
 Without this setting, you'll have to add //.lan// entries to your ''/etc/hosts''. Without this setting, you'll have to add //.lan// entries to your ''/etc/hosts''.
  
 +**中文翻译**:
 +在这个参数里你可以随便定义自己的主机域名。
 +同样的,如果你想让你定义的域名访问到你的本地机器,又不想在“/etc/hosts”文件里添加域名解析信息,你也可以直接在“/etc/dnsmasq.conf”里添加“expand-hosts”参数设定。
 +
 +举例说,如果不使用“expand-hosts”选项设置,你就只可以访问到 //router, ubuntu-desktop and ubuntu-laptop//
 +而如果使用了“expand-hosts”选项,那么你可以访问到除了//router, ubuntu-desktop and ubuntu-laptop//,还有// router.lan,  ubuntu-desktop.lan//等等。
 +这个特点可能正是你想要的。
 +
 +如果不用这个选项来设置的话,你要达到同样的效果,就需要你在“/etc/hosts”文件里配置“.lan”的域名条目了。
 ==== /etc/ethers ==== ==== /etc/ethers ====
 +==== /etc/ethers配置文件 ====
 In ''/etc/ethers'' static lease entries can be assigned. In ''/etc/ethers'' static lease entries can be assigned.
 See -> [[docs:guide-user:base-system:dhcp#static_leases]]. See -> [[docs:guide-user:base-system:dhcp#static_leases]].
  
 +**中文翻译**:
 +
 +在“/etc/ethers”中静态的分配地址。
 +详情请参考-> [[docs:guide-user:base-system:dhcp#static_leases]].
 ==== /etc/hosts ==== ==== /etc/hosts ====
 +==== /etc/hosts配置文件 ====
 In ''/etc/hosts'' DNS entries are configured. In ''/etc/hosts'' DNS entries are configured.
 Dnsmasq will utilize these entries to answer DNS queries on your network. Dnsmasq will utilize these entries to answer DNS queries on your network.
 +
 +**中文翻译**:在“/etc/hosts”文件中配置DNS的解析条目。
 +Dnsmasq软件将使用这些条目来响应来自网络的DNS查询请求。
 +
 +DNS条目的编写格式如下:
  
 Format: Format:
  
 <code bash> <code bash>
-[IP_addresshost_name host_name_short ...+[IP地址主机名称 主机名称缩写 ...
 </code> </code>
  
-Example:+例如:
  
 <code bash> <code bash>
Line 98: 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/DHCPACK ==== ==== Log spammed with DHCPINFORM/DHCPACK ====
 +==== DHCP通知/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 110: Line 137:
  
 Solution: Solution:
 +
 +**中文翻译**:
 +Windows7跟其他系统之间,使用DHCP来配置代理的情况里;
 +因为客户端不停的发送请求,直到收到回复才会停止;
 +结果就是,在日志里充满了这些重复的请求,下面就是这么一个例子的解决(参看[[http://wiki.excito.com/w/index.php?title=Stop_DHCP_INFORM_flooding|the excito wiki]]提供相关的信息)。
 +
 +解决方法如下:
  
 <code bash> <code bash>
Line 118: Line 152:
  
 ==== Static lease issues ==== ==== Static lease issues ====
 +==== 静态地址绑定的问题 ====
 Windows 7 has introduced a new [[http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/windows-7-refuses-dhcp-addresses-if-they-were/1b72b289-0f58-492f-afb8-e76c80a81f00|Microsoft-enhanced]] feature. Windows 7 has introduced a new [[http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/windows-7-refuses-dhcp-addresses-if-they-were/1b72b289-0f58-492f-afb8-e76c80a81f00|Microsoft-enhanced]] feature.
 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 123: Line 158:
  
 If you try configure MAC address hot swap on your router, Windows 7 clients will end up in an infinite [[http://tools.ietf.org/html/rfc1531#section-3.1|DORA]] loop. If you try configure MAC address hot swap on your router, Windows 7 clients will end up in an infinite [[http://tools.ietf.org/html/rfc1531#section-3.1|DORA]] loop.
 +
 +**中文翻译**:
 +Windows7包含一个新的功能 [[http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/windows-7-refuses-dhcp-addresses-if-they-were/1b72b289-0f58-492f-afb8-e76c80a81f00|Microsoft-enhanced]] 。
 +系统不会把一个之前已经由DHCP服务器分配给另外一个接口(对应网卡)的IP地址,再配置给当前接口;即使是这个接口现在已经关闭了(比如该接口的网线已经拔了)。
 +这个处理思路很清奇,在老版本的Windows、Mac OS、Linux里都没听说过。
 +
 +如果你尝试在你的路由器里配置MAC地址绑定和解绑定的功能,Windows7客户端就会无休止的循环请求。
 +
  
 Solution: Solution:
Line 131: 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地址,并写到“/etc/config/dhcp”
 +    * 因为你的网桥可能会占用或者改变你的MAC地址,你可能会在WiFi接口上丢失SLAAC状态,这样,你如果想用无线网络,就得在你的笔记本上(假设你的客户机就是笔记本)禁掉IPv6.
 +  - 另一种对IPv6兼容一点的做法是,你可以不要添加网桥的配置,也不用手工去dnsmasq软件里添加MAC地址,但是却要做别的配置:
 +    * 如果你要用有线网络,你插网线的前,先去控制面板把无线网卡禁用掉。
 +    * 如果你要用无线网络,你拔网线的前,再把无线网卡启用,然后把有线网卡禁用。
  
 <code bash> <code bash>
Line 142: Line 195:
  
 ===== Notes ===== ===== Notes =====
 +===== 相关信息 =====
   * Project Homepage: [[http://thekelleys.org.uk/dnsmasq/doc.html]]   * Project Homepage: [[http://thekelleys.org.uk/dnsmasq/doc.html]]
   * Tutorial http://www.enterprisenetworkingplanet.com/netos/article.php/3377351   * Tutorial http://www.enterprisenetworkingplanet.com/netos/article.php/3377351
   * Tutorial http://martybugs.net/wireless/openwrt/dnsmasq.cgi   * Tutorial http://martybugs.net/wireless/openwrt/dnsmasq.cgi
  
 +
 +===== 翻译信息 =====
 +LongGenxing 20191105 第一次翻译
  • Last modified: 2023/12/28 18:34
  • by heybrowhatsup