樹心幽徑

« 20190126為遠端的Image加裝Fedora Workstation桌面 | Main | 20190208用client的PXE連接Linux Fedora 28 NFS Server進行網路開機成功 »

20190207在Asus筆電用usb隨身碟自Fedora 28 NetBoot Server網路開機成功
2019/02/07,09:30

續:http://oldwww.kmvs.km.edu.tw/lf/index.php?op=ViewArticle&articleId=476&blogId=70

(1) 製作網路開機隨身碟:

(1-0) 置入隨身碟並用df或lsblk指令察看得知為隨身碟的裝置代號為/dev/sdd

(1-1)用parted在/dev/sdd建立出分割區/dev/sdd1:

$  sudo parted /dev/sdd -s mklabel gpt mkpart EFI FAT16 1MiB 100% toggle 1 boot

(1-2)用mkfs在分割區(/dev/sdd1)建立msdos檔案系統:

$  sudo mkfs -t msdos /dev/sdd1

(1-3)將/dev/sdd1掛在$HOME/mnt

$  sudo mount /dev/sdd1 $HOME/mnt

(1-4)重編產生新的 bootx64.efi

$ cd $HOME/ipxe/src

$ vi  ipxe/init.ipxe

$ cat ipxe/init.ipxe
#!ipxe
prompt --key 0x02 --timeout 9000 Press Ctrl-B for the iPXE command line... && shell ||
set prefix file:///linux
chain ${prefix}/boot.cfg ||

$ make clean

$ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe

$ cp  bin-x86_64-efi/ipxe.efi   $HOME/esp/efi/boot/bootx64.efi

(1-5)將$HOME/esp目錄檔案全部拷到新掛上的隨身碟中:

$ sudo cp -r $HOME/esp/* $HOME/mnt

(1-6) $ df
檔案系統                               1K-區段     已用     可用 已用% 掛載點

/dev/sdd1                             60046944    56160 59990784    1% /home/treehrt/mnt

(1-7) $ lsblk
NAME                          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

sdd                             8:48   1  57.3G  0 disk
└─sdd1                          8:49   1  57.3G  0 part /home/treehrt/mnt
:

(1-8) $ tree mnt
mnt
├── efi
│   └── boot
│       └── bootx64.efi
└── linux
    ├── boot.cfg
    ├── initramfs-4.19.16-200.fc28.x86_64.img
    └── vmlinuz-4.19.16-200.fc28.x86_64

3 directories, 4 files

(1-8) $ sudo vi mnt/linux/boot.cfg

(1-9) $ cat mnt/linux/boot.cfg
#!ipxe

echo Step-0: Setup network
ifopen net0
set net0/ip 192.168.1.3
set net0/netmask 255.255.255.0
set net0/gateway 192.168.1.1
echo ${net0/ip}
echo ${net0/gateway}

prompt --key 0x02 --timeout 2000 Press Ctrl+B to continue ||

echo Step-1: Load Kernel ${prefix}/vmlinuz-4.19.16-200.fc28.x86_64  ......
kernel --name kernel.efi ${prefix}/vmlinuz-4.19.16-200.fc28.x86_64 initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.168.1.1 nameserver=163.25.20.1 root=nfs4:192.168.1.103:/fc28 console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet ||


echo Step-2: Make Initrd ${prefix}/initramfs-4.19.16-200.fc28.x86_64.img......
initrd --name initrd.img ${prefix}/initramfs-4.19.16-200.fc28.x86_64.img ||


prompt --timeout 9000 Press any key to install Linux && goto install ||
echo Setp-3 Net Booting Fedora 28 from 192.168.1.103 ........
boot ||

 

(2)設定用戶端機器(client machine)的 BIOS以usb隨身碟優先開機並以剛製妥的usb碟開機

(3-0) 開機過程中,在伺服端執行arp及ifconfig

$ arp

Address                  HWtype  HWaddress           Flags Mask            Iface
ZyXEL.Home               ether   fc:f5:28:73:1a:d4   C                     br0
DESKTOP-9VAD8V7          ether   10:7b:44:33:59:6f   C                     br0
192.168.1.3              ether   2c:56:dc:27:bb:05   C                     br0
sice-client1             ether   2c:56:dc:27:bb:05   C                     br0

$ ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::f588:bbfc:a9df:bfca  prefixlen 64  scopeid 0x20<link>
        ether b0:6e:bf:60:9d:23  txqueuelen 1000  (Ethernet)
        RX packets 470977  bytes 141039404 (134.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 165932  bytes 966901439 (922.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b0:6e:bf:60:9d:23  txqueuelen 1000  (Ethernet)
        RX packets 471293  bytes 149539265 (142.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 762633  bytes 1009348541 (962.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xdf100000-df120000 

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 57  bytes 4453 (4.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 57  bytes 4453 (4.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

(3-1)第1台用戶端機器(asus notebook)網路開機並以liveuser登入成功:

[liveuser@sice-client1 ~]$ df
Filesystem          1K-blocks     Used Available Use% Mounted on
devtmpfs              3995748        0   3995748   0% /dev
tmpfs                 4022204    22512   3999692   1% /dev/shm
tmpfs                 4022204    26640   3995564   1% /run
tmpfs                 4022204        0   4022204   0% /sys/fs/cgroup
192.168.1.103:/fc28  15718400 13077504   2640896  84% /
none                  4022204    82632   3939572   3% /tmp
tmpfs                  804440       16    804424   1% /run/user/42
tmpfs                  804440     4668    799772   1% /run/user/1000

[liveuser@sice-client1 ~]$ uname -a
Linux sice-client1.home.idv.tw 4.19.16-200.fc28.x86_64 #1 SMP Thu Jan 17 00:16:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[liveuser@sice-client1 ~]$ date
Thu Feb  7 01:33:40 UTC 2019

[liveuser@sice-client1 ~]$ w
 01:33:55 up 10 min,  1 user,  load average: 0.22, 0.46, 0.36
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
liveuser tty2      01:26     ?     1:21   0.23s /usr/lib64/firefox/firefox -con

(3-2)遠端開機成功的抓圖畫面如下:

alt

 

(4)第2台遠端開機成功的資訊及抓圖畫面如下:

(4-1)[liveuser@sice-client1 ~]$ uname -a
Linux sice-client1.home.idv.tw 4.19.16-200.fc28.x86_64 #1 SMP Thu Jan 17 00:16:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[liveuser@sice-client1 ~]$ date
Thu Feb  7 03:52:26 UTC 2019
[liveuser@sice-client1 ~]$ w
 03:52:45 up 5 min,  1 user,  load average: 0.69, 0.48, 0.21
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
liveuser tty2      03:51     ?    15.19s  0.15s /usr/libexec/tracker-miner-fs
[liveuser@sice-client1 ~]$ df
Filesystem          1K-blocks     Used Available Use% Mounted on
devtmpfs              1941968        0   1941968   0% /dev
tmpfs                 1968424        0   1968424   0% /dev/shm
tmpfs                 1968424    26548   1941876   2% /run
tmpfs                 1968424        0   1968424   0% /sys/fs/cgroup
192.168.1.103:/fc28  15718400 13078528   2639872  84% /
none                  1968424    39416   1929008   3% /tmp
tmpfs                  393684       16    393668   1% /run/user/42
tmpfs                  393684     5808    387876   2% /run/user/1000
[liveuser@sice-client1 ~]$ ^C

(4-2)第2台用戶端機器桌面抓圖如下:

alt

 

(5-1)電腦教室的PC遠端開機結果

alt

REF 1:https://www.hiroom2.com/2017/07/13/fedora-26-pxeboot-automated-install-en/#sec-1

REF 2:https://www.debian.org/releases/sarge/i386/ch04s06.html.zh_TW

 

迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType