WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Networking in TC  (Read 3766 times)

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Networking in TC
« 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:
  • When TC boots, networking is enabled.  How do I get TC to boot with networking ready, but not running?
  • If I cannot start without networking, how can I stop it?  I've tried all the commands that work on other systems (eg, 'service network stop', '/etc/init.d/networking stop') and they don't seem to work.
  • Having stopped it; how can I start it again?
  • Is there a better way to do what I want?

Apart from that, I couldn't find a way to start and stop httpd.  Can this be done?

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Networking in TC
« Reply #1 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   ;)
« Last Edit: December 22, 2010, 09:33:26 AM by tinypoodle »
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Re: Networking in TC
« Reply #2 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.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Networking in TC
« Reply #3 on: December 22, 2010, 03:14:16 PM »
There's a bootcode to set the hostname.
The only barriers that can stop you are the ones you create yourself.

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Re: Networking in TC
« Reply #4 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.

Offline ^thehatsrule^

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 1726
Re: Networking in TC
« Reply #5 on: December 23, 2010, 04:21:31 AM »
Files of interest:
- running hostname
- /etc/hostname
- sethostname (tc-functions)

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Networking in TC
« Reply #6 on: December 23, 2010, 12:11:53 PM »
PXE netboot can have seperate config files per machine.

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Re: Networking in TC
« Reply #7 on: December 23, 2010, 01:31:50 PM »
PXE netboot can have seperate config files per machine.

Thanks.  That's useful to know.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Networking in TC
« Reply #8 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.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Re: Networking in TC
« Reply #9 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.