Pxe boot linux iso

Preboot Execution Environment

The Preboot eXecution Environment (PXE, most often pronounced as pixie) specification describes a standardized client-server environment that boots a software assembly, retrieved from a network, on PXE-enabled clients. On the client side it requires only a PXE-capable network interface controller (NIC), and uses a small set of industry-standard network protocols such as DHCP and TFTP.

In this guide, PXE is used to boot the installation media with an appropriate option-rom that supports PXE on the target. This works well when you already have a server set up.

Contents

Preparation

Overview

It is useful to give an overview of the PXE boot process in order to understand the #Server setup, the #Installation on the client side and the Arch Linux files needed.

The client starts by broadcasting packets asking for a DHCP server and containing specific PXE options. The DHCP server responds with networking information (the IP address assigned to the client) and also provides, by using specific bootstrap protocol (BOOTP) parameters of the DHCP, additional information like the TFTP server address, the path of the initial network bootstrap program (NBP) to download or the boot configuration file name.

The NBP is transferred from the PXE server to the client using TFTP, to be loaded into memory and executed. The kernel and the initramfs are also transferred this way.

Then the root filesystem is transferred using one of the following protocols: HTTP, NFS or NBD.

Boot from install media

In order to gather the files that will be transferred from the server to the client for booting, get the latest official install media from the download page.

Next mount the image:

where release_date is the release date in the ISO filename like, e.g., 2020.10.01 .

Boot from netboot

Arch Linux netboot images can be used to download the latest Arch Linux release on the fly upon system boot. Download the image compatible with your configuration.

Pixiecore

A all-in-one solution is provided by pixiecore

  1. Install pixiecore-gitAUR
  2. Run pixiecore quick arch —dhcp-no-bind as root
  3. Boot via PXE

Server setup

You will need to setup a DHCP server, a TFTP server for transferring the NBP and one of the following services for transferring the root filesystem: HTTP server, NFS or NBD.

Network

Bring up your wired network adapter, and assign it an address appropriately.

DHCP + TFTP

You will need both a DHCP server and a TFTP server to configure networking on the install target and to facilitate the transfer of files between the server and the client. dnsmasq does both, and is extremely easy to set up.

dnsmasq needs to be configured. See instructions on how to setup a dnsmasq#TFTP server and a dnsmasq#PXE server.

Are provided below some common configuration instructions. tftp_root is the directory where the Arch ISO is mounted (e.g. /mnt/archiso ) or where the network boot program is located.

To enable the DHCP server and give IPv4 addresses within a range, add to the configuration file a line similar to:

Or in case there is already a DHCP-server running on the network and you want to interoperate with it, see dnsmasq#Proxy DHCP.

Two examples covering different boot style and installation media are provided below.

Once configured according to your needs, start dnsmasq.service .

BIOS boot from install media

The path of the initial bootstrap program to be transferred is defined with the dhcp-boot option in the configuration file.

In order to send specific bootstrap protocol (BOOTP) parameters, like the configuration file path, the dhcp-option-force=flag,value line is used.

UEFI boot from netboot

To send a file depending on the architecture, here the netboot image for UEFI-style boot, use:

If using netboot, the rest of the server setup section which focuses on the Arch ISO does not apply.

Transferring archiso root filesystem

Thanks to archiso_pxe_http , archiso_pxe_nfs and archiso_pxe_nbd initcpio hooks in archiso, it is possible to boot using HTTP, NFS or NBD. Boot time is approximately the same in all three methods, but HTTP method allows you to watch a state of downloading airootfs.sfs in percents.

Читайте также:  Установка trueconf alt linux

Among all alternatives, darkhttpd is by far the most trivial to setup (and the lightest-weight).

Then start darkhttpd using our /mnt/archiso as the document root:

You will need to set up an NFS server with an export at the root of your mounted installation media, which would be /mnt/archiso if you followed #Preparation. After setting up the server, add the following line to your /etc/exports file:

If the server was already running, re-export the filesystems with exportfs -r -a -v .

The default settings in the installer expect to find the NFS at /run/archiso/bootmnt , so you will need to edit the boot options. To do this, press Tab on the appropriate boot menu choice and edit the archiso_nfs_srv option accordingly:

