惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
D
Docker
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
J
Java Code Geeks
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Simon Willison's Weblog
Simon Willison's Weblog
S
Security Affairs
NISL@THU
NISL@THU
T
Tor Project blog
A
About on SuperTechFans
宝玉的分享
宝玉的分享
腾讯CDC
S
Schneier on Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy & Cybersecurity Law Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
P
Privacy International News Feed
雷峰网
雷峰网
C
Cyber Attacks, Cyber Crime and Cyber Security
Vercel News
Vercel News
Cisco Talos Blog
Cisco Talos Blog
D
DataBreaches.Net
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
L
LINUX DO - 热门话题
Microsoft Security Blog
Microsoft Security Blog
Latest news
Latest news
C
Check Point Blog
有赞技术团队
有赞技术团队
T
The Exploit Database - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
云风的 BLOG
云风的 BLOG
SecWiki News
SecWiki News
Application and Cybersecurity Blog
Application and Cybersecurity Blog
爱范儿
爱范儿
月光博客
月光博客
V
Vulnerabilities – Threatpost
T
Threat Research - Cisco Blogs
P
Palo Alto Networks Blog
T
The Blog of Author Tim Ferriss
C
Cisco Blogs
Webroot Blog
Webroot Blog
S
Security @ Cisco Blogs

繁星点点

最新轻量级龙虾部署教程 giffgaff卡保号教程 Llinux系统中全新透明代理方案(可代理所有出站流量) tailscale开启子网路由常见的坑 OpenWrt固件编译 解决UFW和Docker的问题 使用PGP的非对称算法加密文件 NSSM工具把任意exe程序注册为Windows后台服务 轻量级简约端口转发rinetd 安卓IDE的安装和使用 IP信息查询网站汇总 热点共享代理教程 SSH使用密钥认证登录详细解释 Debian系统公网IP出口切换指南,适用多IP服务器 Windows系统安装Scoop包管理器 安卓Flutter开发学习笔记 使用手机搭建节点服务端 关于github提交记录泄露真实邮箱的处理办法 anytls协议部署教程 caddy给域名用上ECH加密 通过gitlab流水线自动备份仓库 通过CF-Workers代理访问网站 低配机器使用alpine系统跑docker 端口敲门教程 3x-ui面板通过api管理示例 nmap端口扫描 数据库常用命令 snap和winget包管理器 Git推送GitHub常用命令 😩😩😩学不完,根本学不完😩😩😩 使用CDN后获取访客真实IP 一些用于网络测试的下载测速文件 纯v6网络访问v4站点最简单的方法 服务器配置SSH密钥登录 windows重装系统教程 Docker部署哪吒监控 Github-Actions默认用户变量GITHUB_TOKEN的提权语法 给站点套CFT的一些坑 解决CF反代Docker失效的问题 使用py3快速启动一个文件上传和下载的接口 ios系统最新免拔卡使用tiktok方法 clash手搓配置最全协议示例详解 为IP地址申请免费证书并开启HTTPS 实用网站收藏 纯CSS实现剧透效果 在CloudflareWAF中屏蔽国内浏览器 网络安全之百度URL欺骗漏洞分析和复现 超级强大的ansible批量管理主机运维工具使用教程 收集整理的最新的常用VPS脚本工具 无法注册TG账号和国内号码接收不到验证码详细解决方案 国内环境安装xui面板 免费接码网站合集 完整的网络状态码列表 关于xui面板报错无法监听127.0.0.1:62789的问题 Xboard面板常见问题 项目编译构建文档 ios最新美区ID注册方法 V2board前后端分离 Markdown语法教程 Github加速 Docker镜像加速和离线安装 Liunx配置wrap 代理工具和SSH工具推荐 常用代码记录
通过netboot.xyz重装系统
2026-04-25 · via 繁星点点

Linux系统网络重装系统

查看系统信息并备份

出意外时可用于手动配置

# 查看系统盘
df -h /

# 查看默认网关
ip r

# 查看默认网络接口
ip a

下载 netboot.xyz 启动镜像(iPXE引导器)

wget https://boot.netboot.xyz/ipxe/netboot.xyz.img

将镜像DD写入系统盘(记得替换你实际的系统盘,会覆盖原系统,请确保重要数据已备份)

