1.环境准备
1.1 安装CentOS5
除一般系统组件以外,必须安装:
TFTP,
DHCPD,
开发工具包
可选安装:
httpd
1.2 下载软件
gpxe-0.9.7.tar.gz 地址: http://kernel.org/pub/software/utils/boot/gpxe/gpxe-0.9.7.tar.gzsyslinux-3.81.tar.gz 地址: http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.81.tar.gz
iscsitarget-1.4.18.tar.gz 地址: http://sourceforge.net/projects/iscsitarget/files/iscsitarget/1.4.18/iscsitarget-1.4.18.tar.gz/download
1.3环境假设
服务器的IP地址为192.168.1.1
2.安装软件
用root帐号登录系统运行以下命令:
cp gpxe-0.9.7.tar.gz /usr/local/src
cp syslinux-3.81.tar.gz /usr/local/src
cp iscsitarget-1.4.18.tar.gz /usr/local/src
cd /usr/local/src
tar -zxvf gpxe-0.9.7.tar.gz
tar -zxvf syslinux-3.81.tar.gz
tar -zxvf iscsitarget-1.4.18.tar.gz
cd /usr/local/src/gpxe-0.9.7/src
make bin/undionly.kpxe
cd /usr/local/src/syslinux-3.81/com32/menu/
ls menu.c32
cd /usr/local/src/iscsitarget-1.4.18/
make
make install
3.配置
3.1 IET配置
vi /etc/ietd.conf
#添加如下信息
Target iqn.2007-08.name.dns.target.my:iscsiboot
Lun 0 Path=/path/to/image/file.img,Type=fileio
service iscsi-target start
3.2 DHCPD配置
vi /etc/dhcpd.conf
#修改成以下内容
allow booting;
allow bootp;
ddns-update-style none;
log-facility local7;
default-lease-time -1;
max-lease-time 7200;
authoritative;
option space gpxe;
option gpxe-encap-opts code 175 = encapsulate gpxe;
option gpxe.bus-id code 177 = string;
subnet 192.168.1.0 netmask 255.255.255.0 {
use-host-decl-names on;
range 192.168.1.26 192.168.1.30;
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
option root-path "192.168.1.1:/home/tftpboot/";
next-server 192.168.1.1;
if not exists gpxe.bus-id {
filename "gpxe/undionly.kpxe";
} else {
# filename " http://192.168.1.1/boot/boot.php";
filename "gpxe/menu.gpxe";
}
server-name "lapdance";
server-identifier 192.168.1.1; }
3.3 TFTP配置
cd /etc/inetd.d
vi tftp
#修改为以下配置
no code
service inetd restart
mkdir /tftpboot/gpxe
cd /tftpboot/gpxe
cp /usr/local/src/gpxe-0.9.7/src/bin/undionly.kpxe /tftpboot/gpxe/
cp /usr/loca/src/syslinux-3.81/com32/menu/menu.c32 /tftp/boot/gpxe/
touch menu.gpxe
vi menu.gpxe
#插入以下内容
#!gpxe chain
#menu.c32 menu.cfg
sanboot iscsi:192.168.1.1::::iqn.2007-08.name.dns.target.my:iscsiboot
4.客户端
1.找一台机子挂上硬盘安装windowsXP,主分区建议小于4个G
2.安装XP系统后安装Microsoft iSCSI Software Initiator
下载地址:http://download.microsoft.com/download/C/0/3/C0326CE2-51D0-4E1C-A9E0-7E16BE79410B/CHK-Boot/Initiator-2.08-boot-build3825-x86chk.exe
3.安装sanboot补丁
下载地址:
4.将装XP的磁盘从客户机上拆下来挂到服务器上,制作img磁盘文件
#查看磁盘信息
fdisk -l /dev/sdX
#显示如下
Disk /dev/sdX: 80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdX1 * 1 1825 14659281 7 HPFS/NT
5.生成文件命令(注意bs与count的值与上面信息的对应关系)
dd if=/dev/sdX of=/path/to/image/file.img bs=8225280 count=1825
文章出处:DIY部落( http://www.diybl.com/course/6_system/linux/Linuxjs/20091017/179205.html)