Alternatively, you can use /run/archiso/bootmnt for the entire process.

After the kernel loads, the Arch bootstrap image will copy the root filesystem via NFS to the booting host. This can take a little while. Once this completes, you should have a running system.

Install the nbd package and configure it:

where release_date is the release date in the ISO filename like, e.g., 2020.03.01 .

Existing PXE server

If you have an existing PXE server with a PXELINUX system setup (e.g. a combination of DHCP and TFTP), you can add the following menu items to your /tftpboot/pxelinux.cfg/default file in order to boot Arch via your preferred method:

You can replace archiso_http_srv with archiso_nfs_srv for NFS or archiso_nbd_srv for NBD (see usage examples in arch/boot/syslinux/archiso_pxe.cfg file resided on ArchLinux iso). Whichever method you choose, you must pass ip= parameter to instruct the kernel to bring up the network interface before it attempts to mount the installation medium over the network. Passing BOOTIF= is required when there are several wired interfaces on the client side and/or you want resolv.conf to be already configured inside booted archiso. You can use sysappend mask 3 (which is 1+2) to pass these parameters automatically. For available boot parameters see README.bootparams.

Installation

For this portion you will need to figure out how to tell the client to attempt a PXE boot; in the corner of the screen along with the normal post messages, usually there will be some hint on which key to press to try PXE booting first. On an IBM x3650 F12 brings up a boot menu, the first option of which is Network; on a Dell PE 1950/2950 pressing F12 initiates PXE booting directly.

Looking at journald on the PXE server will provide some additional insight to what exactly is going on during the early stages of the PXE boot process:

After you load pxelinux.0 and archiso.cfg via TFTP, you will (hopefully) be presented with a syslinux boot menu with several options, where you can select Boot Arch Linux (x86_64) (HTTP).

Next the kernel and initramfs (appropriate for the architecture you selected) will be transferred, again via TFTP:

If all goes well, you should then see activity on darkhttpd coming from the PXE-target; at this point the kernel would be loaded on the PXE-target, and in init:

After the root filesystem is downloaded via HTTP, you will eventually end up at the normal live system root zsh prompt.

Post-boot

Unless you want all traffic to be routed through your PXE server (which will not work anyway unless you set it up properly), you will want to stop dnsmasq.service and get a new lease on the install target, as appropriate for your network layout.

You can also kill darkhttpd; the target has already downloaded the root filesystem, so it is no longer needed. While you are at it, you can also unmount the installation image:

At this point you can follow the Installation guide.

Low memory systems

The copytoram initramfs option can be used to control whether the root filesystem should be copied to ram in its entirety in early-boot.

It highly recommended to leave this option alone, and should only be disabled if entirely necessary (systems with less than

256MB physical memory). Append copytoram=n to your kernel line if you wish to do so.

Sharing internet with PXE clients

If your network for PXE clients is private (for example, 192.168.1.0/24), and you want them to be able to access internet (for example, for packages installation), you should configure masquerade/source nat properly. Your PXE server must have a separate NIC connected to the internet. You can use such command to pass through the internet to clients:

To make this rule persistent after reboot, run the following command:

Troubleshooting

DHCP interface rename bug

FS#36749 causes default predictable network interface renaming to fail and then DHCP client to fail because of it. A workaround is to add the kernel boot parameter net.ifnames=0 to disable predictable interface names.

Читайте также:  Compiler used in linux

VirtualBox cannot boot while real machines can

When using VirtualBox to test your configuration, the virtual machine may get stuck at:

While PXE booting with a real machine works fine. The problem may be because you have set several CPU cores to your client machine, and you set its type as Other and version as Other/Unknown (64 bit). So VirtualBox does not know which paravirtualization interface to use by default.

Adding loglevel=7 to the kernel parameters lets you see where it actually got stuck:

To resolve this, either use one CPU core, or go to Machine > Settings > System > Acceleration and set one of the following paravirtualization interface: Minimal, Hyper-V or KVM.

Источник

PXE Boot from network (DHCP, TFTP, NFS, Samba, FTP, HTTP) — Linux server

