300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > PXE 网络安装 windows 或 linux

PXE 网络安装 windows 或 linux

时间:2021-08-31 12:05:45

相关推荐

PXE 网络安装 windows 或 linux

目标

管理一个局域网,网络内的电脑配置不一,安装系统是个很烦人的活儿。以前一直用 Windows Server 的部署服务 WDS 来给客户机安装系统,也尝试在 WDS 中添加 pxe Ubuntu Live CD 的引导。但是 Windows Server 启动太慢了,占用资源也多,近期把 Windows Server 换成了 Ubuntu。

ISC-DHCP-SERVER

# dhcpd.conf## Sample configuration file for ISC dhcpd#allow booting;allow bootp;option domain-name "linux";option domain-name-servers 111.11.11.1;option option-128 code 128=string;option option-128 code 129=text;option rfc3442-classless-static-routes code 121 = array of integer 8;option ms-classless-static-routes code 249 = array of integer 8;option space pxelinux;option pxelinux.magic code 208 = string;option pxelinux.configfile code 209 = text;option pxelinux.pathprefix code 210 = text;option pxelinux.reboottime code 211 = unsigned integer 32;option architecture-type code 93 = unsigned integer 16;option space ipxe;option ipxe-encap-opts code 175 = encapsulate ipxe;option ipxe.priority code 1 = signed integer 8;option ipxe.keep-san code 8 = unsigned integer 8;option ipxe.skip-san-boot code 9 = unsigned integer 8;option ipxe.syslogs code 85 = string;option ipxe.cert code 91 = string;option ipxe.privkey code 92 = string;option ipxe.crosscert code 93 = string;option ipxe.no-pxedhcp code 176 = unsigned integer 8;option ipxe.bus-id code 177 = string;option ipxe.san-filename code 188 = string;option ipxe.bios-drive code 189 = unsigned integer 8;option ipxe.username code 190 = string;option ipxe.password code 191 = string;option ipxe.reverse-username code 192 = string;option ipxe.reverse-password code 193 = string;option ipxe.version code 235 = string;option iscsi-initiator-iqn code 203 = string;# Feature indicatorsoption ipxe.pxeext code 16 = unsigned integer 8;option ipxe.iscsi code 17 = unsigned integer 8;option ipxe.aoe code 18 = unsigned integer 8;option ipxe.http code 19 = unsigned integer 8;option ipxe.https code 20 = unsigned integer 8;option ipxe.tftp code 21 = unsigned integer 8;option ipxe.ftp code 22 = unsigned integer 8;option ipxe.dns code 23 = unsigned integer 8;option ipxe.bzimage code 24 = unsigned integer 8;option ipxe.multiboot code 25 = unsigned integer 8;option ipxe.slam code 26 = unsigned integer 8;option ipxe.srp code 27 = unsigned integer 8;option ipxe.nbi code 32 = unsigned integer 8;option ipxe.pxe code 33 = unsigned integer 8;option ipxe.elf code 34 = unsigned integer 8;option boot code 35 = unsigned integer 8;option ipxe.efi code 36 = unsigned integer 8;option ipxe.fcoe code 37 = unsigned integer 8;option ipxe.vlan code 38 = unsigned integer 8;option ipxe.menu code 39 = unsigned integer 8;option ipxe.sdi code 40 = unsigned integer 8;option ipxe.nfs code 41 = unsigned integer 8;option client-architecture code 93 = unsigned integer 16;option ipxe.no-pxedhcp 1;default-lease-time 600;max-lease-time 7200;ddns-update-style none;authoritative;log-facility local7;option ip-forwarding true;option mask-supplier false;subnet 192.168.14.0 netmask 255.255.255.0 {authoritative;range 192.168.14.12 192.168.14.252;option domain-name-servers 111.11.11.1;default-lease-time 600;max-lease-time 7200;option broadcast-address 192.168.14.255;option routers 192.168.14.1;ping-check true;# DHCP option 60 PXEClient#option vendor-class-identifier "PXEClient";option vendor-encapsulated-options 01:04:00:00:00:00:ff;class "pxeclient" {match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";# For iPXE Boot filesif exists user-class and option user-class = "iPXE" {if option client-architecture = encode-int ( 16, 16 ) {option vendor-class-identifier "HTTPClient";filename "http://192.168.14.195/ipxe/ipxe.efi";} else {filename "http://192.168.14.195/ipxe/menu.ipxe";}} elsif option client-architecture = 00:00 {filename "undionly.kpxe"; # for booting legacy PXE} else {filename "ipxe.efi";# for booting UFEI PXE}}next-server 192.168.14.195;host music1{hardware ethernet 00:00:00:d1:00:00;fixed-address 192.168.14.3;}}

