荣耀之链论坛

 找回密码
 立即注册
搜索
查看: 2418|回复: 6

ipxe

[复制链接]

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
发表于 2020-12-29 14:45 | 显示全部楼层 |阅读模式

这一楼就只需要看那几个配置文件的写法就行了  这里有我学习的过程,一些结论是错误的  下面的链接可以参考

  1. 首先需要通过ISO引导才能进入ipxe的界面 这种方式略过,网站里面的硬件就是集成了这个iso的方式,不用看了

  2. 然后如果想通过tftp引导启动 则先要下载undionly.kpxe这个文件https://ipxe.org/howto/chainloading
  3. 然后tftp的boot文件就填这个文件
  4. 这个文件官网下载的是每次都需要按ctrl+b进入命令行界面的,不知道默认的配置文件名是什么还是说根本没有默认配置文件名
  5. 官网有教说要自己配置make bin/undionly.kpxe EMBED=boot.ipxe(卧槽,还需要编辑这个boot.ipxe 内容 DHCP chain --autofree boot.ipxe 这样才会查找 我晕了) 指定默认的配置文件,但是我自己编译失败了
  6. 就用之前的那个吧,实测可以进iscsi

  7. 下面是之前那个文件的使用方式
  8. 通过boot.ipxe匹配对应的配置文件,下面的配置文件里面,前面几个都没有匹配到,最后就匹配到最后一个menu.ipxe
  9. 然后menu.ipxe里面就显示了各种启动选项
  10. 感觉做这个的是个高手,把各种可能的选项都想到了,我要找找mac匹配的,这样就可以通过mac来匹配不同的配置文件了

  11. https://ipxe.org/cmd这个页面可以查看ipxe的各种命令

  12. 通过mac匹配的教程
  13. 变量${mac:hexhyp}的值应该是010203040506不带任何符号的12位字符,并且必须是小写
  14. 比如mac-000c29c46fd8.ipxe这样才行,最开始用的大写没有匹配到
  15. 配置文件就是下面的menu.ipxe
  16. 然后用initrd启动的时候memdisk这个文件必须在ipxe的同一级目录
  17. 启动PE的时候ISO文件的大小不能太大,实测WEPE的200M没问题,但是WIN10LTSC的4G的就提示磁盘空间不足了,不知道是为什么

  18. 感觉启动PE的时候不需要用这种方式,直接sanboot就行比如sanboot http://192.168.11.2/WIN10LTSC/ltsc.iso可以直接启动(用这个方式就不能同时用sanhook)
  19. (我想研究直接无盘装系统的,先sanhook再启动必须用initrd,但是WEPE没网络,启动到一半就断连接了,然后ltsc的iso又无法启动,卡在这里了)

  20. 现在问题来了,首先,客户机无盘的情况下怎么装系统到iscsi(-----------就是这个不会,而且这个还需要使用UEFI----------)
  21. (首先的难点是win10.iso太大,看看怎么才能不出错的引导,其次需要加载iscsi的驱动才能在装的时候维持iscsi,可能要涉及到修改ISO)
  22. 其次怎么在PE里面挂载ISCSI,方便改密码,比如用户忘记密码了,怎么改?(这个的解决办法是在服务器上建立hyper-v虚拟机,然后改好了关闭虚拟机)
  23. 通过mac启动以后判断iscsi是否有系统,有就通过iscsi启动系统,没有就启动到pe,并且是把iscsi也添加进去的那种(这个就不用看了,只有第一次是需要装系统的,后面都是直接sanboot)

  24. 回答:
  25. 先sanhook命令挂载 格式是 iscsi:服务器IP:用户名:密码:逻辑单元号:目标IQN
  26. sanhook iscsi:192.168.11.2:::0:iqn.1991-05.com.microsoft:server1-test-target
  27. 运行以后正确注册了sandevice,但是后面提示could not open san device 看看这个界面https://ipxe.org/err/2c0d60
  28. 然后用sanboot命令启动iso (-----这个步骤是错的,这两个命令不能同时出现,第一次装系统要研究一下-----)
  29. sanboot http://192.168.11.2/WIN10LTSC/ltsc.iso

  30. 最后还有个问题:
  31. ipxe的界面设置默认显示10秒,然后如果不操作就自动进默认的选项(最下面MAC的配置文件就有了)

  32. 补充一个:
  33. uefi启动的时候一定要关闭安全启动,因为ipxe的文件没有签名,过不了安全验证,听说是可以利用linux的grub2的efi文件实现安全启动,不过没必要了,自己用没事


  34. 测试用我自己的物理机看看
  35. FC-AA-14-4F-CD-D5
  36. fcaa144fcdd5

  37. 回答:直接通过iscsi启动
  38. https://jingyan.baidu.com/article/ceb9fb108c2a938cac2ba04b.html



  39. boot.ipxe的内容,这里定义了多个启动顺序
  40. 比如第一个就是hostname的启动,第二个是uuid启动,第三个是mac#########################################

  41. #!ipxe

  42. # Global variables used by all other iPXE scripts
  43. chain --autofree boot.ipxe.cfg ||

  44. # Boot <boot-url>/<boot-dir>/hostname-<hostname>.ipxe
  45. # if hostname DHCP variable is set and script is present
  46. isset ${hostname} && chain --replace --autofree ${boot-dir}hostname-${hostname}.ipxe ||

  47. # Boot <boot-url>/<boot-dir>/uuid-<UUID>.ipxe
  48. # if SMBIOS UUID variable is set and script is present
  49. isset ${uuid} && chain --replace --autofree ${boot-dir}uuid-${uuid}.ipxe ||

  50. # Boot <boot-url>/<boot-dir>/mac-010203040506.ipxe if script is present
  51. chain --replace --autofree ${boot-dir}mac-${mac:hexraw}.ipxe ||

  52. # Boot <boot-url>/<boot-dir>/pci-8086100e.ipxe if one type of
  53. # PCI Intel adapter is present and script is present
  54. chain --replace --autofree ${boot-dir}pci-${pci/${busloc}.0.2}${pci/${busloc}.2.2}.ipxe ||

  55. # Boot <boot-url>/<boot-dir>/chip-82541pi.ipxe if one type of
  56. # PCI Intel adapter is present and script is present
  57. chain --replace --autofree ${boot-dir}chip-${chip}.ipxe ||

  58. # Boot <boot-url>/menu.ipxe script if all other options have been exhausted
  59. chain --replace --autofree ${menu-url} ||

  60. boot.ipxe.cfg的内容 这里面定义了几个变量,包括menu-url和boot-dir(就是boot目录)
  61. #########################################
  62. #!ipxe

  63. # OPTIONAL: Base URL used to resolve most other resources
  64. # Should always end with a slash
  65. set boot-url tftp://${next-server}/

  66. set nas_ip 10.10.10.250

  67. # OPTIONAL: What URL to use when sanbooting
  68. # Usually ${boot-url} is used, but required until NFS supports block device API
  69. # Should always end with a slash
  70. set sanboot-url http://${nas_ip}:88/Install/

  71. # OPTIONAL: Relative directory to boot.ipxe used to
  72. # override boot script for specific clients
  73. set boot-dir boot/

  74. # REQUIRED: Absolute URL to the menu script, used by boot.ipxe
  75. # and commonly used at the end of simple override scripts
  76. # in ${boot-dir}.
  77. set menu-url ${boot-url}menu.ipxe

  78. # OPTIONAL: iSCSI server location and iSCSI IQNs
  79. # Must be specified as an IP, some clients have issues with name resolution
  80. # Initiator IQN is also calculated to use hostname, if present
  81. set iscsi-server ${nas_ip}
  82. set base-iqn iqn.2000-01.com.synology
  83. set base-iscsi iscsi:10.10.10.250:::1:iqn.2000-01.com.synology:ipxe.ESXI
  84. isset ${hostname} && set initiator-iqn ${base-iqn}:${hostname} || set initiator-iqn ${base-iqn}:${mac}

  85. # OPTIONAL: URL to report memtest results to
  86. set memtest-report-url http://boot.smidsrod.lan/memtest-report.cgi

  87. menu.ipxe的内容
  88. #!ipxe
  89. #下面这个3000是菜单等待时间代表3秒,
  90.    set menu-timeout 3000
  91.    set menu-default WINDOWS
  92.    isset ${ip} || dhcp
  93. set initiator-iqn iqn.${product}:${mac:hexhyp}
  94. #set gateway ${next-server}

  95. :start
  96.   menu iPXE Boot Menu
  97.   item --gap --             --------------------------------- WIN --------------------------------
  98.   item WINDOWS                 BOOT WINDOWS(ISCSI)
  99.   item --gap --             ---------------------------- Advanced options ------------------------
  100.   item --key p pe              WEPE                                                     
  101.   item Win8PEx64               Win8PEx64                                                   
  102.   item --key s shell           shell                                                         -- s
  103.   item --key r reboot          reboot computer                                               -- r
  104.   item --key x exit            Exit iPXE and continue BIOS boot                              -- x
  105.   item --gap --  
  106.   item --gap --             ------------------------------- systeminfo ---------------------------
  107.   item --gap --             DHCP Server: ${dhcp-server}
  108.   item --gap --             IP: ${ip}
  109.   item --gap --             MAC: ${mac}
  110.   item --gap --             netmask: ${netmask}
  111.   item --gap --             Gateway: ${gateway}
  112.   item --gap --             DNS: ${dns}
  113.   item --gap --             UUID: ${uuid}
  114.   item --gap --             initiator-iqn: ${initiator-iqn}
  115.   choose --timeout ${menu-timeout} --default ${menu-default} selected
  116.   goto ${selected}

  117. :reboot
  118.   reboot

  119. :exit
  120.   exit

  121. :shell
  122.   shell
  123. goto start


  124. :WINDOWS
  125.   chain /mac/${mac:hexhyp} || goto install

  126. :pe
  127.   initrd http://${dhcp-server}/ipxe/WEPE.iso
  128.   chain http://${dhcp-server}/ipxe/memdisk iso raw

  129. :Win8PEx64
  130.   initrd http://${dhcp-server}/ipxe/Win8PEx64.iso
  131.   chain http://${dhcp-server}/ipxe/memdisk iso raw
  132.   

  133. :menu
  134. goto start

  135. :install
  136.   echo -n ISCSI iqn: && read iqn
  137.   prompt --key y  Press 'y' to seting iqn username and password,any key Skip. || goto installmenu
  138.   echo -n username: && read username
  139.   echo -n password: && read password
  140.   goto installmenu

  141. :installmenu
  142.   set menu-timeout 10000
  143.   menu install Menu
  144.   item --gap --             --------------------------- INSTALL TO ISCSI --------------------------
  145.   item boot(iscsi)              BOOT form ISCSI
  146.   item install(iscsi)           Install windows to ISCSI
  147.   item install(PE)              Alternnate install mode(PE)
  148.   item menu                     back Menu
  149.   choose --timeout ${menu-timeout} selected
  150.   goto ${selected}

  151. :boot(iscsi)
  152.   sanboot iscsi:192.168.11.2::::${iqn}


  153. :install(iscsi)
  154.   sanhook iscsi:192.168.11.2::::${iqn}
  155.   exit


  156. :install(PE)
  157.   sanhook iscsi:192.168.11.2::::${iqn}
  158.   initrd http://${dhcp-server}/ipxe/Win8PEx64.iso
  159.   chain http://${dhcp-server}/ipxe/memdisk iso raw




  160. 下面是mac地址的配置文件
  161. #!ipxe

  162. # Variables are specified in boot.ipxe.cfg

  163. # Some menu defaults
  164. # set menu-timeout 0 if no client-specific settings found  下面3句是设置默认超时时间10秒 默认项目是exit
  165. isset ${menu-timeout} || set menu-timeout 10000
  166. set submenu-timeout ${menu-timeout}
  167. isset ${menu-default} || set menu-default exit

  168. # Figure out if client is 64-bit capable
  169. cpuid --ext 29 && set arch x64 || set arch x86
  170. cpuid --ext 29 && set archl amd64 || set archl i386

  171. ###################### MAIN MENU ####################################

  172. :start
  173. menu iPXE boot menu for ${initiator-iqn}
  174. item --gap --             ------------------------- Operating systems ------------------------------
  175. item wepe                 Boot from WEPE
  176. item testpe               Boot from testpe shibaile
  177. item WIN10LTSC            Boot fromWIN10LTSC
  178. item TESTWIN10            Boot from TESTWIN10
  179. item TESTWIN102            Boot from TESTWIN102
  180. item WIN10ISO            Boot from WIN10ISO
  181. item TEST2016            Boot from TEST2016
  182. item TESTESXI            Boot from TESTESXI
  183. item --gap --             ------------------------- Tools and utilities ----------------------------
  184. item --key d menu-diag    System tools...
  185. item --key i menu-install Installers...
  186. item --gap --             ------------------------- Advanced options -------------------------------
  187. item --key c config       Configure settings
  188. item shell                Drop to iPXE shell
  189. item reboot               Reboot computer
  190. item
  191. item --key x exit         Exit iPXE and continue BIOS boot
  192. choose --timeout ${menu-timeout} --default ${menu-default} selected || goto cancel
  193. set menu-timeout 0
  194. goto ${selected}

  195. :cancel
  196. echo You cancelled the menu, dropping you to a shell

  197. :shell
  198. echo Type 'exit' to get the back to the menu
  199. shell
  200. set menu-timeout 0
  201. set submenu-timeout 0
  202. goto start

  203. :failed
  204. echo Booting failed, dropping to shell
  205. goto shell

  206. :reboot
  207. reboot

  208. :exit
  209. exit

  210. :config
  211. config
  212. goto start

  213. :back
  214. set submenu-timeout 0
  215. clear submenu-default
  216. goto start

  217. ############ MAIN MENU ITEMS ############

  218. :myiscsi
  219. sanboot iscsi:192.168.11.2:::1:iqn.1991-05.com.microsoft:server1-target-e3v3-target
  220. goto start

  221. :installmyiscsi
  222. echo Starting windows10 installer for iqn.1991-05.com.microsoft:server1-target-e3v3-target
  223. set root-path iscsi:192.168.11.2:::1:iqn.1991-05.com.microsoft:server1-target-e3v3-target
  224. set base-url http://192.168.11.3/ipxe
  225. set keep-san 1
  226. sanhook ${root-path} || goto failed
  227. initrd ${base-url}/win10.iso
  228. chain memdisk iso raw || goto failed
  229. goto start

  230. :testpe
  231. echo Starting testpe
  232. sanhook iscsi:192.168.11.2:::0:iqn.1991-05.com.microsoft:server1-test-target
  233. echo ceshi
  234. set base-url http://192.168.11.2/WEPE
  235. initrd ${base-url}/WEPE.iso
  236. chain memdisk iso raw || goto failed
  237. goto start

  238. :wepe
  239. echo Starting wepe
  240. sanboot http://192.168.11.2/WEPE/WEPE.iso
  241. goto start

  242. :WIN10LTSC
  243. echo Starting WIN10LTSC
  244. sanboot http://192.168.11.2/WIN10LTSC/ltsc.iso
  245. goto start

  246. :TESTWIN10
  247. echo Starting TESTWIN10
  248. sanboot iscsi:192.168.11.2:::0:iqn.1991-05.com.microsoft:server1-test-target
  249. goto start

  250. :TESTWIN102
  251. echo Starting TESTWIN102
  252. sanboot http://192.168.11.2/WIN10LTSC/ltsc.iso \ iscsi:192.168.11.2:::0:iqn.1991-05.com.microsoft:server1-test-target
  253.                   
  254. goto start


  255. :WIN10ISO
  256. echo Starting WIN10ISO
  257. set base-url http://192.168.11.2/WIN10LTSC
  258. initrd ${base-url}/ltsc.iso
  259. chain memdisk iso raw || goto failed
  260. goto start

  261. :TEST2016
  262. echo TEST2016
  263. sanhook iscsi:192.168.11.2:::1:iqn.1991-05.com.microsoft:server1-test-target
  264. goto start

  265. :TESTESXI
  266. echo TESTESXI
  267. sanhook iscsi:192.168.11.2:::0:iqn.1991-05.com.microsoft:server1-test-target
  268. echo ceshi
  269. set base-url http://192.168.11.2/ESXI
  270. initrd ${base-url}/ESXI.iso
  271. chain memdisk iso raw || goto failed
  272. goto start



  273. :installfromwepe
  274. echo Starting install from wepe
  275. set root-path iscsi:192.168.11.2:::1:iqn.1991-05.com.microsoft:server1-target-e3v3-target
  276. set base-url http://192.168.11.3/ipxe
  277. set keep-san 1
  278. sanhook ${root-path} || goto failed
  279. initrd ${base-url}/WEPE.iso
  280. chain memdisk iso raw || goto failed
  281. goto start


  282. :windows
  283. echo Booting Windows from iSCSI for ${initiator-iqn}
  284. set netX/gateway ${iscsi-server}
  285. set root-path ${base-iscsi}:${hostname}.Windows
  286. set keep-san 1
  287. sanboot ${root-path} || goto failed
  288. goto start

  289. :ubuntu
  290. echo Booting Ubuntu from iSCSI for ${initiator-iqn}
  291. set root-path ${base-iscsi}:${hostname}.Ubuntu
  292. set keep-san 1
  293. sanboot ${root-path} || goto failed
  294. goto start

  295. :centos
  296. echo Booting CentOS from iSCSI for ${initiator-iqn}
  297. set root-path ${base-iscsi}:${hostname}.CentOS
  298. set keep-san 1
  299. sanboot ${root-path} || goto failed
  300. goto start

  301. :esxi
  302. echo Booting ESXi from iSCSI for iqn.2000-01.com.synology:ipxe.ESXI
  303. set root-path iscsi:10.10.10.250:::1:iqn.2000-01.com.synology:ipxe.ESXI
  304. set keep-san 1
  305. sanboot ${root-path} || goto failed
  306. goto start

  307. ###################### SYSTEM TOOL MENU #############################

  308. :menu-diag
  309. menu Diagnostic tools
  310. item memtest       Memtest86+
  311. item winpe         WinPE
  312. item
  313. item --key 0x08 back Back to top menu...
  314. iseq ${menu-default} menu-diag && isset ${submenu-default} && goto menu-diag-timed ||
  315. choose selected && goto ${selected} || goto start
  316. :menu-diag-timed
  317. choose --timeout ${submenu-timeout} --default ${submenu-default} selected && goto ${selected} || goto start

  318. :memtest
  319. set base-url http://${nas_ip}:88/tools
  320. initrd ${base-url}/memtest86_5.01.iso
  321. chain memdisk iso raw || goto failed
  322. goto start

  323. :winpe
  324. set base-url http://${nas_ip}:88/tools
  325. initrd ${base-url}/UQi_USBsys_10th.iso
  326. chain memdisk iso raw || goto failed
  327. goto start

  328. ############################ INSTALLER MENU #########################

  329. :menu-install
  330. menu Installers for ${initiator-iqn}
  331. item winpe-install        Hook Windows iSCSI and boot WinPE for intallation
  332. item ubuntu-install       Hook Ubuntu ${archl} iSCSI and install
  333. item centos-install       Hook CentOS ${archl} iSCSI and install
  334. item esxi-install         Hook ESXi ${archl} iSCSI and install
  335. item
  336. item --key 0x08 back      Back to top menu...
  337. iseq ${menu-default} menu-install && isset ${submenu-default} && goto menu-install-timed ||
  338. choose selected && goto ${selected} || goto start
  339. :menu-install-timed
  340. choose --timeout ${submenu-timeout} --default ${submenu-default} selected && goto ${selected} || goto start

  341. :winpe-install
  342. echo Booting Windows PE ${arch} installer for ${initiator-iqn}
  343. echo (for installing Windows)
  344. set netX/gateway ${iscsi-server}
  345. set root-path ${base-iscsi}:${hostname}.Windows
  346. set keep-san 1
  347. echo sanhook start...
  348. sanhook ${root-path} || goto failed
  349. echo set base url starting
  350. set base-url http://${nas_ip}:88/Install/WinPE
  351. kernel wimboot
  352. initrd ${base-url}/x64/Boot/BCD bcd
  353. initrd ${base-url}/x64/Boot/boot.sdi boot.sdi
  354. initrd ${base-url}/x64/sources/boot.wim boot.wim
  355. boot || goto failed
  356. goto start

  357. :ubuntu-install
  358. echo Starting Ubuntu 16.04 ${archl} installer for ${initiator-iqn}
  359. set root-path ${base-iscsi}:${hostname}.Ubuntu
  360. cpuid --ext 29 && set arch amd64 || set arch x86
  361. set base-url ${sanboot-url}Ubuntu16/${arch}
  362. kernel ${base-url}/netboot/linux
  363. initrd ${base-url}/netboot/initrd.gz
  364. imgargs linux auto=true fb=false url=${base-url}/./preseed.cfg DEBCONF_DEBUG=5 netcfg/get_hostname=${hostname}.Ubuntu partman-iscsi/login/address=${iscsi-server} partman-iscsi/login/targets=${base-iqn}:${hostname}.Ubuntu
  365. boot || goto failed
  366. goto start

  367. :centos-install
  368. echo Starting CentOS 7 ${archl} installer for ${initiator-iqn}
  369. set root-path ${base-iscsi}:${hostname}.CentOS
  370. set base-url ${sanboot-url}CentOS/x86_64
  371. set keep-san 1
  372. sanhook ${root-path} || goto failed
  373. kernel ${base-url}/images/pxeboot/vmlinuz initrd=initrd.img repo=${base-url}
  374. initrd ${base-url}/images/pxeboot/initrd.img
  375. boot || goto failed
  376. goto start

  377. :esxi-install
  378. echo Starting ESXi 6.7 installer for iqn.2000-01.com.synology:ipxe.ESXI
  379. set root-path iscsi:10.10.10.250:::1:iqn.2000-01.com.synology:ipxe.ESXI
  380. set base-url http://10.10.10.250:88/Install/ESXI
  381. set keep-san 1
  382. sanhook ${root-path} || goto failed
  383. initrd ${base-url}/123.iso
  384. chain memdisk iso raw || goto failed
  385. goto start



  386. 其他资料
  387. https://www.jianshu.com/p/7c8b44d03edc
  388. https://blog.csdn.net/weixin_34346099/article/details/89671375  这两个配合着看应该可以让dnsmasq支持dhcp的相关参数

  389. 菜单编写范例 但是还是不知道默认文件名
  390. http://bbs.wuyou.net/forum.php?mod=viewthread&tid=402755&ordertype=1



  391. 关于uefi引导
  392. 首先要有一个esp分区,然后在这个分区里面放对应的文件就行
  393. 怎么创建ESP分区呢
  394. https://jingyan.baidu.com/article/046a7b3e76a8d0f9c27fa9af.html

  395. ESP分区一般都是FAT32格式
  396. 然后WIN10默认的引导文件是efi\boot\Bootx64.efi
  397. 用bcdedit命令编辑这个文件
  398. https://www.cnblogs.com/fatt/p/4397615.html
  399. bcdedit /store F:\EFI\Microsoft\Boot\bootmgfw.efi E:\windows /l zh-cn
  400. 不知道为什么这里提示说不是注册表文件,但是我明明看见默认的文件就是这个啊

  401. bcdboot F:\windows /l zh-cn


  402. 测试sanhook iso
  403. 和内存超过iso大小

  404. 内存大于 initrd iso 失败
  405. 只用iso 也失败,提示没有驱动,估计是ISO没有加载完毕
  406. initrd BCD 等3个文件也失败,估计也是文件缺少


  407. 研究怎么把完整的iso下载下来
  408. https://github.com/zwj4031/ipxeboot


  409. 我怀疑是initrd下载下来的文件 memdisk装不下 应该不是,memdisk是自适应的 而且看速度也不会这么快,应该就是限制了大小,要看看sanboot iso的大小限制
  410. 下面可以学习自建一个
  411. https://baike.baidu.com/item/initrd/3239796?fr=aladdin
  412. RDSIZE=4000
  413. BLKSIZE=1024  字节
  414. # Create an emptyramdisk image
  415. dd if=/dev/zero of=ramdisk.img bs=1024 count=10

  416. B站的那个UP主的网站是
  417. https://www.vediotalk.com/?p=3858

  418. 另外一篇教程
  419. https://blog.csdn.net/beckdon/article/details/41015597

  420. B站另外一个WIN7的教程是先把WIN7装在本地硬盘,然后把硬盘对拷的服务器上
  421. 不知道他用带网卡的PE是做什么用的? 还是我没看仔细?
  422. 装玩系统以后一定要开启ISCSI服务,这样把硬盘对拷到服务器上的时候启动系统才会自动连接(是否需要?)


  423. 这个教程用dnsmasq分了bios和uefi
  424. https://www.haiyun.me/archives/1384.html

  425. 然后明天研究启动方式
  426. 传统的bios就是initrd iso然后chain memdisk raw iso
  427. uefi的就可以直接sanboot iso
