Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: remus on February 12, 2013, 07:20:56 PM

Title: Static IP changed to dynamic
Post by: remus on February 12, 2013, 07:20:56 PM
Hi all,

I've got mc 3.8.4 running samba 3.4.5 as a file server, its stable.

The server is configured to use a static ip address at boot up.
The server changed its ip address from this static address yesterday and grabbed the next available dynamic address from the ADSL modem router that is at the heart of our small office network.
This happened once a few week's ago and now its happened again, I thought I'd make a post about it.

Config Details:

File : /opt/bootlocal.sh
Code: [Select]
sudo sh /opt/eth0.sh
File : /opt/eth0.sh
Code: [Select]
#!/bin/sh
pkill udhcpc
ifconfig eth0 10.1.1.151 netmask 255.0.0.0 broadcast 10.255.255.255 up
route add default gw 10.1.1.1
echo nameserver 10.1.1.1 > /etc/resolv.conf

Any suggestions are welcome.
Title: Re: Static IP changed to dynamic
Post by: gerald_clark on February 12, 2013, 08:41:17 PM
Use the nodhcp boot code.
Title: Re: Static IP changed to dynamic
Post by: remus on February 12, 2013, 10:02:01 PM
Ok, I'll do that.

Is mc getting a new IP address for that reason ?
Title: Re: Static IP changed to dynamic
Post by: hiro on February 13, 2013, 06:54:28 AM
I was always under the impression that without nodhcp the dhcp client is only started once and if you kill it like remus did I don't see where it would get restarted.
Title: Re: Static IP changed to dynamic
Post by: gerald_clark on February 13, 2013, 10:04:28 AM
Unless it is still running, there could be no IP assignment.
Check all the scripts in /opt and make sure nothing restarts it.
Title: Re: Static IP changed to dynamic
Post by: xyz-worx on February 13, 2013, 01:12:21 PM
Hi Remus,

I do nearly the same - using TC 3.8.4 to run a web server (not Apache, only Monkey).
To get always the same IP-address I use my router (a rather old DLink DI-524).
Via DHCP-configuration this router has the ability to deliver always the same IP-address
for a specific PC by using the MAC-address of the ethernet card of this PC. They call
somewhat like 'static DHCP configuration' and 'cloning'.
Maybe you can take a look at the administration of your router, if it has a similar functionality.
My TC works in that way without any special scripts or additional configuration.

Regards

xyz-worx
Title: Re: Static IP changed to dynamic
Post by: tinypoodle on February 13, 2013, 04:14:25 PM
Any chance this could occur in case the interface is not up yet at the time of running that script?
Title: Re: Static IP changed to dynamic
Post by: hiro on February 13, 2013, 04:52:42 PM
That might be it,
with this running in the background it would be a race
[ -z "$DHCP_RAN" ] && /etc/init.d/dhcp.sh &
Title: Re: Static IP changed to dynamic
Post by: remus on February 13, 2013, 07:26:57 PM
I've used qremaster to create a custom mc 3.8.4 boot cd with the following boot codes.

syslog showapps nodhcp noautologin

Other than that the boot cd is stock with no merged tce folder or extensions.

This is a bit of a problem, as the server is used by several windows xp machines in a client - server database relationship.

I'm happy to help with any testing, just for specific info, and I'll try to provide it.