dd if=netboot.xyz.img of=/dev/vda bs=4M

强制将缓存写入磁盘,确保数据落盘完成

sync

重启服务器

reboot

进入启动菜单,选择网络安装

云服务器厂商可以在管理后台通过VNC界面操作

Linux Network Installs (64-bit)

如果重装成功,结束后会自动进入新系统,需要注意的是新系统一般没有开启root用户的ssh权限,需要用普通用户ssh连接,然后切换为root用户后再修改。Alpine系统默认是安装在内存中的,进入系统后需要执行setup-alpine命令安装到硬盘。

如果安装失败的话可能是硬盘分区有问题或者其他设置不对,可以返回到netboot.xyz 启动菜单,重新选择网络安装再装一遍即可。

国内镜像站

netboot.xyz项目下载系统镜像是在各大镜像官网下载的,国内服务器下载会很慢,可以加载自己的ipxe脚本,然后脚本里使用国内镜像源。

可以在第6步中,选择IPXE shell加载自己的脚本,命令示例:

chain https://example.com/embed.ipxe

Windows系统重装为Linux

下载 netboot.xyz 启动镜像

C盘里创建一个boot目录

下载https://boot.netboot.xyz/ipxe/netboot.xyz.img放到boot目录

以管理员权限执行命令添加启动项

bcdedit /copy {current} /d "Linux Install"

