Tiny Core Linux

Tiny Core Extensions => TCE Talk => Topic started by: amonel on January 05, 2017, 06:15:27 PM

Title: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 05, 2017, 06:15:27 PM
Hi there.

I am thinking of using  Tiny Core, as DHCP server and client DHCP.

Is have an example config file by chance?

THX.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 05, 2017, 06:33:36 PM
Hi,
busybox'  udhcpd  is part of base.

For a sample config file, see: https://udhcp.busybox.net/udhcpd.conf
Goes to  /etc/udhcpd.conf .

Remember to add this file to  /opt/.filetool.lst  and do a backup.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: patrikg on January 06, 2017, 04:18:42 AM
dnsmasq Can also be used for a very little dhcp server.

And dnsmasq can be run in foreground for testing.
And when done with correct config, just save the parameters and run as daemon.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 07, 2017, 02:25:03 AM
Hi,
Thank you for your answers,
I saw that it was possible with dsnmasq, someone would have an example file by chance ???
Thanks
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 09, 2017, 09:38:48 AM
Hi there

Despite that I can not seem to recover an ip address on the extensions.
this is my configuration:
tc@box:$ sudo vi /usr/local/etc/dnsmasq.conf

bogus-priv
filterwin2k
no-poll
interface=eth0
domain=xxxx.com
dhcp-authoritative
dhcp-leasefile=/tmp/dhcp.leases
dhcp-option=3,192.168.1.1
dhcp-option=19,8.8.8.8
dhcp-range=192.168.4.10,192.168.4.200,255.255.255.0,12h
dhcp-host=@mac,192.168.1.11
dhcp-host=@mac,192.168.1.2

:wq

tc@box:$ sudo vi /opt/filetool.lst
/usr/local/etc/dnsmasq.conf

:wq

tc@box:$ sudo filetool.sh -b

tc@box:$ sudo reboot

It doesn't work
I am very new to tiny core.
Could someone help me?
thanks
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 09, 2017, 10:04:35 AM
For entries in  /opt/.filetool.lst  the leading "/" must be omitted.
i.e.:
Code: [Select]
usr/local/etc/dnsmasq.conf
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 09, 2017, 10:24:03 AM
Hi,

sudo vi /opt/.filetool.lst

opt/eth0.sh
opt/eth1.sh
usr/local/etc/dnsmasq.conf
etc/hostname

It doesn't work
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 09, 2017, 10:30:01 AM
Note that hostname is set in  /opt/bootsync.sh .
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 09, 2017, 10:31:23 AM
BTW,  sudo  shouldn't be needed for  filetool.sh .
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 09, 2017, 11:50:20 AM
Hi,
It still doesn't work,
Thanks,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 09, 2017, 11:57:47 AM
I have this

ls /opt/bootsync.sh
/opt/bootsync.sh

is it ok????
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 09, 2017, 12:01:59 PM
sudo vi /opt/bootsync.sh

/usr/bin/sethostname box
/opt/bootlocal.sh &
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 09, 2017, 12:40:36 PM
From  http://tinycorelinux.net/7.x/x86/tcz/dnsmasq.tcz.info
Code: [Select]
[...]
Example config file located at /usr/local/etc/dnsmasq.conf.example
dnsmask defaults to /etc/dnsmask.conf. To override the default, use:
dnsmasq --conf-file=/usr/local/etc/dnsmasq.conf
[...]
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: patrikg on January 09, 2017, 01:12:36 PM
I will also mention that use
Code: (bash) [Select]
filetool.sh -bv to see verbose what files being backed up.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 09, 2017, 02:32:48 PM
Hi,

filetool.sh -bv

home/tc/.xsession
home/tc/.setbackground
home/tc/.Xdefaults
home/tc/.wbar
home/tc/.local/
home/tc/.local/bin/
home/tc/.X.d/
home/tc/.fltk/
home/tc/.fltk/fltk.org/
home/tc/.fltk/fltk.org/filechooser.prefs
opt/
opt/.filetool.lst
opt/tcemirror
opt/filetool.lst
opt/eth0.sh
opt/eth1.sh
opt/backgrounds/
opt/bootsync.sh
opt/.xfiletool.sh
opt/shutdown.sh
opt/bootlocal.sh
gzip: short write
Done
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: patrikg on January 09, 2017, 02:59:37 PM
You may see: gzip: short write... at the end of this.
Do you have enough disc space ??
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 09, 2017, 03:33:49 PM
Yes, what should I do
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 09, 2017, 03:35:08 PM
Yes I have, what should I do??????
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 02:36:14 AM
Hello
How i do to solve the gzip problem,
I also have an error message:
Tce is not writable
Could someone help me?
Thanks,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 02:37:42 AM
Fatal Error:TCE directory is no writable
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Juanito on January 11, 2017, 03:04:19 AM
The fact that you get this:
Code: [Select]
$ filetool.sh -bv

