WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Getting udhcpd going  (Read 14134 times)

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Getting udhcpd going
« on: March 28, 2011, 07:16:48 AM »
Hi,

I've been trying to get udhcpd going and cannot seem to get any sense out of the results I'm getting.  Please bear in mind that although I understand the functions of the various network tools reasonably well, I'm struggling with the configuration, because this is new to me.

Here's the background.  I have TC 3.4 installed to the hard disk on a machine I've been using for development.  I also have a remastered TC LiveDisc that we've been using with udhcpc to connect to a second machine that was running DHCP and DNS.  I never set the second machine up (it's windows anyway) and everything worked as expected.

Now we want to turn things around, so I've been trying to get our LiveDisc configured to serve up DHCP and DNS.  So far I've stumbled at the first hurdle.  I've created:
  • A udhcp.conf file using examples I've found in various places.  The key entries are that I want DHCP to be served up on eth0 and to provide addresses in the range 192.168.0.10 to 192.168.0.20.
  • An entry in the hosts file to define the identity of my machine eg, hostname plus IP address of 192.168.0.1.
  • An entry in the hostname file to define my machine's hostname.
  • An entry in bootlocal.sh to start udhcpd (udhcpd /etc/udhcpd.conf &).

I then pulled the plug and after a restart, the command ifconfig shows that the machine has not been given an IP address and udhcpd doesn't appear to be running.  If I reissue the udhcpd command (with a sudo), the service is shown to be running, but I still can't get an IP address.

One thing I've noticed is that udhcpc is running at boot-up, so presumably that is trying to get an IP address and failing (because of the network plug being out).  I tried disabling it in the 'Services' dialog, but it comes up next boot.  Is this the problem and if so, how do I disable udhcpc?

Can anyone tell me what I'm missing?  I've tried it on the HD install and LiveDisc.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10979
Re: Getting udhcpd going
« Reply #1 on: March 28, 2011, 07:33:57 AM »
A dhcp server can't give an ip to itself, so do you have a static IP set up somehow?

The "nodhcp" bootcode disables udhcpc on boot.
The only barriers that can stop you are the ones you create yourself.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Getting udhcpd going
« Reply #2 on: March 28, 2011, 07:53:12 AM »
Perhaps firing up 'tc-terminal-server' which amongst other runs a udhcpd server could give you an example to examine.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Re: Getting udhcpd going
« Reply #3 on: March 28, 2011, 08:07:59 AM »
A dhcp server can't give an ip to itself, so do you have a static IP set up somehow?

I misremembered :-)  I thought that turning off DHCP and adding the IP address of the host to the hosts file was all that was needed.  I used the 'Network' dialog in the Panel and now have an IP address.  Thanks for the tip-off.

The "nodhcp" bootcode disables udhcpc on boot.

Thanks.  However, I still don't get udhcpd running until I've run it explicitly in a terminal.  Is there anything special needed to get a command in bootlocal.sh to run?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10979
Re: Getting udhcpd going
« Reply #4 on: March 28, 2011, 08:44:16 AM »
Make sure it's started after you have an IP (ie, after eth0.sh, and eth0.sh should not be backgrounded).
The only barriers that can stop you are the ones you create yourself.

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Re: Getting udhcpd going
« Reply #5 on: March 28, 2011, 09:08:39 AM »
Make sure it's started after you have an IP (ie, after eth0.sh, and eth0.sh should not be backgrounded).

Can you provide a bit more detail?

AFAICT, eth0 is started automatically by the default boot process and udhcpd is started by the entry in bootlocal.sh.  How can I delay udhcpd until after eth0 is started?  Or is it OK to start eth0.sh from bootlocal, just before udhcpd?  Would I have to prevent the default scripts trying to start eth0 again?

I suppose what would be most useful is some info about the whole TC boot process.  Is it just like any other Linux boot-up, so I can find the documentation anywhere, or is there something else that's specific to TC?  A link would be helpful if the information exists.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10979
Re: Getting udhcpd going
« Reply #6 on: March 28, 2011, 09:23:33 AM »
Quote
AFAICT, eth0 is started automatically by the default boot process and udhcpd is started by the entry in bootlocal.sh.

The automation just starts eth0.sh from bootlocal :) If you take a look now, it should be there. Move it before udhcpd, and remove the '&'.


TC's boot is a bit mixed, parts are generic, parts are unique.
The only barriers that can stop you are the ones you create yourself.

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Re: Getting udhcpd going
« Reply #7 on: March 28, 2011, 10:45:06 AM »
Quote
AFAICT, eth0 is started automatically by the default boot process and udhcpd is started by the entry in bootlocal.sh.

The automation just starts eth0.sh from bootlocal :) If you take a look now, it should be there. Move it before udhcpd, and remove the '&'.


TC's boot is a bit mixed, parts are generic, parts are unique.

Thanks.  The machine's at work, so I'll have to look in the morning.

Your help is much appreciated.

Offline TerryJC

  • Newbie
  • *
  • Posts: 43
Re: Getting udhcpd going
« Reply #8 on: April 01, 2011, 02:57:48 AM »
Quote
AFAICT, eth0 is started automatically by the default boot process and udhcpd is started by the entry in bootlocal.sh.

The automation just starts eth0.sh from bootlocal :) If you take a look now, it should be there. Move it before udhcpd, and remove the '&'.


TC's boot is a bit mixed, parts are generic, parts are unique.

Thanks.  The machine's at work, so I'll have to look in the morning.

Your help is much appreciated.

I did have a look in the morning and udhcpd did appear to be working.  Thanks again for that.  However, I then moved on to getting a DNS server to work and hit a few more problems.

Being new to all this, I searched these forums and found that some people seemed to favour dnsmasq, so I tried that, with no success.  Whatever I did, the client would get an IP Address, but no name resolution.  I then spent a bit of time trying to set up named, with similar results.  One problem I had is that I've found it difficult to be sure that the program starts without errors.  I enable syslog in the boot codes, but TinyCore doesn't seem to have any more useful logs.  Have I missed something?

Apart from that, I discovered (by accident, because it's not mentioned on these forums), that BusyBox provides a DNS server (dnsd).  The config for this appears to be simple and I seem to have a running DNS server; here is the output of ps ax|grep dns:

 2777 root     /usr/sbin/dnsd -c /etc/dnsd.conf -i 192.168.0.1
 3661 tc       grep dns

 but still no name resolution.

In my udhcpd.conf file I have:

 opt   dns   192.168.0.1

so can anyone suggest why the client isn't getting the IP address of the nameserver?

BTW I've been running Wireshark and have seen quite a lot of DHCP transactions (as you'd expect), but nothing that idicates that DNS is working other than requests for who has this or that IP.