执行完成后会显示一个GUID,类似于{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

确认GUID后,逐条复制粘贴执行,记得替换GUID:

bcdedit /set {你的GUID} path \boot\netboot.xyz.img

bcdedit /set {你的GUID} loadoptions "initrd=\boot\netboot.xyz.img"

bcdedit /set {你的GUID} inirootpath \boot\netboot.xyz.img

bcdedit /timeout 60

验证配置

bcdedit /enum {你的GUID}

确认输出中至少包含:

path                    \boot\netboot.xyz.img
description              Linux Install

手搓PXE服务

安装dnsmasq

apt update
apt install -y dnsmasq

创建和编辑 /etc/dnsmasq.d/pxe.conf 配置ProxyDHCP和TFTP服务,要和PXE客户端(要装系统的设备)在同一局域网。

此配置使用ProxyDHCP模式,不会跟其他DHCP服务冲突,只会响应和下发PXE请求

# ProxyDHCP + TFTP
# 关闭 DNS
port=0

# 日志
log-dhcp
log-facility=/var/log/dnsmasq.log

# 改1:你的网段
dhcp-range=192.168.1.0,proxy

# 改2:本机 IP
dhcp-option=option:tftp-server,192.168.1.10

# ==================== TFTP (放IPXE固件)====================
enable-tftp
tftp-root=/etc/tftp

# ==================== PXE 引导 ====================
pxe-service=x86PC,       "PXE BIOS",             netboot.xyz-undionly.kpxe
pxe-service=X86-64_EFI,  "PXE UEFI x64",         netboot.xyz-snponly.efi
pxe-service=ARM64_EFI,   "PXE UEFI ARM64",       netboot.xyz-arm64-snponly.efi

管理命令

# 启动服务
sudo systemctl start dnsmasq

# 设置开机自启
sudo systemctl enable dnsmasq

# 查看运行状态
sudo systemctl status dnsmasq

# 查看实时日志
sudo tail -f /var/log/dnsmasq.log

# 重启服务
sudo systemctl restart dnsmasq

netboot.xyz的IPXE固件下载地址

架构 文件名 下载地址 说明
Legacy (PCBIOS) netboot.xyz-undionly.kpxe https://boot.netboot.xyz/ipxe/netboot.xyz-undionly.kpxe 传统 BIOS DHCP 引导文件,通用网卡驱动
UEFI x86_64 netboot.xyz-snponly.efi https://boot.netboot.xyz/ipxe/netboot.xyz-snponly.efi UEFI 引导文件
UEFI ARM64 netboot.xyz-arm64-snponly.efi https://boot.netboot.xyz/ipxe/netboot.xyz-arm64-snponly.efi ARM64 UEFI 引导文件

netboot.xyz本地钩子

netboot.xyz官方固件启动后会自动调用local-vars.ipxe脚本,如果存在的话。

判断脚本是否存在:
他会自动扫描你tftp目录里的local-vars.ipxe脚本,你需要提前创建并放到tftp目录。如果没有的话他会走自己菜单的逻辑。并且是根据DHCP响应里的server信息找到你的tftp的IP地址。

编译自己的IPXE固件

当然你也可以从 IPXE官方项目地址 自行编译,这样你就可以将自己的ipxe启动脚本内置进去。

ipxe脚本示例

ipxe脚本是核心步骤,从这里定义去哪里下载镜像,其他资源,和如何启动。

可根据自己情况修改,本地镜像文件则需要你启动一个HTTP服务,然后将镜像文件放进去,供客户端下载,适合离线环境。

#!ipxe
# ==================== iPXE 网络安装菜单 ====================
# 包含 Debian 12 安装 + Windows PE 安装

# 镜像文件托管地址(本地和高校镜像站二选一)
set server_ip http://192.168.1.10
set debian_mirror http://mirrors.cernet.edu.cn

# ==================== 菜单界面 ====================
:start
menu iPXE Network Install Menu
item debian    Debian 12 Automated Install
item winpe     Windows PE Install (Load boot.wim)
item shell     Enter iPXE Shell
item reboot    Reboot
choose --default debian --timeout 10000 option

goto ${option}

# ==================== Debian 12 安装 ====================
:debian
echo Starting Debian 12 automated installation...

kernel ${debian_mirror}/debian/dists/bookworm/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux
initrd ${debian_mirror}/debian/dists/bookworm/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz

imgargs linux initrd=initrd.gz auto=true priority=critical
boot

goto start

# ==================== Windows PE 安装 ====================
:winpe
echo Loading Windows PE...
kernel ${server_ip}/winpe/wimboot
initrd ${server_ip}/winpe/sources/boot.wim boot.wim

boot

goto start

# ==================== 进入 iPXE 命令行 ====================
:shell
echo Entering iPXE Shell...
shell

goto start

# ==================== 重启 ====================
:reboot
echo Rebooting...
reboot

然后在IPXE环境里下载并运行脚本

dhcp

chain http://example.com/embed.ipxe

建议使用HTTP协议,因为某些旧版本没有内置HTTPS模块,并且固件里的根证书也不齐全。

PXE 客户端启动链路

开机
  │
  ▼
DHCP (路由器)
  │ 分配 IP/网关/DNS
  ▼
ProxyDHCP (dnsmasq)
  │ 附加 TFTP 地址 + 引导文件名
  ▼
TFTP (dnsmasq)
  │ 下载 iPXE 固件
  ▼
iPXE 环境启动
  │
  ▼
HTTP 加载 menu.ipxe 脚本(需要手动加载,除非自己编译固件内置进去)
  │
  ▼
menu.ipxe 菜单(定义安装选项和逻辑)

客户端机器装Windows

对于安装Windows系统,可以使用 https://github.com/ipxe/wimboot 来直接加载 Windows 安装程序。

微软官方的Windows ISO镜像文件中,解压后sources目录下有一个核心文件boot.wim。这个boot.wim本质上就是一个微型的 Windows PE环境,可以用来启动并运行Windows安装程序。

编译自己的IPXE固件

  • 安装依赖
sudo apt update
sudo apt install -y build-essential liblzma-dev mtools mkisofs syslinux gcc-aarch64-linux-gnu wget tar git
  • 下载源码
git clone https://github.com/ipxe/ipxe.git
  • 进入src目录

  • 编辑config/general.h文件(可选)
    这个文件定义了固件的功能,常用的功能默认已经启用了,有些高级功能被注释了,如果需要启用就取消注释,一般默认的就够用了。

  • 创建内置脚本embed.ipxe放到当前目录

  • 编译命令

三种BIOS架构

# Legacy BIOS
make bin/undionly.kpxe EMBED=embed.ipxe

# UEFI x86_64
make bin-x86_64-efi/ipxe.efi EMBED=embed.ipxe

# UEFI ARM64
make CROSS_COMPILE=aarch64-linux-gnu- bin-arm64-efi/ipxe.efi EMBED=embed.ipxe

编译后的产物在bin目录