HOME | Linux | Linux Advance | How To PXE server using Linux
How To PXE server using Linux PDF Print

1. make a directory /tftpboot.
2. install tftp-server.
3. copy initrd.img and kernel in this directory.
4. copy /usr/lib/syslinux/pxelinux.0 in /tftpboot directory
5. make  a  directory pxelinux.cfg in /tftpboot directory
6. note your mac-address and create empty file in the following way:
if the mac address is :
00-0C-BE-CE-34-36
than create the file :
01-00-0C-BE-CE-34-36        --1
7. get the hex format of your machine's ip address by using gethostip command
#gethostip my_machine_ip
if the ip is 192.168.0.254
then the hex output will be C0A800FE
8. create the files using touch command in /tftpboot/pxelinux.cfg directory with
respect to your machine's hex ip as following:

/tftpboot/pxelinux.cfg/C0A800FE         --2     
/tftpboot/pxelinux.cfg/C0A800F        --3
/tftpboot/pxelinux.cfg/C0A800        --4
/tftpboot/pxelinux.cfg/C0A80        --5
/tftpboot/pxelinux.cfg/C0A8        --6
/tftpboot/pxelinux.cfg/C0A        --7
/tftpboot/pxelinux.cfg/C0        --8
/tftpboot/pxelinux.cfg/C            --9
/tftpboot/pxelinux.cfg/default        --10

put all these 1--10 files in /tftpboot/pxelinux.cfg directory
NOTE: execute the command chmod -R 777 /tftpboot/
to provide full permission
9. edit the /tftpboot/pxelinux.cfg/default file and add the following lines

prompt linux
default linux
timeout 1000

label linux
kernel vmlinuz
append initrd=initrd.img

10. edit /etc/xinet.d/tftp file and change the following lines:
disable = yes              -to-     disable = no
server_args = -s /tftpboot         -to-     server_args = /tftpboot

11. your tftp server is now ready now you have to setup your dhcp server, just edit the /etc/dhcp.conf file and add the following files

ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;

subnet 192.168.0.0 netmask 255.255.255.0 {

#    default gateway            192.168.0.254;
option routers            192.168.0.254;
option subnet-mask            255.255.255.0;

#    option nis-domain        "domain.org";
option domain-name        "example.com";
option domain-name-servers    192.168.0.254;

option time-offset        -18000;    # Eastern Standard Time
#    option ntp-servers        192.168.1.1;
#    option netbios-name-servers    192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#    option netbios-node-type 2;

range dynamic-bootp 192.168.0.1 192.168.0.20;
default-lease-time 21600;
max-lease-time 43200;
filename "pxelinux.0";
next-server 192.168.0.254;         

# we want the nameserver to appear at a fixed address
#    host ns {
#        next-server marvin.redhat.com;
#        hardware ethernet 12:34:56:78:AB:CD;
#        fixed-address 207.175.42.254;
#    }
}

11. exectute the following commands:
service    dhcpd     start
service    xinetd    start