このトピックでは、 PXE サーバを使用して Cisco APIC をインストールする方法について説明します。必要なソフトウェア、構成手順、および DNSMasq、 HTTP、PXELINUX、および ISO 抽出のトラブルシューティングの注意事項も含まれます。
PXE サーバを使用して、UEFI、UEFI セキュアブート、およびレガシー BIOS システムの Cisco Application Policy Infrastructure Controller (APIC)ISO をインストールできます。
次のソフトウェアがシステムにインストールされていることを確認します。
sudo apt install -y dnsmasq lighttpd syslinux-common pxelinux
DNSMasq Configuration
新しい dnsmasq 構成を作成するには、以下のコマンドを実行します。
$ sudo systemctl stop dnsmasq
$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
$ sudo mkdir -p /srv/tftp
次のコード スニペットでは、ISO をホストしている HTTP サーバの IP の詳細を入力し、HTTP サーバの IP に到達できる必要があるクライアントの DHCP サブネット範囲を構成する必要があります。変更を含む構成ファイルを保存した後、次のコマンドを実行します。
sudo systemct restart dnsmasq
interface=*
bind-interfaces
enable-tftp
tftp-root=/srv/tftp
port=0
log-dhcp
dhcp-no-override
dhcp-match=x86PC, option:client-arch, 0 # matches legacy BIOS x86
dhcp-match=BC_EFI, option:client-arch, 7 # matches UEFI x86-64
# Load different PXE boot image depending on client architecture
pxe-service=tag:x86PC,X86PC, "Install Linux on x86 BIOS", pxelinux.0
pxe-service=tag:BC_EFI,BC_EFI, "Install Linux on x86-64 UEFI", bootx64.efi
# Set bootfile name only when tag is "bios" or "uefi"
dhcp-boot=tag:x86PC,pxelinux.0 # for Legacy BIOS detected by dhcp-match above
dhcp-boot=tag:BC_EFI,bootx64.efi # for UEFI arch detected by dhcp-match above
# Enable PXELinux client options
dhcp-option=tag:x86PC,208,f1:00:74:7e # pxelinux.magic string
# set boot params, note the ip/network is tied to the netplan config in this layer
dhcp-option-force=129,"atxi.wipe=true atomix.isourl=http://<IP of your HTTP server>/atomix.iso"
# an example IPV4 subnet range
dhcp-range=192.168.41.3,192.168.41.50,12h
dhcp-lease-max=25
HTTP Configuration
デフォルトの lighttpd 構成ファイルは、ポート 80 のすべてのインターフェイスでリッスンするため、変更する必要はありません。
ファイルの名前は、
dhcp-option-force=129設定の/etc/dnsmasq.conf値と一致する必要があります。この値は DHCP 設定を介してマシンに渡され、URL を使用して iso ファイルをダウンロードします。インストーラ ISO ファイルを次のパスにコピーします。
/var/www/html/<ISONAME.iso>
PXELINUX Configuration
BIOS/レガシーを介して再起動するシステムは、pxelinux を使用してインストーラを取得します。上記の DNSMasq 構成ファイルの tftp の場所が、これらのファイルと構成をコピーするか、必要に応じてコマンドを調整するために使用されていることを確認します。
sudo mkdir -p /srv/tftp
sudo cp -av /usr/lib/PXELINUX/* /srv/tftp/
sudo cp /usr/lib/syslinux/modules/bios/* /srv/tftp/
sudo mkdir -p /srv/tftp/pxelinux.cfg
次の設定を /srv/tftp/pxelinux.cfg/default の場所にコピーし、HTTP サーバーの IP と ISO へのパスに一致するように HTTP URL を変更します。
DEFAULT atomix-install
label atomix-install
kernel vmlinuz
append initrd=initrd.img ro verbose debug console=tty0 console=ttyS0,115200n8 atomix.isourl=http://<HTTP_IP>/<ISO NAME>
sysappend 3
Extracting content from ISO
ISO を取得したら、次に示すように、ISO からいくつかのファイルを抽出し、特定のディレクトリに配置する必要があります。
$ sudo mkdir /mnt/iso /mnt/efi
$ sudo mount -oloop /var/www/html/<ISO filename> /mnt/iso
$ sudo mount -t vfat /mnt/iso/images/efiboot.img /mnt/efi
$ cp -av /mnt/efi/EFI/BOOT/BOOTX64.efi /srv/tftp/bootx64.efi
$ cp -av /mnt/efi/EFI/BOOT/GRUBX64.efi /srv/tftp/grubx64.efi
$ cp -av /mnt/iso/isolinux/vmlinuz /srv/tftp/vmlinuz
$ cp -av /mnt/iso/isolinux/initrd.img /srv/tftp/initrd.img
$ sudo umount /mnt/efi
$ sudo umount /mnt/iso
Testing
構成を適用したら、テスト システムをインストーラで起動し、ネットワーク設定を構成し、HTTP を介して ISO をシステムにダウンロードして、インストールを続行する必要があります。
PXE サーバーでは、次の dnsmasq サービスを使用できます。
sudo journalctl --follow -u dnsmasq
一部の dnsmasq ログエントリには、次のようなエラーが表示される場合があります。ただし、これらのエラーは致命的ではなく、ファームウェアの UEFI PXE クライアントは再試行します。
Feb 17 01:01:25 ubuntu dnsmasq-dhcp[1201]: 1836224829 sent size: 10 option: 43
vendor-encap 06:01:08:0a:04:00:50:58:45:ff
Feb 17 01:01:25 ubuntu dnsmasq-tftp[1201]: error 8 User aborted the transfer
received from 192.168.41.3
Feb 17 01:01:25 ubuntu dnsmasq-tftp[1201]: failed sending /srv/tftp/bootx64.efi to
192.168.41.3
Feb 17 01:01:25 ubuntu dnsmasq-tftp[1201]: sent /srv/tftp/bootx64.efi to
192.168.41.3
Feb 17 01:01:47 ubuntu dnsmasq-tftp[1201]: error 3 User provided memory block is
too small received from 192.168.41.3
Feb 17 01:01:47 ubuntu dnsmasq-tftp[1201]: failed sending /srv/tftp/grubx64.efi to
192.168.41.3
Feb 17 01:02:09 ubuntu dnsmasq-tftp[1201]: sent /srv/tftp/grubx64.efi to
192.168.41.3
PXE クライアントでは、シリアル コンソール出力にインストールが表示され、特に ISO を取得する方法が表示されます。
これは、インストーラ iso ファイルを取得する方法を示すインストーラ出力の一部です。
++ cmdline=' BOOT_IMAGE=vmlinuz initrd=initrd.img ro verbose debug console=tty0 console=ttyS0,115200n8 atomix.isourl=http://192.168.41.2/atomix.iso ip=192.168.41.41:192.'
++ case "$cmdline" in
++ val='http://192.168.41.2/atomix.iso ip=192.168.41.41:192.168.41.2:192.168.41.2:255.255.255.0 BOOTIF=01-52-54-00-12-34-56 '
++ val=http://192.168.41.2/atomix.iso
++ echo http://192.168.41.2/atomix.iso
+ ksurl=http://192.168.41.2/atomix.iso
+ '[' -z http://192.168.41.2/atomix.iso ']'
+ '[' -n http://192.168.41.2/atomix.iso ']'
+ '[' -z '' ']'
+ dhclient
[ 3.573160] 8021q: adding VLAN 0 to HW filter on device ens4
+ tmpiso=/tmp/atomix.iso
++ seq 1 3
+ for count in $(seq 1 3)
+ '[' http: = https ']'
+ busybox wget --output-document=/tmp/atomix.iso http://192.168.41.2/atomix.iso
Connecting to 192.168.41.2 (192.168.41.2:80)
atomix.iso 100% |********************************| 842M 0:00:00 ETA
+ break
+ mkdir -p /cdrom
+ mount -o loop,ro /tmp/atomix.iso /cdrom
[ 4.896038] ISO 9660 Extensions: RRIP_1991A
+ echo 'Found install image through PXE'
Found install image through PXE
...