ipxe

 

来自:

https://ipxe.org/cmd

The following commands are supported by iPXE. Commands may be entered at the iPXE command line or used in a script.

Boot commands
autoboot Boot system from network interface
 
Network interface commands
ifstat Display interfaces
ifopen Open interfaces
ifclose Close interfaces
ifconf or
dhcp
Automatically configure interfaces
iflinkwait Wait for link-up
route Display routing table
nstat Display neighbour table
ipstat Display IP statistics
vcreate Create VLAN
vdestroy Destroy VLAN
 
Image management commands
imgstat Display images
chain or
imgexec or
boot
Download and boot an executable image
imgfetch or
module or
initrd
Download an image
kernel or
imgselect or
imgload
Download and select an executable image
imgfree Discard images
imgargs Set image command-line arguments
imgtrust Set image trust requirement
imgverify Verify an image as trusted
imgextract Extract a compressed or archive image
 
SAN commands
sanhook Attach SAN device
sanboot Boot from SAN device
sanunhook Detach SAN device
fcstat Display Fibre Channel ports
fcels Issue Fibre Channel ELS request
 
Configuration setting commands
config Start interactive configuration tool
show Display configuration setting
set Set configuration setting
clear Delete configuration setting
read Prompt user to enter configuration setting
inc Increment numeric value of configuration setting
login Prompt user to enter user name and password
 
Flow control commands
isset Test for existence
iseq Test for equality
goto Jump to script label
exit Exit current shell or script
 
Menu commands
menu Create menu
item Add menu item
choose Choose menu item
 
Certificate management commands
certstat Display certificates
certstore Manage certificates
certfree Discard certificates
 
Console management commands
console Configure console
colour Define colour
cpair Define colour pair
 
Form parameter commands
params Create form parameter list
param Add form parameter
 
Miscellaneous commands
echo Print text to console
prompt Prompt user to press key
shell Start new interactive shell
help Display list of available commands
sleep Delay for fixed period of time
reboot Reboot system
poweroff Power off system
cpuid Check x86 CPU feature
sync Wait for background operations to complete
nslookup Resolve host name to network address
ping Check network connectivity
ntp Get time and date via NTP
pciscan Scan for PCI devices
 
Obscure commands
lotest Perform loopback testing
pxebs Perform PXE boot server discovery
time Measure time taken to execute command
gdbstub Start remote debugging
profstat Display profiling statistics
 

 

 

==============================================

来自:https://ipxe.org/download

 

Source code

The iPXE source code is maintained in a git repository at https://github.com/ipxe/ipxe. You can check out a copy of the code using:

  git clone https://github.com/ipxe/ipxe.git

and build it using:

  cd ipxe/src
  make

You will need to have at least the following packages installed in order to build iPXE:

  • gcc
  • binutils
  • make
  • perl
  • liblzma or xz header files
  • mtools
  • mkisofs or genisoimage or xorrisofs (needed only for building .iso images)
  • syslinux (for isolinux, needed only for building .iso images)

 

You can build an iPXE bootable CD-ROM image using:

  make bin/ipxe.iso

and then burn bin/ipxe.iso onto a blank CD-ROM or DVD-ROM.

You can build an iPXE bootable USB key image using:

  make bin/ipxe.usb

and then transfer this image onto a blank USB key using

  dd if=bin/ipxe.usb of=/dev/sdX

where /dev/sdX is the device representing your USB key. Please note that this will erase any existing contents of the USB key.

 

 

 

==========================================================================

ipxe 设置ip gateway 

You can also access these settings from the command line or from within an iPXE script. For example, you can display the current IP address as obtained via DHCP:

  iPXE> show net0/ip
  net0.dhcp/ip:ipv4 = 10.0.0.103

or configure a static IP address:

  iPXE> set net0/ip 192.168.0.3
  iPXE> set net0/netmask 255.255.255.0
  iPXE> set net0/gateway 192.168.0.1
  iPXE> route
  net0: 192.168.0.3/255.255.255.0 gw 192.168.0.1

or download and boot an operating system based upon the system UUID:

  #!ipxe
  
  chain http://192.168.0.1/boot.php?uuid=${uuid}

Scopes

Configuration settings are arranged in a logical hierarchy of settings scopes:

Settings hierarchy

The easiest way to explore the hierarchy is to use the interactive configuration tool. You can also use the setshow, and clear commands to explore the effects of changing settings at various levels of the hierarchy.

For example, suppose that you have obtained a boot filename via DHCP:

  iPXE> dhcp net0
  DHCP (net0 52:54:00:12:34:56).... ok
  iPXE> show filename
  net0.dhcp/filename:string = http://192.168.0.1/boot.php

 

Applicability

Some settings take effect only within a particular scope. In particular, settings specific to a network device take effect only within the scope of that network device. For example, to set the IP address for net0 you must set a value for net0/ip rather than just ip:

  iPXE> set net0/ip 192.168.0.100
  iPXE> route
  net0: 192.168.0.100/255.255.255.0

 

 ===============================================================================================

https://blog.open4j.com/2019/05/29/net-boot-ipxe-esxi-centos-windows-etc-from-iscsi-lun/

用ipxe网络启动打造无盘ESXi系统

一、源码与链接

