Self Host netboot.xyz - Part.2
- Self Host netboot.xyz Part.1
这次记录在 QEMU 中使用 netboot.xyz 遇到的问题。
使用自构建的 netboot.xyz
qemu-system-x86_64.exe -nic tftp=/netboot.xyz/buildout,bootfile=/ipxe/netboot.xyz.kpxe,ipv6=off -m 4g- 默认是 BIOS 环境,所以用
.kpxe; - bootfile 一定要有开头的斜杠,否则会因为 不匹配 tftp-root-path 而走不进 tftpmenu 函数,去下载官方的 netboot 重新运行
- 默认只有 128MB 内存,太小不够用,所以得用
-m分配个大点的 - 设置
ipv6为了解决下面的问题
访问 HTTPS 站点提示 Permission denied
启动 Live CD 操作系统需要从网络下载镜像,在当下这个处处都是 HTTPS 的年代,netboot 却无法访问 HTTPS 地址,提示 Permission denied,开启 Debug 后的日志是这样:
TLS 0xf9ae4 created session wget.la
https://wget.la/github.com/netbootxyz/debian-core-12/releases/download/12.11.0-7dc3f9f3/vmlinuz...
TLS 0xf9ae4 using protocol version 3.3
TLS 0xf9ae4 selected ecdhe-rsa-aes_gcm-128-sha256TLS 0xf9ae4 found certificate wget.la
TLS 0xf9ae4 found certif icate R12
TLS 0xf9ae4 certificate validation failed: Permission denied (https://ipxe.org/0216eb3c)
Permission denied (https://ipxe.0rg/0216eb3c)
Could not boot: Permission denied (https://ipxe.org/0216eb3c)
Could not boot: No such file or directory (https://ipxe.org/2d02803b)
Error occurred, press any key to return to menu ...并不是目标不在线或者防火墙什么的原因。这个错误其实在启动的早期就已出现,只不过屏幕内容滚动太快被刷掉了,从录屏(或者移动 QEMU 窗口来暂停滚屏)能看到:
Attempting to retrieve latest upstream version number...
TLS 0xfe344 created session boot.netboot.xyz
https://boot.netboot.xyz/version.ipxe... Network unreachable (https://ipxe.org/80a6011)错误信息挺有误导性,并不和网上关于证书过期、信任链的讨论有关。
为什么无法访问呢,在 iPXE Shell 中用 nslookup 和 ping 对比发现,因为 DNS 解析到 IPv6 地址,而虚拟机用的 -net user 没有 IPv6 地址。启动命令加上 -net ipv6=off 就好了。