The network boot will be explained with working example setups. When you understood the concept, then you can use your own server setups and directory structures. Everything is flexible and can be configured to be anywhere on your server.

The minimum requirements to boot from a network are a DHCP server and a TFTP server.

The access to the Plop Linux files can be via NFS share, Samba share, TFTP, FTP or HTTP.

Download a working sample with the full directory structure: netboot-sample.tar.gz, for ISO netboot-sample-iso.tar.gz

The download links in this description are for the 64-bit version. To create a 32-bit version use the corresponding files from the download area.

Basic conditions for this example setup:

  • Network type: 10.0.0.x Netmask 255.255.255.0
  • Server IP: 10.0.0.1
  • Client IP: will be 10.0.0.250 from DHCP with MAC address
  • TFTP root directory: /tftpboot

It works with other IP addresses too!

Here are config files for a Linux test system in an archive: pxeconfs.tar.gz

1. Setup
1.1. Extract the Plop Linux files
1.2. Setup the DHCP server
1.3. Setup the TFTP server
2. NFS
2.1. Boot with NFS
2.2. Boot ISO over NFS
3. Samba network share
3.1. Boot with Samba network share
3.2. Boot ISO over Samba network share
4. TFTP
4.1. Boot only with TFTP
4.2. Boot ISO over TFTP
5. FTP
5.1. Boot with FTP
5.2. Boot ISO over FTP
6. HTTP
6.1. Boot with HTTP
6.2. Boot ISO over HTTP
7. Boot problems

1. Setup

1.1. Extract the Plop Linux files

Extract the file ploplinux-pxeboot.tar.gz to your root directory.

tar xfz ploplinux-pxeboot.tar.gz -C /

Now you have the basic directory structure and files in ‘ /tftpboot ‘.

tar xfz ploplinux-21.3.tgz -C /tmp

Move the files to ‘ /tftpboot/ploplinux-netboot/ ‘.

