Sunday, September 25, 2016

boot kali linux over network

*** setup information ***
server ip address: 192.168.202.1
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
ONTIMEOUT local
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=192.168.202.1:/home/user1/kalitftp/kali
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
http://www.atechnote.com/2016/01/configure-nfs-server-on-ubuntu.html

and add the following  rule to /etc/exports and restart nfs service
/home/user1/kalitftp/kali    192.168.202.0/24(rw,no_root_squash,async,insecure)

7- create bash script file to start our tftp and dhcp so we name it as dnsmasq-tftp.sh with content below
#/bin/bash
ifconfig vmnet2 192.168.202.1 up
dnsmasq -i vmnet2 --dhcp-range=192.168.202.100,192.168.202.200 \
    --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 dnsmasq-tftp.sh

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


No comments:

Post a Comment