home/tc/.xsession
home/tc/.setbackground
...
opt/shutdown.sh
opt/bootlocal.sh
gzip: short write
Done

..would seem to indicate that you were able to write some of your backup to your /tce folder, but then the partition became full.

Unless you deleted some files or increased the partion size on which your /tce folder resides, the partition will still be full, which might then explain the "Fatal Error:TCE directory is not writable" message.

This should show how much free space you have:
Code: [Select]
$ df -h /dev/sda1..where you need to substitute "sda1" with the name of the device you are using.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 10:44:50 AM
I have another problem,
I reinstall tiny core but when I create a file with the command:

Sudo touch /usr/local/etc/dnsmasq.conf

After rebooting, I lose the dnsmasq.conf file I created.
It can come from what?

Someone can help me?
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: coreplayer2 on January 11, 2017, 10:58:57 AM
I have another problem,
I reinstall tiny core but when I create a file with the command:

Sudo touch /usr/local/etc/dnsmasq.conf

After rebooting, I lose the dnsmasq.conf file I created.
It can come from what?

Someone can help me?
Seems like same issue as earlier, You will need to add " usr/local/etc/dnsmasq.conf " to /opt/filetool.lst  then make a backup
otherwise the file will be missing on reboot.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 11:17:10 AM
Hi,

I just do this but I still lose the file at startup,

Cat /opt/filetool.lst
Usr / local / etc / dnsmasq.conf

further
Ls -l / usr / local / etc /
I can't find my  file  dnsmasq.conf

It can come from what?
Please

thanks,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 11:33:25 AM
Hi,
When I put it in
/opt/.filetool.lst

After reboot,
I find my file, now I hope I will run this dnsmasq,
thanks,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 11, 2017, 11:40:14 AM
From  http://tinycorelinux.net/7.x/x86/tcz/dnsmasq.tcz.info
Code: [Select]
[...]
Example config file located at /usr/local/etc/dnsmasq.conf.example
dnsmask defaults to /etc/dnsmask.conf. To override the default, use:
dnsmasq --conf-file=/usr/local/etc/dnsmasq.conf
[...]
To prevent further errors, read the info files of extensions carefully (via tce-ab and/or Apps GUI), too.
i.e.
Quote
[...] defaults to /etc/dnsmask.conf. [...]"
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 11:56:00 AM
Hi,
thanks,
I see the doc,
Is what you have a sample configuration already test ???
It will allow me to see my mistakes ???
thanks,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 02:41:46 PM
Hi,
At what level can I find the dnsmasq leases in tiny core to configure my dhcp ??
someone can help me???
Thanks
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 02:57:07 PM
Hi,

In the sample file dnsmasq.conf.example
I have the line dhcp-leasefile = /var/lib/misc/dnsmasq.leases

I do not find the file /misc/
Is it possible to bypass it?
Is there another alternative ??

I assume that dnsmasq.leases can be created

