Android-PXEBoot
Android-PXEBoot copied to clipboard
Does not launch on newer phones
I have been looking for an Android ProxyDHCP PXE boot app, and intended to use this today. Unfortunately, on my Pixel 2 XL with Android 9, I can't get the app to launch.
Could this be updated for more modern phones?
This was a pain for me to get working on my S9+. I had to use root+termux shell, wrote a bash script that would manually enable rndis mode, setup Iptables rules, a dhcp server, tftp and nfs server. Finally I had to build a customized iPXE bootloader with only drivers for USB+RNDIS. I ended up having to create a disk image to store all the files for the boot server cause the TFTP server couldn't access anything other than an image.
@BiatuAutMiahn Are you saying that you managed to get a ProxyDHCP setup running using the things you mentioned? It sounds like you simply created a DHCP server, which does me no good. I need to use ProxyDHCP because there is an existing DHCP server on the network.
My objective was to create a PXE Boot Server via USB RNDIS as a workaround to DriveDroid. But the DHCP server I used could be used to create a ProxyDHCP if I'm not mistaken. Let me look into this.
If you can verify that Android-PXEBoot is starting the server and its listening to requests on localhost, then it should just be iptables rules that need to be configured to allow the LAN to see the ProxyDHCP
#!/system/bin/sh
# Set USB Mode to RNDIS (Ethernet Gadget/Tethering)
setprop sys.usb.config 'rndis,adb'
# Wait for mode switch
sleep 5
# Setup rndis interface
ip addr flush dev rndis0
ip addr add 10.26.2.1/24 dev rndis0
ip link set rndis0 up
ip rule add from all lookup main
# Enable forwarding and configure iptables for client internet access and LAN
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -I POSTROUTING 1 -o rmnet0 -j MASQUERADE
iptables -A FORWARD -j ACCEPT -i rndis0 -o rmnet0
iptables -A FORWARD -j ACCEPT -i rmnet0 -o rndis0
iptables -t nat -A POSTROUTING -o rmnet0 -j MASQUERADE
iptables -R natctrl_FORWARD 1 -j ACCEPT
# Initialize tftp directory
mkdir -p /cache/tftproot
chmod -Rf 777 /cache/tftproot
mount -o rw /sdcard/pxeserver/boot.img /cache/tftproot
# Start the services
trmx=/data/data/com.termux/files/usr
$trmx/bin/httpd -f /cache/tftproot/apache.conf -d /cache/tftproot
$trmx/bin/applets/tcpsvd -vE 0.0.0.0 2121 $trmx/bin/applets/ftpd -w /cache/tftproot &
$trmx/bin/dnsmasq --pid-file=/cache/usb_tether_dnsmasq.pid --interface=rndis0 --bind-interfaces --enable-tftp --dhcp-vendorclass=BIOS,PXEClient:Arch:00000 --dhcp-vendorclass=UEFI32,PXEClient:Arch:00006 --dhcp-vendorclass=UEFI,PXEClient:Arch:00007 --dhcp-vendorclass=UEFI64,PXEClient:Arch:00009 --dhcp-boot=net:UEFI32,bootia32.efi --dhcp-boot=net:UEFI,bootx64.efi --dhcp-boot=net:UEFI64,bootx64.efi --dhcp-boot=pxelinux.0 --tftp-root=/cache/tftproot --bogus-priv --filterwin2k --no-resolv --domain-needed --server=8.8.8.8 --server=8.8.4.4 --cache-size=1000 --dhcp-range=10.26.2.2,10.26.2.254,255.255.255.0,10.26.2.255 --dhcp-lease-max=253 --dhcp-authoritative --dhcp-leasefile=/cache/usb_tether_dnsmasq.leases --no-daemon --tftp-no-blocksize
This is my pxeinit.sh, most of these apps are using either busybox or packages from Termux
https://wiki.fogproject.org/wiki/index.php?title=ProxyDHCP_with_dnsmasq
Add this to dnsmasq config
dhcp-range=<server_ip>,proxy
in the case of my script I think this should do...
--dhcp-range=10.26.2.2,10.26.2.254,255.255.255.0,10.26.2.255 > --dhcp-range=10.26.2.2,10.26.2.254,255.255.255.0,10.26.2.255,proxy
PS: due to how slow tftp transfers are I use httpd/apache to serve boot files
It appears that the script changes settings related to the USB connection, causing the phone to act as a network device. Is this necessary to set up ProxyDHCP over WiFi? I do not intend to connect the phone to a single computer through USB, but rather connect the phone to the wireless network in order to PXE boot any machines on that network.
I understand your intentions, simply omit the following lines of my script related to USB:
# Set USB Mode to RNDIS (Ethernet Gadget/Tethering)
setprop sys.usb.config 'rndis,adb'
# Wait for mode switch
sleep 5
# Setup rndis interface
ip addr flush dev rndis0
ip addr add 10.26.2.1/24 dev rndis0
ip link set rndis0 up
ip rule add from all lookup main
You will still need to allow traffic via iptables:
# Enable forwarding and configure iptables for clients to access the DHCP
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -R natctrl_FORWARD 1 -j ACCEPT
If you would like, you can contact me via Discord https://discord.gg/kxHEGV I can help you further there. This link will expire in 24hr