cybsol 15.04.2013 01:51

Tips & tricksNetwork boot: iPXE + iscsi

Hello, world! Примерный алгоритм настройки следующий.

Первым делом настраиваем dhcpd
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
ddns-update-style none;

option domain-name "example.com";
option domain-name-servers 172.16.93.1;

default-lease-time 600;
max-lease-time 7200;

log-facility local7;

#ipxe spec options
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.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 indicators
option 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 ipxe.comboot code 35 = unsigned integer 8;
option ipxe.efi code 36 = unsigned integer 8;
#endof spec opt

#ProxyDHCP off
option ipxe.no-pxedhcp 1;

subnet 172.16.93.0 netmask 255.255.255.0 {
range 172.16.93.2 172.16.93.60;
option routers 172.16.93.1;
option broadcast-address 172.16.93.255;
next-server 172.16.93.1;
if exists user-class and option user-class = "iPXE" {
filename "menu.ipxe";
option ipxe.keep-san 1;
} else {
filename "undionly.kpxe";
}
}



Дальше нам понадобится tftpd (или нечто производное) для передачи самого ipxe и конфига меню. Владельцем каталога с загружаемым файлом, в debian производных системах, должен быть nobody. Содержимое каталога:
1) undionly.kpxe - сам ipxe;
2) menu.ipxe
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!ipxe

:mainmenu
menu
item --gap Select OS:
item linux Boot Linux
item w7boot Boot Windows 7
item demo Boot iPXEdemo
item --gap Live:
item archiso Archlinux netinstall
item gpartiso Gparted
item --gap Specific:
item shell Enter iPXE shell
item --gap Attach iSCSI:
item w7iscsi Windows 7
item --gap
item exit Exit to loadchain
choose --default linux --timeout 10000 target && goto ${target}

:w7boot
set keep-san 1
sanboot iscsi:172.16.93.1::::iqn.2012-07.com.example:station
exit

:linux
set keep-san 1
sanboot iscsi:172.16.93.1::::iqn.2012-07.com.example:linux
exit

:shell
shell
exit

:w7iscsi
sanhook iscsi:172.16.93.1::::iqn.2012-07.com.example:station
goto mainmenu

:demo
chain http://boot.ipxe.org/demo/boot.php
exit

:archiso
set keep-san 1
sanboot iscsi:172.16.93.1::::iqn.2012-07.com.example:archiso
exit

:gpartiso
set keep-san 1
sanboot iscsi:172.16.93.1::::iqn.2012-07.com.example:gpartiso
exit

:exit
exit



iqn.2012-07.com.example:gpartiso задается вручную в конфиге iscsitarget, переходим к нему:
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
iSNSServer 172.16.93.1
iSNSAccessControl No

IncomingUser
OutgoingUser

Target iqn.2012-07.com.example:station
IncomingUser
OutgoingUser
Lun 0 Path=/dev/sdb9,Type=blockio
Alias LUN1
Wthreads 8
QueuedCommands 32
MaxSessions 0
DataDigest None,CRC32C
HeaderDigest None,CRC32C
ErrorRecoveryLevel 0
DataSequenceInOrder Yes
DefaultTime2Wait 2
#FirstBurstLength 65536
#MaxBurstLength 262144
MaxXmitDataSegmentLength 65536
MaxRecvDataSegmentLength 65536
ImmediateData Yes
InitialR2T Yes
MaxConnections 1

Target iqn.2012-07.com.example:archiso
IncomingUser
OutgoingUser
Lun 0 Path=/mnt/ft_1/archlinux.iso,Type=fileio
Alias LUN1
Wthreads 8
QueuedCommands 32
MaxSessions 0
DataDigest None,CRC32C
HeaderDigest None,CRC32C
ErrorRecoveryLevel 0
DataSequenceInOrder Yes
DefaultTime2Wait 2
#FirstBurstLength 65536
#MaxBurstLength 262144
MaxXmitDataSegmentLength 65536
MaxRecvDataSegmentLength 65536
ImmediateData Yes
InitialR2T Yes
MaxConnections 1

Target iqn.2012-07.com.example:gpartiso
IncomingUser
OutgoingUser
Lun 0 Path=/mnt/ft_1/gparted.iso,Type=fileio
Alias LUN1
Wthreads 8
QueuedCommands 32
MaxSessions 0
DataDigest None,CRC32C
HeaderDigest None,CRC32C
ErrorRecoveryLevel 0
DataSequenceInOrder Yes
DefaultTime2Wait 2
#FirstBurstLength 65536
#MaxBurstLength 262144
MaxXmitDataSegmentLength 65536
MaxRecvDataSegmentLength 65536
ImmediateData Yes
InitialR2T Yes
MaxConnections 1

Target iqn.2012-07.com.example:linux
IncomingUser
OutgoingUser
Lun 0 Path=/mnt/fla/network_linux.img,Type=fileio
Alias LUN1
Wthreads 4
QueuedCommands 16
MaxSessions 0
DataDigest None,CRC32C
HeaderDigest None,CRC32C
ErrorRecoveryLevel 0
DataSequenceInOrder Yes
#DefaultTime2Wait 2
#FirstBurstLength 65536
#MaxBurstLength 262144
MaxXmitDataSegmentLength 65536
MaxRecvDataSegmentLength 65536
ImmediateData Yes
InitialR2T Yes
MaxConnections 1



И теперь осталось дело за малым - заинсталлить на образ/раздел операционки. В арче этот вопрос освещен в вики, проблем возникнуть не должно. А вот с виндой да, проблема, пока так и не поборол.


Тэги: dhcpd iSCSI
+ 2 -
Похожие Поделиться

xoy 15.04.2013 17:42 #
Будь добр, спрячь под кат
cybsol 15.04.2013 18:46 #
Виноват. fixed.