复制代码


回复

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2021-1-1 21:21 | 显示全部楼层
  1.   sanhook --drive 0x81 ${root-path}
  2.   sanboot --no-describe iscsi:10.0.4.1:::1:iqn.2010-04.org.ipxe.dolphin:liveinstall
复制代码

如果是这样的话是否可以无盘直接装系统

然后我自己思考
我之前用ipxe sanboot win10的ISO,最后会卡,是因为WIN10默认的ISO文件里面没有网卡驱动,装系统的过程中iscsi链接断开了,就会卡住了
需要修改win10.iso这个文件,应该是修改的install.wim这个文件,修改添加网卡驱动,这样装系统的时候网络就是一直连接的

回复 支持 反对

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2021-1-1 21:22 | 显示全部楼层
这个是找的BIOS和UEFI启动区分开的

  1. #!ipxe
  2. #check platform (pcbios or efi)
  3. echo Platform: ${platform}
  4. set menu-timeout 20000
  5. dhcp
  6. isset ${next-server} || set next-server 192.168.11.2  #自行指定服务器ip
  7. iseq ${platform} pcbios && set start BIOS_MENU || set start EFI_MENU
  8. goto ${start}

  9. :BIOS_MENU
  10. set menu-default win10pe
  11. menu iPXE BIOS Boot Menu
  12. #item win2003                0.Yigeren Win2003PE
  13. item --key 1 win7pe        1.Yigeren Win7PE
  14. item --key 2 win8pe        2.Yigeren Win8PE
  15. item --key 3 win8x64        3.Yigeren Win8x64PE
  16. item --key 4 win10pe        4.Yigeren Win10x64PE
  17. item --key 5 maxdos        5.MAXDOS9.3PLUS
  18. item --key 6 diskgen        6.DISKGEN
  19. item --key 7 hddreg        7.HDDREG
  20. item --key h hddboot        H.HDDBOOT
  21. item --key r reboot        R.ReBoot Computer

  22. choose --timeout ${menu-timeout} --default ${menu-default} selected
  23. goto ${selected}

  24. :shell
  25. echo Type 'Exit' to get the back to the menu
  26. shell
  27. goto start

  28. :failed
  29. echo Booting failed, dropping to shell
  30. goto shell

  31. :reboot
  32. reboot

  33. :hddboot
  34. sanboot --no-describe --drive 0x80

  35. :maxdos
  36. initrd http://${next-server}/img/MAXDOS.IMG
  37. chain http://${next-server}/memdisk || goto failed

  38. :diskgen
  39. initrd http://${next-server}/img/DISKGEN.img
  40. chain http://${next-server}/memdisk || goto failed

  41. :hddreg
  42. initrd http://${next-server}/img/HDDREG.IMG
  43. chain http://${next-server}/memdisk || goto failed

  44. #:win2003
  45. #kernel http://${next-server}/STARTROM.0
  46. #boot || goto failed

  47. :win7pe
  48. kernel http://${next-server}/wimboot
  49. initrd http://${next-server}/boot/bootmgr.exe                bootmgr.exe
  50. initrd http://${next-server}/boot/BCD                                  BCD
  51. initrd http://${next-server}/boot/boot.sdi                        boot.sdi
  52. initrd http://${next-server}/boot/Win7PE.wim                Win7PE.wim
  53. boot || goto failed

  54. :win8pe
  55. kernel http://${next-server}/wimboot
  56. initrd http://${next-server}/boot/bootmg8.exe                bootmgr.exe
  57. initrd http://${next-server}/boot/BC8                                BC8
  58. initrd http://${next-server}/boot/boot.sdi                        boot.sdi
  59. initrd http://${next-server}/boot/Win8PE.wim                Win8PE.wim
  60. boot || goto failed

  61. :win8x64
  62. kernel http://${next-server}/wimboot
  63. initrd http://${next-server}/boot/boot864.exe                bootmgr.exe
  64. initrd http://${next-server}/boot/864                                864
  65. initrd http://${next-server}/boot/boot.sdi                        boot.sdi
  66. initrd http://${next-server}/boot/Win864PE.wim                Win864PE.wim
  67. boot || goto failed

  68. :win10pe
  69. kernel http://${next-server}/wimboot
  70. initrd http://${next-server}/boot/boot164.exe                bootmgr.exe
  71. initrd http://${next-server}/boot/164                                164
  72. initrd http://${next-server}/boot/boot.sdi                        boot.sdi
  73. initrd http://${next-server}/boot/Win10x64.wim                Win10x64.wim
  74. boot || goto failed
  75. goto start


  76. :EFI_MENU
  77. set menu-default win10efi
  78. menu iPXE EFI Boot Menu
  79. item win8efi                1.Yigeren Win8x64PE
  80. item win10efi                2.Yigeren Win10x64PE
  81. item reboot                3.ReBoot Computer

  82. choose --timeout ${menu-timeout} --default ${menu-default} selected
  83. goto ${selected}

  84. :win8efi
  85. kernel http://${next-server}/wimboot
  86. initrd http://${next-server}/boot/bootx64.efi                                        bootx64.efi
  87. initrd http://${next-server}/boot/boot864.exe                                bootmgr.exe
  88. initrd http://${next-server}/efi/microsoft/boot/864                                864
  89. initrd http://${next-server}/efi/microsoft/boot/fonts/chs_boot.ttf        chs_boot.ttf
  90. initrd http://${next-server}/efi/microsoft/boot/fonts/wgl4_boot.ttf        wgl4_boot.ttf
  91. initrd http://${next-server}/boot/boot.sdi                                        boot.sdi
  92. initrd http://${next-server}/boot/Win864PE.wim                                Win864PE.wim
  93. boot || goto failed

  94. :win10efi
  95. kernel http://${next-server}/wimboot
  96. initrd http://${next-server}/efi/boot/bootx64.efi                                bootx64.efi
  97. initrd http://${next-server}/boot/boot164.exe                                bootmgr.exe
  98. initrd http://${next-server}/efi/microsoft/boot/BCD                        BCD
  99. initrd http://${next-server}/efi/microsoft/boot/fonts/chs_boot.ttf        chs_boot.ttf
  100. initrd http://${next-server}/efi/microsoft/boot/fonts/wgl4_boot.ttf        wgl4_boot.ttf
  101. initrd http://${next-server}/boot/boot.sdi                                        boot.sdi
  102. initrd http://${next-server}/boot/Win10x64.wim                                Win10x64.wim
  103. boot || goto failed
  104. goto start
复制代码


回复 支持 反对

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2021-1-2 19:50 | 显示全部楼层
openwrt不要在网页配置那个TFTP也是直接修改/etc/dnsmasq.conf这个文件就行
改完了重启dnsmasq服务

centos7下dnsmasq的配置
  1. enable-tftp
  2. tftp-root=/etc/dnsmasq.d/tftp/ipxe
  3. dhcp-match=set:bios,option:client-arch,0
  4. dhcp-match=set:ipxe,175
  5. dhcp-boot=tag:!ipxe,tag:bios,undionly.kpxe
  6. dhcp-boot=tag:!ipxe,tag:!bios,ipxe.efi
  7. dhcp-boot=tag:ipxe,boot.ipxe
复制代码


这几行脚本的意思是如果电脑是bios启动的,就进入undionly.kpxe  如果是UEFI的就进入ipxe.efi
进入了ipxe以后就会查找boot.ipxe这个配置文件

boot.ipxe的写法可以参考1楼和2楼

用这个配置就可以不需要自己编译,直接使用ipxe.org网站下载下来的undionly.kpxe和ipxe.efi文件就行了



回复 支持 反对

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2021-1-2 19:54 | 显示全部楼层
关于引导方式

传统的bios就是initrd iso然后chain memdisk raw iso

uefi的就可以直接sanboot iso


实测uefi读取超快 看来还是uefi厉害点
回复 支持 反对

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2021-7-31 21:08 | 显示全部楼层
iscsi无盘启动 不知道为什么用虚拟机总是失败

我之前用物理机sata硬盘装好系统,然后把硬盘插到服务器上,在服务器上建立一个vhdx,然后用分区助手把硬盘复制到vhdx里面,然后把这个vhdx挂载为iscsi
最后电脑从网卡启动 可以正常进系统

但是同样的方法虚拟机就老是失败,总是转圈以后就连接断开了

我已经试过把IP设置为静态,DHCP里面分配的也是固定的,系统也开启了iscsi 但是都不行
猜测要么就是虚拟机网卡有问题 无法iscsi引导(微软故意的)
回复 支持 反对

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2022-9-27 03:38 | 显示全部楼层
回复 支持 反对

使用道具 举报

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

本版积分规则

荣耀之链

GMT+8, 2025-6-18 03:43 , Processed in 0.015441 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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