无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 5122|回复: 10
打印 上一主题 下一主题

悬赏贴:如何通过dnsmasq实现bios和uefi双网启菜单

[复制链接]
跳转到指定楼层
1#
发表于 2021-10-21 04:30:33 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 tigerhuang 于 2021-10-21 10:26 编辑

赏金是不少于2年的免费科学上.网或我的800本论坛积分

我的ARM路由器上跑着FreshTomato系统(一种简化版的Linux系统),其内置的Dnsmasq版本号是2.85,Dnsmasq的配置部分可以任意添加内容。目前我已经可以通过更改路由器的Dnsmasq内容分别实现BIOS网启或UEFI网启,并且用FTP下载大的WinPE文件,现在想自动判断BIOS还是UEFI并实现网启。

要求:
1.自动判断pxe客户端是BIOS还是UEFI,
2.无论是BIOS还是UEFI网启,都能出现菜单,方便我以后添加启动项目
3.通过tftp读取配置文件后,然后通过FTP下载WinPE文件,不用HTTP是因为我的HTTP有其他用途,
4.能提供除WinPE外所有的配置模板文件,不需要我再去不同的地方到处找了。配置模板应该不会很大,如果本论坛不允许上载,可以上载到我的个人FTP服务器。

我目前的配置见附件,很简单,


Dnsmasq.png (13.57 KB, 下载次数: 108)

Dnsmasq.png
2#
发表于 2021-10-21 06:10:15 | 只看该作者
帮顶
回复

使用道具 举报

3#
发表于 2021-10-21 08:59:57 | 只看该作者
等待赏金猎人
回复

使用道具 举报

4#
发表于 2021-10-21 09:17:06 | 只看该作者
顶个人气
回复

使用道具 举报

5#
发表于 2021-10-21 18:39:29 | 只看该作者
要求增加到99年啊
回复

使用道具 举报

6#
发表于 2021-10-21 18:50:44 | 只看该作者
顶一下
回复

使用道具 举报

7#
发表于 2021-10-23 11:09:36 来自手机 | 只看该作者
哈哈 99年
回复

使用道具 举报

8#
发表于 2022-1-8 12:38:05 | 只看该作者
我以前的帖子里面有

点评

以前的看过了,没找到.  详情 回复 发表于 2022-1-9 08:48
回复

使用道具 举报

9#
 楼主| 发表于 2022-1-9 08:48:17 | 只看该作者
未完成的歌 发表于 2022-1-8 12:38
我以前的帖子里面有

以前的看过了,没找到.
回复

使用道具 举报

