Thursday, September 28, 2023

tinycore15 share internet add pxeserver support

 tce-load -wi dnsmaq

 tce-load -wi ipv6-netfilter-6.6.8-tinycore

 tce-load -wi iptables


/opt/bootlocal.sh

#!/bin/sh

# put other system startup commands here

/opt/eth1.sh &

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE &

sudo iptables -A FORWARD -i eth1 -j ACCEPT &

sudo dnsmasq &

sudo sysctl -w net.ipv4.ip_forward=1 &

         sudo crond &


/opt/eth1.sh

#!/bin/sh


# If you are booting Tiny Core from a very fast storage such as SSD / NVMe Drive and getting 

# "ifconfig: SIOCSIFADDR: No such Device" or "route: SIOCADDRT: Network is unreachable"

# error during system boot, use this sleep statemet, otherwise you can remove it -

sleep 1


# kill dhcp client for eth1

sleep 1

if [ -f /var/run/udhcpc.eth1.pid ]; then

sudo kill `cat /var/run/udhcpc.eth1.pid`

sleep 1

fi


# configure interface eth1

ifconfig eth1 192.168.137.1 netmask 255.255.255.0 broadcast 192.168.137.255 up


# Start the DHCP Server Process once the Interface is Ready with the IP Add

sleep 1

sudo udhcpd /etc/eth1_udhcpd.conf &

         sudo udpdvd -E 0 69 tftpd /netboot 

 

/etc/eth1_udhcpd.conf

max_leases 101

lease_file /opt/udhcpd.leases

start 192.168.137.100

end 192.168.137.200

interface eth1

         boot_file /pxelinux.0

         option tftp 192.168.137.1 

option subnet 255.255.255.0

option router 192.168.137.1

option lease 43200

option dns 192.168.137.1

option domain local

 

/opt/.filetool.lst

opt

home

         /netboot 

/etc/eth1_udhcpd.conf

        /var/spool/crond/crontabs/root 

/var/spool/crond/crontabs/root 

    SHELL=/bin/sh

    15 22 * * * /sbin/reboot > /tmp/reboot.log 2>&1

After

    filetool.sh -b

PXE server

    mkdir -p /netboot/pxelinux.cfg

    /netboot/tc/core.gz

    /netboot/tc/vmlinz

    /netboot/pxelinux.0      --> from sysliux

/netboot/pxelinux.cfg/default

    DEFAULT core

    TIMEOUT 300

    

    LABEL core

        KERNEL /tc/vmlinuz

        APPEND quiet initrd=/tc/core.gz

ln -s /netboot/pxelinux.0 /netboot/pxelinux.0     --> bug busybox udhcpd


how to update 14->15

/mnt/sda1/boot
replace core.gz and vmlinuz
tce-update