Apache2

lonely@lonely-Ubuntu:/srv/www$ tree -L 3.├── ipxe│ ├── gparted-live.ipxe│ ├── memdisk│ ├── menu.ipxe│ ├── ubuntu-live.ipxe│ ├── ubuntu-live-nfs.ipxe│ ├── wimboot│ ├── winpe-amd64.ipxe│ └── winpe-x86.ipxe├── linux│ ├── gparted│ │ ├── filesystem.squashfs│ │ ├── initrd.img│ │ └── vmlinuz│ ├── gparted-live-1.2.0-1-amd64.iso│ ├── gparted-live-1.2.0-1-i686.iso│ ├── hirsute-desktop-amd64.iso│ ├── memdisk│ └── ubuntu│ ├── boot│ ├── boot.catalog│ ├── casper│ ├── dists│ ├── EFI│ ├── install│ ├── md5sum.txt│ ├── pool│ ├── preseed│ └── ubuntu├── tools│ ├── ChromeSetup.exe│ ├── Dism++10.1.1001.10_d4ba4eb035254b3326d6adc6638bc9c8daea7018.zip│ ├── Firefox Setup 87.0.exe│ ├── QQPinyin_Setup_6.6.6304.400.exe│ ├── QQWubi_Setup_2.3.622.400.exe│ ├── sogou_pinyin_102a.exe│ ├── SPlayer-Setup-4.9.4.exe│ ├── sysdiag-full-5.0.59.0-0411.exe│ └── weasel-0.14.3.0-installer.exe└── winpe├── amd64│ ├── fwfiles│ ├── media│ └── mount├── LICENSE.txt├── README.txt├── src│ ├── assert.h│ ├── bootapp.h│ ├── byteswap.h│ ├── callback.S│ ├── cmdline.c│ ├── cmdline.h│ ├── compiler.h│ ├── coverity-model.c│ ├── cpio.c│ ├── cpio.h│ ├── ctype.h│ ├── die.c│ ├── efi│ ├── efiblock.c│ ├── efiblock.h│ ├── efiboot.c│ ├── efiboot.h│ ├── efi.c│ ├── efifile.c│ ├── efifile.h│ ├── efiguid.c│ ├── efi.h│ ├── efimain.c│ ├── efipath.c│ ├── efipath.h│ ├── efireloc.c│ ├── errno.h│ ├── huffman.c│ ├── huffman.h│ ├── i386.i│ ├── int13.c│ ├── int13.h│ ├── ipxe│ ├── lznt1.c│ ├── lznt1.h│ ├── lzx.c│ ├── lzx.h│ ├── main.c│ ├── Makefile│ ├── pause.c│ ├── pause.h│ ├── peloader.c│ ├── peloader.h│ ├── prefix.S│ ├── rotate.h│ ├── script.lds│ ├── sha1.c│ ├── sha1.h│ ├── startup.S│ ├── stdarg.h│ ├── stddef.h│ ├── stdint.h│ ├── stdio.c│ ├── stdio.h│ ├── stdlib.h│ ├── string.c│ ├── string.h│ ├── strings.h│ ├── vdisk.c│ ├── vdisk.h│ ├── vsprintf.c│ ├── wchar.h│ ├── wctype.h│ ├── wimboot.h│ ├── wimboot.i386│ ├── wimboot.x86_64│ ├── wim.c│ ├── wimfile.c│ ├── wimfile.h│ ├── wim.h│ ├── wimpatch.c│ ├── wimpatch.h│ ├── x86_64.i│ ├── xca.c│ └── xca.h└── x86├── fwfiles├── media└── mount25 directories, 101 files