几个相关链接

  1. 同胞网友写的教程共 3 篇,基本上我都是按他的教程来的
    https://t17.techbang.com/topics/50737-build-a-remote-boot-system-using-synology-nas-ipxe-part-i-compact-remote-boot-system-management-tool
    https://t17.techbang.com/topics/50767-build-a-remote-boot-system-using-synology-nas-ipxe-part-ii-install-and-start-ubuntu-linux-on-an-iscsi-disk
    https://t17.techbang.com/topics/50776-establish-a-remote-boot-system-using-synology-nas-ipxe-part-iii-install-and-start-ms-windows-on-an-iscsi-disk
  2. 外国友人博客
    https://www.reversengineered.com/2016/01/07/booting-linux-isos-with-memdisk-and-ipxe/
    https://www.reversengineered.com/2015/11/25/netboot-xyz/
    https://www.reversengineered.com/2015/02/11/booting-vmware-esxi-in-ipxe/
  3. ipxe
    ipxe 论坛关于 ESXi 的
    http://forum.ipxe.org/showthread.php?tid=1123&highlight=esxi
    ipxe 官网
    http://ipxe.org

相关源码

  1. ipxe 源码
    https://github.com/ipxe/ipxe
  2. netboot.xyz 源码,供学习
    https://github.com/antonym/netboot.xyz
  3. 我自己编译配置好的 kpxe 及一些启动菜单配置
    https://github.com/fronttang/netboot-tftp

二、编译一个带 iSCSI 和 COMBOOT 功能的 iPXE 固件

这个参考 ipxe 官网或 iPXE 编译增加功能与自定义脚本 进行编译,在我的源码 netboot-tftp 中有编译好可用的 kpxe 文件

三、群晖 NAS 里配置 DCHP、TFTP 和 WEB 服务器

先按同胞网友写的教程 Part 1 配置好群晖的 iSCSI、DCHP、TFTP 和 WEB 服务器

 

五、修改 tftp 根目录中的文件

 initiator-iqn 设置:

 

 initiator-iqn

initrd:

 

 

 

有时候会遇到一些奇葩问题不知道如何解决,这时候可以开启 debug 模式,这里以开启 iSCSI 的 debug 为例

在编译的时候增加 DEBUG=iscsi 参数

1
make bin/undionly.kpxe EMBED=script.ipxe DEBUG=iscsi

编译后用新固件引导启动,在 sanhook iscsi 命令的时候就会出现 debug 日志信息

 

 

 ===============================================================================================

https://blog.open4j.com/2019/05/30/ipxe-build-embedded-script/

 

一、源码与链接

几个相关链接

  1. 同胞网友写的教程共 3 篇,基本上我都是按他的教程来的
    https://t17.techbang.com/topics/50737-build-a-remote-boot-system-using-synology-nas-ipxe-part-i-compact-remote-boot-system-management-tool
    https://t17.techbang.com/topics/50767-build-a-remote-boot-system-using-synology-nas-ipxe-part-ii-install-and-start-ubuntu-linux-on-an-iscsi-disk
    https://t17.techbang.com/topics/50776-establish-a-remote-boot-system-using-synology-nas-ipxe-part-iii-install-and-start-ms-windows-on-an-iscsi-disk
  2. 外国友人博客
    https://www.reversengineered.com/2016/01/07/booting-linux-isos-with-memdisk-and-ipxe/
    https://www.reversengineered.com/2015/11/25/netboot-xyz/
    https://www.reversengineered.com/2015/02/11/booting-vmware-esxi-in-ipxe/
  3. ipxe
    ipxe 论坛关于 ESXi 的
    http://forum.ipxe.org/showthread.php?tid=1123&highlight=esxi
    ipxe 官网
    http://ipxe.org

相关源码

 

iPXE编译增加功能与自定义脚本

make 编译

1
2
cd ipxe/src
make bin/undionly.kpxe

编译前先安装这些依赖环境

  

三、开启其他功能

编译好以后默认开启的功能有
DNS、HTTP、iSCSI、TFTP、AoE、ELF、MBOOT、PXE、bzImage、Menu、PXEXT
在上图的启动界面可以看到。

 如果要加载 HTTPS web 的内容,那就要开启 HTTPS
还有一些系统启动需要开启 COMBOOT 功能
下面以开启 HTTPS 和 COMBOOT 功能为例进行编译
 修改源码下 src/config/general.h 文件

1
vi config/general.h

找到 DOWNLOAD_PROTO_HTTPS,将 DOWNLOAD_PROTO_HTTPS 前面有#undef 改成 #define
找到 IMAGE_COMBOOT 将前面的注释去掉

1
2
#define DOWNLOAD_PROTO_HTTPS    /* Secure Hypertext Transfer Protocol */
#define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */

或者将上面的代码添加到源码目录 src/config/local/general.h 文件里

修改完用前面的 make bin/undionly.kpxe 重新编译即可

现在用新生成的 undionly.kpxe 固件网络启动后就多了 HTTPS 和 COMBOOT

 

五、开启 debug 模式

有时候会遇到一些奇葩问题不知道如何解决,这时候可以开启 debug 模式,这里以开启 iSCSI 的 debug 为例

在编译的时候增加 DEBUG=iscsi 参数

1
make bin/undionly.kpxe EMBED=script.ipxe DEBUG=iscsi

编译后用新固件引导启动,在 sanhook iscsi 命令的时候就会出现 debug 日志信息
image 11

===============================================================================================

  ===============================================================================================

 

 

参考:

https://ipxe.org/cmd

https://ipxe.org/settings

https://blog.open4j.com/2019/05/30/ipxe-build-embedded-script/

https://blog.open4j.com/2019/05/29/net-boot-ipxe-esxi-centos-windows-etc-from-iscsi-lun/

posted @ 2022-11-18 15:26  redrobot  阅读(620)  评论(0编辑  收藏  举报