Friday, June 5, 2009

LiveCD PXE Network Boot

LiveCD Network Boot (pxe boot)

Server Side:
In case you are using VirtualBox, make sure you set the network to internal network.

On Server (Fedora 10):

turn off selinux
method 1: from GUI and reboot
method 2: $ sudo vi /etc/selinux/config
edit --> SELINUX=disabled
save and reboot

turn off firewall
method 1: from GUI (need to click apply button)
method 2: $ sudo iptables -F

configure the IP for NIC (assumption NIC to be configured is eth0):
method 1:use GUI and set the ip to 192.168.0.15 for eth0
method 2:
$ sudo ifconfig eth0 down
$ sudo ifconfig eth0 192.168.0.15 netmask 255.255.255.0 up


mount kubuntu to /mnt/kubuntu
method 1: mount kubuntu_desktop_9.04.iso to /mnt/kubuntu folder
$ sudo mount -o loop kubuntu_desktop_9.04.iso to /mnt/kubuntu
method 2: mount cdrom to /mnt/kubuntu
$ sudo mount /dev/sr0 /mnt/kubuntu

install syslinux:
method 1: from GUI install syslinux package
method 2: $ sudo yum install syslinux

install tftp server:
method 1: from GUI install tftp-server package
method 2: $ sudo yum install tftp-server

add necessary files for network boot in tftp share folder:
$ sudo mkdir -p /var/lib/tftpboot/livecd/pxelinux.cfg
$ sudoe cp -p /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/livecd/
$ sudo cp -p /mnt/kubuntu/casper/vmlinuz /var/lib/tftpboot/livecd/
$ sudo cp -p /mnt/kubuntu/casper/initrd.gz /var/lib/tftpboot/livecd/
$ sudo vi /var/lib/tftpboot/livecd/pxelinux.cfg/default
add the following lines to the file:
############## start of pxe default ##############
default kubuntu
timeout 30

label kubuntu
kernel vmlinuz
append boot=casper netboot=nfs nfsroot=192.168.0.15:/mnt/kubuntu initrd=initrd.gz --
############## end of pxe default ##############

activate tftp server:
$ sudo chkconfig tftp on

restart xinetd:
method 1: from GUI
method 2: $ sudo service xinetd restart

install dhcp server:
method 1: from GUI install dhcp package
method 2: $ sudo yum install dhcp

configure dhcp server:
$ sudo vi /etc/dhcpd.conf

replace the content with:
############## start of dhcpd.conf ##############
allow booting;
allow bootp;
ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
range dynamic-bootp 192.168.0.200 192.168.0.240;
next-server 192.168.0.15;
filename "livecd/pxelinux.0";
}
############## end of dhcpd.conf ##############

restart dhcp server:
method 1: from GUI
method 2: $ sudo service dhcpd restart
method 3: if you have more than one NICs, and you want to use dhcp only for eth1 perform the following,
$ sudo dhcpd -d eth1

install nfs server:
method 1: from GUI install nfs-utils package
method 2: $ sudo yum install nfs-utils

configure nfs server:
$ method vi /etc/exports
add the following line:
############## start of /etc/exports ##############
mnt/kubuntu 192.168.0.0/255.255.255.0(async,no_root_squash,no_subtree_check,ro)
############## end of /etc/exports ##############

restart nfs server:
method 1: from GUI
method 2: $ sudo service nfs restart

check nfs export:
$ sudo showmount -e 192.168.0.15


Client Side:
In case you are using VirtualBox, make sure you set the network to internal network.
Set BIOS boot option to PXE Network Boot
Boot the computer

You should be able to see the client PC getting DCHP and loading the LiveCD from network.

No comments:

Post a Comment