NFS

lonely@lonely-Ubuntu:/etc/ganesha$ cat ganesha.conf##################################################### Ganesha Config Example## This is a commented example configuration file for Ganesha. It is not# complete, but only has some common configuration options. See the man pages# for complete documentation.###################################################### These are core parameters that affect Ganesha as a whole.NFS_CORE_PARAM {## Allow NFSv3 to mount paths with the Pseudo path, the same as NFSv4,## instead of using the physical paths.mount_path_pseudo = true;## Configure the protocols that Ganesha will listen for. This is a hard## limit, as this list determines which sockets are opened. This list## can be restricted per export, but cannot be expanded.#Protocols = 3,4,9P;}## These are defaults for exports. They can be overridden per-export.EXPORT_DEFAULTS {## Access type for clients. Default is None, so some access must be## given either here or in the export itself.Access_Type = RW;}## Configure settings for the object handle cacheMDCACHE {## The point at which object cache entries will start being reused.Entries_HWMark = 100000;}## Configure an export for some file treeEXPORT{## Export Id (mandatory, each EXPORT must have a unique Export_Id)Export_Id = 46;## Exported path (mandatory)Path = /srv/nfs/ubuntu;## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)Pseudo = /ubuntu;## Restrict the protocols that may use this export. This cannot allow## access that is denied in NFS_CORE_PARAM.#Protocols = 3,4;## Access type for clients. Default is None, so some access must be## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT blockAccess_Type = RW;## Whether to squash various users.Squash = no_root_squash;## Allowed security types for this export#Sectype = sys,krb5,krb5i,krb5p;## Exporting FSALFSAL {Name = VFS;}}## Configure an export for some file treeEXPORT{## Export Id (mandatory, each EXPORT must have a unique Export_Id)Export_Id = 28;## Exported path (mandatory)Path = /srv/lonely;## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)Pseudo = /lonely;## Restrict the protocols that may use this export. This cannot allow## access that is denied in NFS_CORE_PARAM.#Protocols = 3,4;## Access type for clients. Default is None, so some access must be## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT blockAccess_Type = RW;## Whether to squash various users.Squash = no_root_squash;## Allowed security types for this export#Sectype = sys,krb5,krb5i,krb5p;## Exporting FSALFSAL {Name = VFS;}}## Configure logging. Default is to log to Syslog. Basic logging can also be## Configure logging. Default is to log to Syslog. Basic logging can also be## configured from the command lineLOG {## Default log level for all componentsDefault_Log_Level = WARN;## Configure per-component log ponents {FSAL = INFO;NFS4 = EVENT;}## Where to logFacility {name = FILE;destination = "/var/log/ganesha.log";enable = active;}}

nfs directory

sudo mount -o loop /srv/www/linux/hirsute-desktop-amd64.iso /mnt

sudo cp -a -r -v /mnt/. /srv/nfs/ubuntu/

showmount -e

