当前位置: 首页 > news >正文

如何使用ubuntu搭建一个无盘PC启动服务器

启动windows,

1. 安装tftp服务器

sudo apt install tftpd-hpa

2. 设置tftp,sudo systemctl restart tftpd-hpa

sudo nano /etc/default/tftpd-hpa # /etc/default/tftpd-hpa TFTP_USERNAME="tftp" TFTP_DIRECTORY="/srv/tftp" TFTP_ADDRESS=":69" TFTP_OPTIONS="--secure --create"

3. 安装dhcp服务器

sudo apt install isc-dhcp-server

4. 设置dhcp服务器的工作网卡

sudo nano /etc/default/isc-dhcp-server # Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server) # Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). #DHCPDv4_CONF=/etc/dhcp/dhcpd.conf #DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf # Path to dhcpd's PID file (default: /var/run/dhcpd.pid). #DHCPDv4_PID=/var/run/dhcpd.pid #DHCPDv6_PID=/var/run/dhcpd6.pid # Additional options to start dhcpd with. # Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead #OPTIONS="" # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACESv4="ens34" INTERFACESv6=""

5. 设置dhcp的工作网段,sudo systemctl restart isc-dhcp-server

sudo vi /etc/dhcp/dhcpd.conf # Global parameter options for the PXE network environment default-lease-time 600; max-lease-time 7200; authoritative; # Log DHCP actions to the system log (/var/log/syslog) log-facility local7; # Subnet profile bound strictly to the 10.10.1.0/24 infrastructure subnet 10.10.1.0 netmask 255.255.255.0 { range 10.10.1.10 10.10.1.50; # IP pool reserved for PXE clients option subnet-mask 255.255.255.0; option broadcast-address 10.10.1.255; # Point clients directly to your Ubuntu TFTP service configuration next-server 10.10.1.100; # Server IP hosting your TFTP files filename "undionly.kpxe"; # Network boot loader payload filename }

6. 安装iscitargetcli-fb

sudo apt update sudo apt install -y targetcli-fb

7. 创建一个磁盘文件

sudo mkdir -p /var/iscsi_disks

8. 配置iscsi

# 1. Register the image file into the LIO backend allocator /backstores/fileio create name=disk01 file_or_dev=/var/iscsi_disks/disk01.img size=6G # 2. Create your Unique iSCSI Target Name (IQN) /iscsi create iqn.2026-05.ubuntu.storage:target01 # 3. Create a Logical Unit Number (LUN) mapping the storage block to your IQN cd /iscsi/iqn.2026-05.ubuntu.storage:target01/tpg1/luns create /backstores/fileio/disk01 # 4. Define which client is allowed to connect (ACL) # For testing, map it to the standard iPXE initiator name cd ../acls create iqn.2010-04.org.ipxe:initiator cd /iscsi/iqn.2026-05.ubuntu.storage:target01/tpg1 # Permit any initiator to connect without an explicit ACL entry set attribute generate_node_acls=1 # Allow write operations for these dynamically created client nodes set attribute cache_dynamic_acls=1 # Turn off explicit CHAP (username/password) validation mechanisms set attribute authentication=0 set attribute demo_mode_write_protect=0 cd / saveconfig exit

9. 打开防火墙,启动服务

sudo ufw allow to any port 3260 proto tcp sudo systemctl enable target sudo systemctl restart target sudo systemctl status target

10. 编写ipxe脚本,boot.ipxe

#!ipxe dhcp sanboot iscsi:10.10.1.100::::iqn.2026-05.ubuntu.storage:target01

11. 下载的编译ipxe

git clone https://github.com/ipxe/ipxe.git cd ipxe/src sudo apt install gcc sudo apt install make sudo apt install liblzma-dev make bin-x86_64-pcbios/undionly.kpxe EMBED=boot.ipxe cp bin-x86_64-pcbios/undionly.kpxe /srv/tftp

11. 在同一个网段启动目标pc, 先使用sanhook和winpe进入系统,分区

DISKPART> list disk DISKPART> select disk [Your iSCSI Disk Number] DISKPART> clean DISKPART> convert mbr DISKPART> create partition primary DISKPART> select partition 1 DISKPART> active DISKPART> format quick fs=ntfs label="WinPE_BIOS" DISKPART> assign letter=C DISKPART> exit

12. 安装系统到 C:

dism /Apply-Image /ImageFile:Z:\path\to\boot.wim /Index:1 /ApplyDir:C:\

13. 安装bootloader

bcdboot C:\Windows /s C: /f BIOS

14. 修改注册表msiscsi的设置

