无盘多系统引导实战及维护

拓扑:

    

无盘多系统引导服务器配置_无盘

二、搭建无盘服务器:

1)安装iscsi,采用源码安装的方式进行安装,具体的版本可以视使用的习惯来决定

 ./configure

 make

 make install

2)iscsi的配置

 vim /etc/iet/ietd.conf

Target iqn.2012-06.com.example:diskless2

        Lun 0 Path=/tftp/win7.img,Type=fileio

Target iqn.2012-06.com.example:diskless3

        Lun 0 Path=/tftp/xp.img,Type=fileio

Target iqn.2012-06.com.example:diskless4

        Lun 0 Path=/tftp/d.img,Type=fileio

其中d.imgwin7无盘中的虚拟D盘(通过此方法可以解决3dmax软件因为硬盘标识符问题导致的无法激活情况)

3)安装tftp服务器

采用yum安装

yum install tftp* (请确保xinetd守护程序也一并安装)

修改配置文件/etc/xinetd.d/tftp

service tftp

{

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = root

        server                  = /usr/sbin/in.tftpd

        server_args             = -s /tftpboot

        disable                 = no

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

4)安装dhcp服务器

yum install dhcp*

修改配置文件/etc/dhcpd.conf

ddns-update-style interim;

ignore client-updates;

allow bootp;

allow booting;

subnet 192.168.3.0 netmask 255.255.255.0 {

        option routers                  192.168.3.1;

        option subnet-mask              255.255.255.0;

        option domain-name-servers      192.168.1.10;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.3.128 192.168.3.254;

        default-lease-time 21600;

        max-lease-time 43200;

        filename        "gpxelinux.0";

        next-server     192.168.3.25;

#       host ns {

#               next-server marvin.redhat.com;

#               hardware ethernet 12:34:56:78:AB:CD;

#               fixed-address 207.175.42.254;

#       }

}

subnet 192.168.2.0 netmask 255.255.255.0 {

        option routers                  192.168.2.1;

        option subnet-mask              255.255.255.0;

        option domain-name-servers      192.168.1.10;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.2.128 192.168.2.254;

        default-lease-time 21600;

        max-lease-time 43200;

        filename        "gpxelinux.0";

        next-server     192.168.3.25;

#       host ns {

#               next-server marvin.redhat.com;

#               hardware ethernet 12:34:56:78:AB:CD;

#               fixed-address 207.175.42.254;

#       }

}

5)tftp的根目录下添加网络引导文件cmd.c32 gpxelinux.0 menu.c32 menu.lst sanboot.c32

上述文件均取自syslinux源码包,请下载3.8以后版本

tftp根目录下建立目录pxelinux.cfg,并在该目录下创建文件default,内容如下:

DEFAULT menu.c32

TIMEOUT 200

PROMPT 0

MENU WIDTH 70

MENU MARGIN 20

MENU TABMSGROW 18

MENU CMDLINEROW 18

MENU ENDROW 24

MENU TIMEOUTROW 20

MENU TITLE FTP FASTST MENU

LABEL ISCSI BOOT 1

MENU LABEL ISCSI XP

kernel sanboot.c32

append iscsi:192.168.3.25::::iqn.2012-06.com.example:diskless3

LABEL ISCSI BOOT 2

MENU LABEL ISCSI WIN7X64

kernel sanboot.c32

append iscsi:192.168.3.25::::iqn.2012-06.com.example:diskless2

LABEL UBUNTU

kernel linux

append initrd=initrd.nfs root=/dev/nfs nfsroot=192.168.3.25:/ubuntu/root ip=dhcp rw

6)安装dhcp中继服务器

yum install dhcp*

修改内核参数允许端口转发

/etc/sysctl.conf

net.ipv4.ip_forward = 1

修改配置文件/etc/sysconfig/dhcrelay

DHCRELAYARGS=""

INTERFACES="eth1 eth2"

DHCPSERVERS="192.168.3.25"

7)无盘工作站模版建立

1winxp模版建立:

winxp唯一需要做的就是要安装sanboot启动的补丁,以及iscsi的发起程序,启动iscsi程序后选择自动登录和多路径选项

2win7模版的建立:

win7自带了iscsi的发起程序,在服务中设置自动启动,唯一不同于xp的是要修改注册表网卡的选项才可以实现无盘

注册表位置为:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0007\Linkage\filterlist

取消掉最后一行保存

8ubuntu无盘

1、服务器端

安装NFS服务yum install nfs portmap

修改配置文件/etc/exports

/ubuntu 192.168.3.0/24(rw,no_root_squash,sync)

/ubuntu 192.168.2.0/24(rw,no_root_squash,sync)

2、客户机端

安装nfs客户端:apt-get install nfs-client

修改配置文件/etc/network/interfaces

auto lo

iface lo inet loopback

auto eht0

iface eth0 inet manual

编译fstab文件把除了proc外的所有都注释掉

编辑udevrules中关于网络借口记录的文件,去掉已经定义了的网络接口,否则无盘启动了有个报错(/etc/udev/rules.d/70-persistent-net.rules)

安装initramfs-tools

apt-get install initramfs-tools

编辑initramfs.confBOOT=LOCAL 改为BOOT=nfs

创建支持nfs的启动文件initrd.img

mkinitramfs -o /abc/initrd.nfs

cp /boot/vmlinuz-2.6.22-14 /abc/linux

将以上两个文件拷贝到服务器端的tftp根下面

8)上传系统镜像到服务器

windows模版可通过dd命令复制:

dd if=/dev/sdb of=/tftp/win7(xp).img bs=8225280 count=3309

至于dd命令相关的具体参数,请参考fdisk -l命令显示的数值

ubuntu模版通过tar命令打包整个系统,解压到服务器的相应目录即可

tar zcvfp /netfs/root/netfs.tgz / --exclude=/sys/* --exclude=/netfs --exclude=mnt/* \--exclude=/lost+found --exclude=/var/cache/* --exclude=/var/tmp/* --exclude=/proc/*

至此,2网段以及3网段的PC已经可以无盘网络引导系统了。

三、无盘服务器维护及软件更新

如果要更新软件windows下可先给服务器端的相关镜像可读写权限然后启动一台机器,进行正常的软件更新,安装。然后再将权限改为只读。

如果要更新ubuntu的环境,只要去服务器端的系统目录直接修改配置文件即可

四、无盘系统的稳定性及可用性调研:

计划采取hearbeat集群实现故障转移,通过LVS进行负载均衡处理,以实现大型网络,在带宽一定的情况下无盘客户端可以较快捷的连接多个服务器去引导系统。