menu.ipxe

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat menu.ipxe#!ipxeset menu-timeout 5000set submenu-timeout ${menu-timeout}:startmenu iPXE boot menuitem --gap -- Welcome to use iPXE network boot system!item --gap -- ------------------------- Operating systems ------------------------------item --key w menu-winpeWindows Preinstallation Environment...item --key l menu-liveLinux Live Environments...item --key b salstar Chain http://boot.salstar.skitem --gap -- ------------------------- Advanced options -------------------------------item --key c config Configure settingsitem shellDrop to iPXE shellitem rebootReboot computeritemitem --key x exit Exit iPXE and continue BIOS bootchoose --timeout ${menu-timeout} --default menu-winpe selected || goto cancelset menu-timeout 0goto ${selected}:menu-winpemenu Windows Preinstallation environmentsitem winpe-x86 Boot Windows Preinstallation environments x86item winpe-amd64 Boot Windows Preinstallation environments x64itemitem --key 0x08 backBack to top menu...choose --timeout ${submenu-timeout} --default winpe-amd64 selected && goto ${selected} || goto start:menu-livemenu Linux Live Environmentsitem ubuntu-liveBoot Ubuntu LiveCD from httpitem ubuntu-live-nfsBoot Ubuntu LiveCD from nfsitem gparted-live Boot Gparted LiveCDitemitem --key 0x08 backBack to top menu...choose --timeout ${submenu-timeout} --default ubuntu-live selected && goto ${selected} || goto start:salstarchain http://boot.salstar.sk:ubuntu-livechain ubuntu-live.ipxe:ubuntu-live-nfschain ubuntu-live-nfs.ipxe:gparted-livechain gparted-live.ipxe:winpe-x86chain winpe-x86.ipxe:winpe-amd64chain winpe-amd64.ipxe:pxelinuxecho Loading pxelinux ...set next-server 192.168.14.195set 209:string pxelinux.cfg/defaultset 210:string tftp://${next-server}/kernel ${url}pxelinux.0boot:cancelecho You cancelled the menu, dropping you to a shell:shellecho Type 'exit' to get the back to the menushellset menu-timeout 0set submenu-timeout 0goto start:failedecho Booting failed, dropping to shellgoto shell:rebootreboot:exitexit:configconfiggoto start:backset submenu-timeout 0goto start

ipxe directory

lonely@lonely-Ubuntu:/srv/www/ipxe$ lsgparted-live.ipxe menu.ipxe ubuntu-live-nfs.ipxe winpe-amd64.ipxememdisk ubuntu-live.ipxe wimbootwinpe-x86.ipxe

configuration file

ipxe boot ubuntu live cd from nfs

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat ubuntu-live-nfs.ipxe#!ipxeset server_ip 192.168.14.195set nfs_path /ubuntukernel http://192.168.14.195/linux/ubuntu/casper/vmlinuzinitrd http://192.168.14.195/linux/ubuntu/casper/initrdimgargs vmlinuz initrd=initrd boot=casper netboot=nfs ip=dhcp nfsroot=${server_ip}:${nfs_path} nosplash --boot

ipxe boot ubuntu live cd from http

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat ubuntu-live.ipxe#!ipxe# See /manpages/precise/man7/casper.7.html for casper cmdline detailsecho Booting Ubuntu Live for educationkernel http://192.168.14.195/linux/ubuntu/casper/vmlinuzinitrd http://192.168.14.195/linux/ubuntu/casper/initrdimgargs vmlinuz initrd=initrd root=/dev/ram0 ip=dhcp url=http://192.168.14.195/linux/hirsute-desktop-amd64.iso splash --boot

ipxe boot winpe x32

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat winpe-x86.ipxe#!ipxekernel wimbootset arch x86initrd http://192.168.14.195/winpe/${arch}/media/Boot/BCD BCDinitrd http://192.168.14.195/winpe/${arch}/media/Boot/boot.sdiboot.sdiinitrd http://192.168.14.195/winpe/${arch}/media/sources/boot.wim boot.wimboot

ipxe boot winpe x64

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat winpe-amd64.ipxe#!ipxekernel wimbootset arch amd64initrd http://192.168.14.195/winpe/${arch}/media/Boot/BCD BCDinitrd http://192.168.14.195/winpe/${arch}/media/Boot/boot.sdiboot.sdiinitrd http://192.168.14.195/winpe/${arch}/media/sources/boot.wim boot.wimboot

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。