Thanks for helping me.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 11, 2017, 03:10:14 PM
Maybe the directory  /var/lib/misc/  needs to be created (it doesn't exist by default) so that  dnsmasq  can create files there?
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 11, 2017, 03:19:37 PM
thanks,
I will see if dnsmasq will create it but for dnsmasq.leases, I have to create it ???
thanks again,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 12, 2017, 06:42:03 AM
Good morning,
I have a question, when I configure an ip address with
Ifconfig 192.168.99.14 netmask 255.255.255.0 gw 192.68.99.1


After reboot,
I lose my configuration.

What can cause this?

On Tiny core,
I can not get this command:
Sudo service dnsmasq restart ?????

someone can help me please???.

Thank you,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 12, 2017, 07:15:57 AM
Hi,
In Tiny Core,
Is there some other way to execute the network setup that is in /etc/network/interfaces?or /etc/networking restart????

Thanks for helping me.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 12, 2017, 07:27:03 AM
The cause is the nature of Tiny Core.
You really should read the Core book.
http://tinycorelinux.net/corebook.pdf

If the connection has been configured via  network  tool, then a script with the name of the interface (e.g. eth0.sh) is stored in  /opt  and a respective entry is written to  /opt/bootlocal.sh  (so it's started at boot).

As always, refreshing the backup is needed in order to survive reboots.
The directory  /opt  is configured to be included in the backup by default.

If you have created the connection manually, directly in the console via commands, then there is nothing to be saved.
If you have created a script to start your connection, then you have to add this script to your backup manually (except for files in /opt) and create a respective entry, for example in  /opt/bootlocal.sh , if you want it to be started at boot.

Services are managed differently on Core:
Code: [Select]
sudo /usr/local/etc/init.d/dnsmasq restart
For most services, you can also use the  services  tool.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 13, 2017, 01:45:53 PM
Hi there,
I have a problem,
When I put information in
/opt/resolv.conf
/ Etc / hosts

After reboot,
I dont find this information,

someone Could  help me?

thanks
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 13, 2017, 02:14:08 PM
/etc/hosts  is recreated at boot to include the hostname.
You could add something like this to  /opt/bootsync.sh
Code: [Select]
cat /path/to/your-custom-hosts-file >> /etc/hosts &
just below
Code: [Select]
/usr/bin/sethostname box
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 13, 2017, 02:28:08 PM
Hi,
I didn't understand,
Please,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 13, 2017, 02:33:58 PM
Maybe I misunderstood you.
I thought you have edited  /etc/hosts , added it to  /opt/.filetool.lst  and made a backup but your edits were gone after reboot.
If that's correct, then I don't know how to give better instructions.
Otherwise, please rephrase your question.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 13, 2017, 02:44:01 PM
I dit this,
But i lose my data after reboot
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 13, 2017, 05:57:30 PM
Here is my configuration:

cat /opt/bootsync.ch
/etc/hosts
/usr/bin/sethostname box
/etc/resolv.conf


cat /etc/hosts
127.0.0.1  localhost
@ip        name1.domain.com
@ip        name2.domain.com


cat /etc/resolv.conf
domain    domain.com
search    domain.com

cat /opt/eth0.sh
echo nameserver @ip > /etc/resolv.conf
echo nameserver @ip >> /etc/resolv.conf
I lose this after reboot

cat /etc/hosts
@ip        name1.domain.com
@ip        name2.domain.com

cat /etc/resolv.conf
domain    domain.com
search    domain.com

cat /opt/eth0.sh
echo nameserver @ip > /etc/resolv.conf
echo nameserver @ip >> /etc/resolv.conf

I try to understand why I lose my configuration, that's my question or my questions????

Thanks for help
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 14, 2017, 04:51:17 PM
cat /opt/bootsync.ch
/etc/hosts
/usr/bin/sethostname box
/etc/resolv.conf

Sorry, this doesn't make sense to me.

I suggest you read this
http://tinycorelinux.net/book.html
to get an understanding how Core Linux works.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 15, 2017, 05:06:10 AM
Hello,
Do you have the same documentation in French?
I ask a lot of questions, it's true
I had never worked on Linux distributions.
please,
Thanks
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 15, 2017, 06:38:52 PM
Good evening,

On tiny core,
There is a command to get an ip address from a dhcp server ??

thanks,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: Misalf on January 15, 2017, 07:27:34 PM
The documentation is English only, I'm afraid.

Core Linux tries to get an IP via DHCP for ethernet at boot by default unless the  nodhcp  boot code is used.

To get an IP assigned via DHCP after boot, you can use something like this:
Code: [Select]
#!/bin/sh

[ "`id -u`" -eq 0 ] || { echo "Must be root." ; exit 1 ; }

pkill udhcpc
udhcpc -b -i eth0 -x hostname:box -p /var/run/udhcpc.eth0.pid

You could safe it as, for example,  /opt/eth0-dhcp.sh  and it needs to be run with  sudo .

Or use the  Network  GUI tool.
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 16, 2017, 08:17:02 AM
Thanks,

On tiny core,
There is a command to configure an ipv6 address

thanks,
Title: Re: configuration of Tiny Core, as DHCP server and client DHCP
Post by: amonel on January 16, 2017, 08:28:00 AM
It is /sbin/ifconfig eth0 inet6 add 2001:abcd::1/64