mv /tmp/ploplinux-21.3/* /tftpboot/ploplinux-netboot/

Now you should have the following directories and files

1.2. Setup the DHCP server

You need the DHCP server software. If your distribution has none then you can use dhcp-4.4.2.tar.gz (or search for the latest on the net) and compile it.

This is the example DHCP server configuration.
The very important line is ‘ filename «/ploplinux-netboot/pxelinux.0»; ‘.

To start the DHCP server simply run ‘ dhcpd ‘.

Note: For testing you can run ‘ dhcpd -f ‘ to run dhcpd in the foreground and get some debug output.

Note: Change the ‘ next-server ‘ IP to set another TFTP server IP.

1.3. Setup the TFTP server

Download the latest TFTP server from ftp://www.kernel.org/pub/software/network/tftp/ and install it with ‘ ./configure —prefix=/usr && make && make install ‘.

To start the TFTP server we use Xinetd.

Here is the base Xinetd config file

And the configuration for the tftp server.
The important line is ‘ server_args = -s /tftpboot ‘ for the tftp root directory.

To start Xinetd simply run ‘ xinetd ‘.

Note: For testing you can run ‘ xinetd -d ‘ to run Xinetd in the foreground and get some debug output.

2. NFS

2.1. Boot with NFS

Requirements are the DHCP and TFTP Server (Setup).

Basic configs for your NFS server, without security aspects:

Example: nfsmount=10.0.0.1:/tftpboot/ploplinux-netboot
Example: nfsmount=10.0.0.1:/tftpboot/ploplinux-netboot|rsize=2048,wsize=2048,nolock,vers=2,hard,intr

If the DHCP, Xinetd and NFS server are running correct you should be able to boot Plop Linux via network.

2.2. Boot ISO over NFS

You need the ISO ploplinux-21.3-x86_64.iso, the directory structure and files of ploplinux-pxeboot.tar.gz and the ‘ syslinux ‘ directory of ploplinux-21.3-x86_64.tar.gz. The DHCP and TFTP Server must work.

Basic configs for your NFS server, without security aspects:

Create a symlink ‘ ln -s ploplinux-21.3-x86_64.iso ploplinux.iso ‘.

Parameter: nfsmount=NFSSHARE|ADDITIONALPARAMS iso_filename=ISOFILE

On the server: /tftpboot/ploplinux-netboot/ploplinux.iso
Example: nfsmount=10.0.0.1:/tftpboot/ploplinux-netboot iso_filename=ploplinux.iso
Example: nfsmount=10.0.0.1:/tftpboot/ploplinux-netboot|rsize=2048,wsize=2048,nolock,vers=2,hard,intr iso_filename=ploplinux.iso

nfs-iso.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/nfs-iso.conf ‘ to enable the loading of nfs-iso.conf .

3. Samba network share

3.1. Boot with Samba network share

Requirements are the DHCP and TFTP Server (Setup).

Basic configs for your Samba server, without security aspects:

Create the share ‘ ploplinux-netboot ‘.
File name: /etc/samba/smb.conf

SMBUSER : user to access the share. If the share permits access to all users then use «» for SMBUSER
SMBPASSWORD : password of the user to access the share. For an empty password use «»

Читайте также:  Что безопаснее виндовс или линукс

Example: smbmount=//10.0.0.1/ploplinux-netboot:myuser:mypass
Example: smbmount=//10.0.0.1/ploplinux-netboot:myuser2:»»

smb.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/smb.conf ‘ to enable the loading of smb.conf .

When the DHCP, Xinetd and Samba server are running correct you should be able to boot Plop Linux via network.

3.2. Boot ISO over Samba

You need the ISO ploplinux-21.3-x86_64.iso, the directory structure and files of ploplinux-pxeboot.tar.gz and the ‘ syslinux ‘ directory of ploplinux-21.3-x86_64.tar.gz. The DHCP and TFTP Server must work.

Basic configs for your Samba server, without security aspects:

Create the share ‘ ploplinux-netboot ‘.
File name: /etc/samba/smb.conf

Create there a symlink ‘ ln -s ploplinux-21.3-x86_64.iso ploplinux.iso ‘.

Parameter: smbmount=//SERVER/SHARE:SMBUSER:SMBPASSWORD iso_filename=ISOFILE

SMBUSER : user to access the share. If the share permits access to all users then use «» for SMBUSER
SMBPASSWORD : password of the user to access the share. For an empty password use «»
ISOFILE : ploplinux.iso (relative to the share)
On the server: /tftpboot/ploplinux-netboot/ploplinux.iso

Example: smbmount=//10.0.0.1/ploplinux-netboot:myuser:mypass iso_filename=ploplinux.iso
Example: smbmount=//10.0.0.1/ploplinux-netboot:myuser2:»» iso_filename=ploplinux.iso

smb-iso.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/smb-iso.conf ‘ to enable the loading of smb-iso.conf .

4. TFTP

4.1. Boot only with TFTP

Requirements are the DHCP and TFTP Server (Setup).

Create the file ‘ /tftpboot/ploplinux-netboot/tftpfilelist ‘ for TFTP boot that lists all Plop Linux files.

cd /tftpboot
find ploplinux-netboot > ploplinux-netboot/tftpfilelist

Parameter: tftpboot=SERVER|FILELIST dir=PLOPLINUXDIRECTORY

Example: tftpboot=10.0.0.1|ploplinux-netboot/tftpfilelist dir=/ploplinux-netboot/ploplinux

tftp.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/tftp.conf ‘ to enable the loading of tftp.conf .

4.2. Boot ISO over TFTP

You need the ISO ploplinux-21.3-x86_64.iso, the directory structure and files of ploplinux-pxeboot.tar.gz and the ‘ syslinux ‘ directory of ploplinux-21.3-x86_64.tar.gz. The DHCP and TFTP Server must work.

Create the file ‘ /tftpboot/ploplinux-netboot/tftpfilelist-iso ‘ for TFTP boot with the Plop Linux ISO file name.

cd /tftpboot/ploplinux-netboot
echo ploplinux-netboot/ploplinux.iso > tftpfilelist-iso

Create a symlink ‘ ln -s ploplinux-21.3-x86_64.iso ploplinux.iso ‘.

Parameter: tftpboot=SERVER|FILELIST iso_filename=ISOFILE

Example: tftpboot=10.0.0.1|ploplinux-netboot/tftpfilelist-iso iso_filename=ploplinux-netboot/ploplinux.iso

tftp-iso.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/tftp-iso.conf ‘ to enable the loading of tftp-iso.conf .

5. FTP

5.1. Boot with FTP

Requirements are the DHCP and TFTP Server (Setup) and a FTP Server.

The FTP root directory is in this example ‘ /tftpboot/ ‘.

Create the file ‘ /tftpboot/ploplinux-netboot/filelist ‘ for FTP boot that lists all Plop Linux files.

cd /tftpboot/ploplinux-netboot
find > ftpfilelist

ftp.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/ftp.conf ‘ to enable the loading of ftp.conf .

5.2. Boot ISO over FTP

You need the ISO ploplinux-21.3-x86_64.iso, the directory structure and files of ploplinux-pxeboot.tar.gz and the ‘ syslinux ‘ directory of ploplinux-21.3-x86_64.tar.gz. The DHCP and TFTP Server must work. A FTP Server must be available.

The FTP root directory is in this example ‘ /tftpboot/ ‘.

Create the file ‘ /tftpboot/ploplinux-netboot/ftpfilelist-iso ‘ for FTP boot with the Plop Linux ISO file name.

cd /tftpboot/ploplinux-netboot
echo ploplinux.iso > ftpfilelist-iso

Create a symlink ‘ ln -s ploplinux-21.3-x86_64.iso ploplinux.iso ‘.

Parameter: url=ftp://FTPUSER:FTPPASSWORD@FTPSERVER/FTPDIRECTORY|FILELIST iso_filename=ISOFILE

Example: url=ftp://myuser:mypass@10.0.0.1/ploplinux-netboot|/ftpfilelist-iso iso_filename=ploplinux.iso

ftp-iso.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/ftp-iso.conf ‘ to enable the loading of ftp-iso.conf .

6. HTTP

6.1. Boot with HTTP

Requirements are the DHCP and TFTP Server (Setup) and a WEB Server.

The Virtual Host root directory is in this example ‘ /tftpboot/ ‘.

Create the file ‘ /tftpboot/ploplinux-netboot/filelist ‘ for HTTP boot that lists all Plop Linux files.

cd /tftpboot/ploplinux-netboot
find > webfilelist

Example: url=http://www.ploplinux.com/ploplinux-netboot|/webfilelist
Example: url=http://myuser:mypass@www.ploplinux.com/ploplinux-netboot|/webfilelist

http.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/http.conf ‘ to enable the loading of http.conf .

6.2. Boot ISO over HTTP

You need the ISO ploplinux-21.3-x86_64.iso, the directory structure and files of ploplinux-pxeboot.tar.gz and the ‘ syslinux ‘ directory of ploplinux-21.3-x86_64.tar.gz. The DHCP and TFTP Server must work. A WEB Server must be available.

The Virtual Host root directory is in this example ‘ /tftpboot/ ‘.

Create the file ‘ /tftpboot/ploplinux-netboot/webfilelist-iso ‘ for HTTP boot with the Plop Linux ISO file name.

cd /tftpboot/ploplinux-netboot
echo ploplinux.iso > webfilelist-iso

Create a symlink ‘ ln -s ploplinux-21.3-x86_64.iso ploplinux.iso ‘.

Parameter: url=http://USER:PASS@WEBSERVER/WEBDIRECTORY|FILELIST iso_filename=ISOFILE

Example: url=http://www.ploplinux.com/ploplinux-netboot|/webfilelist-iso iso_filename=ploplinux.iso
Example: url=http://myuser:mypass@www.ploplinux.com/ploplinux-netboot|/webfilelist-iso iso_filename=ploplinux.iso

http-iso.conf is loaded by /tftpboot/ploplinux-netboot/pxelinux.cfg/default
Remove the ‘ # ‘ in the line with ‘ #include pxelinux.cfg/http-iso.conf ‘ to enable the loading of http-iso.conf .

7. Boot problems

Maybe there is somewhere a wrong path. When you are in the boot menu, then press at the entry that you want to boot the tabulator key. Then add at the end of the line ‘ debug ‘. You will see more info’s during booting.

>
PXE Boot from network (DHCP, TFTP, Network share, FTP, HTTP) — Windows server

Источник

Оцените статью