Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: TerryJC on December 22, 2010, 08:53:07 AM

Title: Networking in TC
Post by: TerryJC on December 22, 2010, 08:53:07 AM
Hi,

I want to run a script that sets the hostname of a running TC instance after boot up.  However, to avoid conflicts on the network, I would like to do this before networking is started.  I am remastering TC to give me a custom Live Disc, so I can change things in the image if need be.  Can anyone tell me:

Apart from that, I couldn't find a way to start and stop httpd.  Can this be done?
Title: Re: Networking in TC
Post by: tinypoodle on December 22, 2010, 09:18:24 AM
something like...

Code: [Select]
killall udhcpc && ifconfig <if> down
Code: [Select]
ifconfig <if> up && udhcpc -i <if>
assuming you want to use dhcpc

Have you had a look at all boot codes?
If so, what would be the reason of using a script to set host?

Questions regarding "httpd" would better fit in a TCE subforum, while specifiying extension in question   ;)
Title: Re: Networking in TC
Post by: TerryJC on December 22, 2010, 02:17:39 PM
Hmmm.  I thought I'd responded to this.  Must have forgotten to hit 'Post'  ::)

something like...

Code: [Select]
killall udhcpc && ifconfig <if> down
Code: [Select]
ifconfig <if> up && udhcpc -i <if>
assuming you want to use dhcpc

Since posting, I I had come to the conclusion that I would have to kill something and take the IF down.  I'd rather not do that if possible.

Have you had a look at all boot codes?
Yes.  I don't think there is one for networking, other than nodhcp.

If so, what would be the reason of using a script to set host?
I want to have multiple boxes booting simultaneously from several TC Live discs.  If they all have the same hostname, it could be very confusing.

On the other hand, if they have unique hostnames, I should be able to surf to a webserver running on each one by typing http://<hostname> into any browser on the same subnet.

I'm now wondering if it would work if I booted the live disc with nodhcp set, assigned the hostname and then brought up DHCP.  Any thoughts anyone?

Questions regarding "httpd" would better fit in a TCE subforum, while specifiying extension in question   ;)
Yes I know.  I was trying to kill two birds with one stone...

I used kill in the end.
Title: Re: Networking in TC
Post by: curaga on December 22, 2010, 03:14:16 PM
There's a bootcode to set the hostname.
Title: Re: Networking in TC
Post by: TerryJC on December 23, 2010, 02:14:50 AM
There's a bootcode to set the hostname.

But then I would need an individual disc for each computer or have the boot ups attended by the user.  If this all works, we may be booting hundreds of boxes, maybe from a netboot.  I need these boots to be largely unattended, so I can access the data for each box from a remote machine.
Title: Re: Networking in TC
Post by: ^thehatsrule^ on December 23, 2010, 04:21:31 AM
Files of interest:
- running hostname
- /etc/hostname
- sethostname (tc-functions)
Title: Re: Networking in TC
Post by: gerald_clark on December 23, 2010, 12:11:53 PM
PXE netboot can have seperate config files per machine.
Title: Re: Networking in TC
Post by: TerryJC on December 23, 2010, 01:31:50 PM
PXE netboot can have seperate config files per machine.

Thanks.  That's useful to know.
Title: Re: Networking in TC
Post by: tinypoodle on December 25, 2010, 06:10:06 PM
I want to have multiple boxes booting simultaneously from several TC Live discs.  If they all have the same hostname, it could be very confusing.

On the other hand, if they have unique hostnames, I should be able to surf to a webserver running on each one by typing http://<hostname> into any browser on the same subnet.

Why use hostnames?
I never had the slightest issue of boxes on same subnet having same hostname communicating with each other, based on IP.
(u)dhcp(c/d) takes care of unique IPs.
Title: Re: Networking in TC
Post by: TerryJC on December 27, 2010, 04:21:20 AM
Why use hostnames?
I never had the slightest issue of boxes on same subnet having same hostname communicating with each other, based on IP.
(u)dhcp(c/d) takes care of unique IPs.

Because most  DHCP servers will record the hostname of each device together with the allocated IP address.  This means that I can browse to an automatically generated web page simply by typing 'http://<hostname>' instead of  'http://<IP Address>'.   Since I will have control of the hostnames through my scripts, (but little control of the IP addresses allocated), I will know which physical machine's page I am viewing.