10#
发表于 2022-1-9 22:18:59 | 只看该作者
本帖最后由 2011liuyun 于 2022-1-9 22:22 编辑
  1. # Known working dnsmasq version 2.85 config for iPXE proxydhcp usage
  2. # Debug logging
  3. # log-debug

  4. # Enable DHCP logging
  5. log-dhcp

  6. # Disable DNS server
  7. port=0

  8. # send disable multicast and broadcast discovery, and to download the boot file immediately
  9. # DHCP_PXE_DISCOVERY_CONTROL, should be vendor option? Needs more understanding and source
  10. dhcp-option=vendor:PXEClient,6,2b

  11. # This range(s) is for the public interface, where dnsmasq functions
  12. # as a proxy DHCP server providing boot information but no IP leases.
  13. # Any ip in the subnet will do, so you may just put your server NIC ip here.
  14. dhcp-range=172.16.6.211,proxy

  15. interface=eth0
  16. # bind-dynamic - remove interface and use this instead to listen everywhere?
  17. # Disable re-use of the DHCP servername and filename fields as extra
  18. # option space. That's to avoid confusing some old or broken DHCP clients.
  19. dhcp-no-override

  20. #dhcp-match=set:<tag>,<option number>|option:<option name>|vi-encap:<enterprise>[,<value>]
  21. #dhcp-boot=[tag:<tag>,]<filename>,[<servername>[,<server address>|<tftp_servername>]]

  22. # Based on logic in https://gist.github.com/robinsmidsrod/4008017
  23. # iPXE sends a 175 option, checking suboptions
  24. dhcp-match=set:ipxe-http,175,19
  25. dhcp-match=set:ipxe-https,175,20
  26. dhcp-match=set:ipxe-menu,175,39
  27. # pcbios specific
  28. dhcp-match=set:ipxe-pxe,175,33
  29. dhcp-match=set:ipxe-bzimage,175,24
  30. dhcp-match=set:ipxe-iscsi,175,17
  31. # efi specific
  32. dhcp-match=set:ipxe-efi,175,36
  33. # combination
  34. # set ipxe-ok tag if we have correct combination
  35. # http && menu && iscsi ((pxe && bzimage) || efi)
  36. tag-if=set:ipxe-ok,tag:ipxe-http,tag:ipxe-menu,tag:ipxe-iscsi,tag:ipxe-pxe,tag:ipxe-bzimage
  37. tag-if=set:ipxe-ok,tag:ipxe-http,tag:ipxe-menu,tag:ipxe-iscsi,tag:ipxe-efi

  38. #pxe-service=[tag:<tag>,]<CSA>,<menu text>[,<basename>|<bootservicetype>][,<server address>|<server_name>]
  39. #pxe-prompt=[tag:<tag>,]<prompt>[,<timeout>]
  40. # these create option 43 cruft, which is required in proxy mode
  41. # TFTP IP is required on all dhcp-boot lines (unless dnsmasq itself acts as tftp server?)
  42. pxe-service=tag:!ipxe-ok,X86PC,PXE,Boot/pcbios/ipxe.bios,172.16.6.211
  43. pxe-service=tag:!ipxe-ok,IA32_EFI,PXE,Boot/efi/snponlyx32.efi,172.16.6.211
  44. pxe-service=tag:!ipxe-ok,BC_EFI,PXE,Boot/efi/ipxe.efi,172.16.6.211
  45. pxe-service=tag:!ipxe-ok,X86-64_EFI,PXE,Boot/efi/ipxe.efi,172.16.6.211

  46. # later match overrides previous, keep ipxe script last
  47. # server address must be non zero, but can be anything as long as iPXE script is not fetched over TFTP
  48. # dhcp-boot=tag:ipxe-ok,http://boot.ipxe.org/demo/boot.php,,0.0.0.1
  49. dhcp-boot=tag:ipxe-ok,Boot/init.txt,,172.16.6.211

  50. # To use internal TFTP server enabled these, recommended is otherwise atftp
  51. enable-tftp
复制代码

我的配置文件 proxydhcp模式
回复

使用道具 举报

11#
发表于 2022-1-9 22:23:23 | 只看该作者
  1. # /etc/dnsmasq.conf

  2. # Disable DNS Server
  3. port=0

  4. # Enable DHCP logging
  5. log-dhcp

  6. # Respond to PXE requests for the specified network;
  7. # run as DHCP proxy
  8. bind-interfaces
  9. interface=eth0
  10. dhcp-range=172.16.6.221,172.16.6.240,24h
  11. dhcp-option=3,172.16.6.254
  12. dhcp-option=6,172.16.1.11,172.16.1.12

  13. dhcp-match=set:x86-32,option:client-arch,0
  14. dhcp-boot=tag:x86-32,Boot/pcbios/ipxe.bios

  15. dhcp-match=set:IA64,option:client-arch,2
  16. dhcp-boot=tag:IA64,efi/ipxe-i386.efi

  17. dhcp-match=set:efi-x86_32,option:client-arch,6
  18. dhcp-boot=tag:efi-x86_32,efi/ipxe-i386.efi

  19. dhcp-match=set:efi-x86_64,option:client-arch,7
  20. dhcp-boot=tag:efi-x86_64,Boot/efi/ipxe.efi

  21. dhcp-match=set:efi-x86_649,option:client-arch,9
  22. dhcp-boot=tag:efi-x86_649,Boot/efi/ipxe.efi

  23. dhcp-match=set:ipxe,175
  24. dhcp-boot=tag:ipxe,Boot/init.txt

  25. enable-tftp
  26. tftp-root=/mnt/data/www
复制代码


我的配置文件 dhcp模式
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-4-28 13:12

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表