reg load HKLM\TARGET_SYSTEM C:\Windows\System32\config\SYSTEM reg add HKLM\TARGET_SYSTEM\ControlSet001\Services\Ndis /v Start /t REG_DWORD /d 0 /f reg add HKLM\TARGET_SYSTEM\ControlSet001\Services\msiscsi /v Start /t REG_DWORD /d 0 /f reg add HKLM\TARGET_SYSTEM\Setup /v "SystemSetupInProgress" /t REG_DWORD /d 1 /f reg unload HKLM\TARGET_SYSTEM

15. 禁用早段网络

reg load HKLM\TARGET_SYSTEM C:\Windows\System32\config\SYSTEM :: Add the override parameter to skip standard initialization reg add HKLM\TARGET_SYSTEM\Setup /v "DisableWpeinitNetwork" /t REG_DWORD /d 1 /f :: Disable the NDIS lightweight filter driver execution path reg add HKLM\TARGET_SYSTEM\ControlSet001\Services\NdisWdf /v Start /t REG_DWORD /d 4 /f reg unload HKLM\TARGET_SYSTEM

16. 修改使用ipxe.pxe作为bootfile

make bin-x86_64-pcbios/ipxe.pxe EMBED=boot.ipxe cp bin-x86_64-pcbios/ipxe.pxe /srv/tftp #make bin-x86_64-pcbios/undionly.kpxe EMBED=boot.ipxe #cp bin-x86_64-pcbios/undionly.kpxe /srv/tftp

17. 修改boot.ipex

#!ipxe dhcp set keep-san 1 set net0.dhcp/gateway 0.0.0.0 sanboot --keep iscsi:10.10.1.100::::iqn.2026-05.ubuntu.storage:target01
http://www.jsqmd.com/news/830408/

相关文章:

  • 【Appium 系列】第11节-Toast+弹窗处理 — 移动端最让人头疼的几种弹窗
  • 主流原型设计工具介绍
  • AI开发者如何快速接入多模型服务,五分钟搞定Python调用示例
  • macOS外接显示器控制终极指南:轻松掌控亮度与音量的完整方案
  • 别再只会用DC-DC了!手把手教你用SPX3819这类LDO芯片,搞定5V转3.3V的电路设计(附外围电路图)
  • 2026最权威的六大AI辅助论文神器推荐榜单
  • 深度解析:如何通过MonitorControl实现macOS外接显示器硬件级控制
  • 冰狐冷冻油替换开利/汉钟/约克/比泽尔/麦克维尔/复盛/顿汉布什/特灵/莱富康/克莱门特/神钢/丹佛斯/日立/冰轮/冰山制冷压缩机冷冻油平替型号全表 - 新闻快传
  • C++、汇编与易语言:三大编程语言深度对比
  • 【Appium 系列】第12节-智能路由 — API测试 vs UI 测试的自动选择
  • 模型逆向攻击(MIA)实战剖析:从原理到攻防演进
  • 忘记压缩包密码怎么办?3步找回加密文件的完整免费解决方案
  • KUKA机器人FSoE安全地址丢了别慌!手把手教你用WorkVisual手动找回(附KRC4标准柜地址表)
  • 如何选择适合你的双向拉绳开关?2026最新评测与选购指南 - 新闻快传
  • 从LED点阵到动态动画:基于ESP32的万圣节创意显示项目实战
  • wxhelper终极实战:深度揭秘微信逆向工程完整解决方案
  • 微信小程序wx.navigateTo传参实战:从基础到动态数据绑定
  • QLC SSD可靠性提升:LDPC软判决与智能固件如何实现低开销加固
  • Arm Neoverse CMN-650一致性网格网络架构与配置解析
  • Halbot框架解析:从零构建可扩展聊天机器人的实践指南
  • Doramagic工具箱:模块化脚本集的设计哲学与工程实践
  • 使用Nodejs开发后端服务如何集成Taotoken调用多模型API
  • 导师不会告诉你的6款AI论文工具:巨鲸写作可一键引真实文献 - 麟书学长
  • AI智能体安全防护框架AgentGuard:构建纵深防御策略链
  • YOLOv5/v7改进系列——融合EfficientNetV2主干网络的轻量化部署实践
  • 从公式到实践:深入解析CosineAnnealingLR的调参艺术
  • 2026届毕业生推荐的五大AI辅助论文方案解析与推荐
  • MAA明日方舟小助手:让游戏回归乐趣的智能伙伴
  • 开源AI助手插件:为HuluNote笔记软件集成智能文本处理与知识管理
  • 初创团队如何利用Taotoken以最小成本启动AI产品开发