Sunday, September 25, 2016

boot kali linux over network

*** setup information ***
server ip address:
user: user1
run services: tftp, dhcp, nfs

1- install necessary packages
$ sudo apt-get install pxelinux syslinux dnsmasq

2- create a directory to store all data
$ mkdir ~/kalitftp && cd ~/kalitftp

3- copy necessary files to our directory,
$ cp /usr/lib/PXELINUX/pxelinux.0 ~/kalitftp
$ cp /usr/lib/syslinux/modules/bios/*.c32 ~/kalitftp

4- update boot menu
$ mkdir pxelinux.cfg

- create file ~/kalitftp/pxelinux.cfg/default with the following content

default menu.c32
prompt 0
timeout 300
menu title ########## PXE Boot Menu ##########
label 1
menu label ^1) kila live from tftp + nfs
insmod part_msdos
insmod ext2
kernel kali/live/vmlinuz boot=live config boot=live username=root hostname=kali boot=live username=root hostname=kali
append root=/dev/nfs initrd=kali/live/initrd.img nfsroot=
menu label ^2) kila live from tftp + nfs

5- create kali directory inside ~/kalitftp and mount kali iso to the directory
$ mdkir ~/kalitftp/kali
$ sudo mount kali-linux-2016.2-amd64.iso ~/kalitftp/kali

6- setup nfs following below on how to setup nfs server

and add the following  rule to /etc/exports and restart nfs service

7- create bash script file to start our tftp and dhcp so we name it as with content below
ifconfig vmnet2 up
dnsmasq -i vmnet2 --dhcp-range=, \
    --dhcp-boot=pxelinux.0 \
    --enable-tftp --tftp-root=~/kalitftp -d -p0 -K --log-dhcp --bootp-dynamic

8- finally we run the script with the following command then on client choose to boot from network, and the kali will be booted up
$ sudo sh

- snapshot of kali successfully boot from network with dhcp, tftp and nfs

No comments:

Post a Comment