PXE SERVER?

Suggest improvements and new features for Gargoyle.

Moderator: Moderators

Post Reply
whataboutnow
Posts: 34
Joined: Tue Apr 07, 2020 6:29 pm

PXE SERVER?

Post by whataboutnow »

Is it possible to make a plugin or something similar so that I can install distros/iso that are stored on USB connected to the router? Something similar to multiboot so that I can choose which OS I'd like to install on a remote machine?

There are a few guides that show how to do a Linux distro but I can't find any to set up a Windows pxe.

Many thanks 👍

RomanHK
Posts: 719
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: PXE SERVER?

Post by RomanHK »

Maybe this guide will help you:
https://openwrt.org/docs/guide-user/ser ... pxe-server

EDIT: So I tried it and it works. I had to edit the paths and the "default" file, but after editing the Ubuntu Live-CD started. ;)
Turris Omnia with Gargoyle 1.12.0
Linksys WRT3200ACM with Gargoyle 1.12.0
TL-WR1043ND v2 with Gargoyle 1.10.0

http://gargoyle.romanhk.cz custom builds by gargoyle users

whataboutnow
Posts: 34
Joined: Tue Apr 07, 2020 6:29 pm

Re: PXE SERVER?

Post by whataboutnow »

Ah that's good to know :)

Would you be kind enough to show me how to make those edits please?
I figure I'll learn the process using Linux on my way to my ultimate goal of being able to do it with a windows image :)



I'm glad it worked for you, it started in my head as a hmmm, what if?... Idea,
but I think it's got enough legs to keep me busy over the weekend getting it working. I wish I had enough knowledge to be able to write it as a plugin but I have to start somewhere I guess 😁👍

RomanHK
Posts: 719
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: PXE SERVER?

Post by RomanHK »

Step by step - I used a VM with Gargoyle 1.13.x

1. First, we will run the USB storage (if we haven't done so in the past) in Gargoyle format so that we get the path eg /tmp/usb_mount/dev_sdb (sdb1)
Image

2. Prepare files for PXE-Booting
https://openwrt.org/docs/guide-user/ser ... xe-booting

Code: Select all

cd /tmp/usb_mount/dev_sdb1
mkdir tftp tftp/pxelinux.cfg tftp/disks tftp/disks/ubuntu1604-64
mkdir /tmp/usb_mount/dev_sdb1/syslinux-download
cd /tmp/usb_mount/dev_sdb1/syslinux-download
wget --no-check-certificate https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.gz
gzip -df syslinux-6.03.tar.gz
tar -xf syslinux-6.03.tar
cd /tmp/usb_mount/dev_sdb1/syslinux-download/syslinux-6.03/bios
cp core/pxelinux.0 com32/elflink/ldlinux/ldlinux.c32 com32/menu/vesamenu.c32 com32/lib/libcom32.c32 com32/libutil/libutil.c32 /tmp/usb_mount/dev_sdb1/tftp
touch /tmp/usb_mount/dev_sdb1/tftp/pxelinux.cfg/default
3. We will insert the information into the file /tmp/usb_mount/dev_sdb1/tftp/pxelinux.cfg/default

Code: Select all

DEFAULT vesamenu.c32
PROMPT 0
MENU TITLE OpenWrt PXE-Boot Menu

label Ubuntu
		MENU LABEL Ubuntu Live 16.04 64-Bit
		KERNEL disks/ubuntu1604-64/casper/vmlinuz
		APPEND boot=casper ide=nodma netboot=nfs nfsroot=192.168.1.1:/tmp/usb_mount/dev_sdb1/tftp/disks/ubuntu1604-64/ initrd=disks/ubuntu1604-64/casper/initrd
		TEXT HELP
				Starts the Ubuntu Live-CD - Version 16.04 64-Bit
		ENDTEXT
4. Download and expand (eg using 7zip) *.iso file: https://releases.ubuntu.com/16.04/ubunt ... -amd64.iso which we then copy (already unpacked) to USB in the folder /tmp/usb_mount/dev_sdb1/tftp/disks/ubuntu1604-64

5. Enable TFTP and NFS Service
https://openwrt.org/docs/guide-user/ser ... fs_service

Code: Select all

uci set dhcp.@dnsmasq[0].enable_tftp='1'
uci set dhcp.@dnsmasq[0].tftp_root='/tmp/usb_mount/dev_sdb1/tftp'
uci set dhcp.linux='boot'
uci set dhcp.@boot[0].filename='pxelinux.0'
uci set dhcp.@boot[0].serveraddress='192.168.1.1'
uci set dhcp.@boot[0].servername='OpenWrt'
uci set dhcp.@boot[0].force='1'
uci add_list dhcp.@boot[0].dhcp_option='209,pxelinux.cfg/default'
uci commit dhcp
6. Now enable NFS share:
Image

7. Testing it out
https://openwrt.org/docs/guide-user/ser ... ing_it_out


I don't know how it is in the case of Windows, but it will definitely be similar - you have to figure it out yourself or someone else can advise.

Good luck... ;)
Turris Omnia with Gargoyle 1.12.0
Linksys WRT3200ACM with Gargoyle 1.12.0
TL-WR1043ND v2 with Gargoyle 1.10.0

http://gargoyle.romanhk.cz custom builds by gargoyle users

whataboutnow
Posts: 34
Joined: Tue Apr 07, 2020 6:29 pm

Re: PXE SERVER?

Post by whataboutnow »

Lush, thanks for the effort you have gone to in your reply - very much appreciated, I'll get back to you with results :)

I have learned a lot about pxe in the last week or so - I currently have a pxe server running on my nas hosting various system images, next step is to move that to the router👍

Post Reply