Click to See Complete Forum and Search --> : Problem getting IP from DHCP using Debian 3


Junior G.
03-07-2003, 06:46 AM
Hi all,
Hopefully a simple query...
I have Debian 3.0r0 installed in a PC at work and I'm trying to connect it to the Network using DHCP. I have recompiled my Kernel and added support for my LAN Card (its a 3Com Etherlink - 3c905c-tx using the Linux Driver 3c900 series, also called Vortex).
So, I boot my machine up and the card gets recognised, but for some reason, the card is not activated a boot time, so when I run the comand: ifconfig , I can see only the Loopback interface. To be able to see the eth0 interface, I have to type: ifconfig eth0 up

Anyhow, I would like to set my eth0 interface to pick an IP Address from DHCP at boot time. Does anyone know the files I need to twik or the tools I need to install to do this?

Thanks

PS: I have tried installing the package etherconf and then running the command: dpkg-reconfigure etherconf and even though I tell this tool to set my device to use DHCP, at the next boot, the device still doesn't pick an address.

Is weird, because I have installed Debian several times already and to my mind have done the same steps I have done this time to install it and I could connect to the network via DHCP after compiling my kernel, but for some reason now it doesn't work.

Magueta
03-07-2003, 09:49 AM
You can edit the ifcfg-eth0 file in the directory /etc/sysconfig/networking-scripts. This file should allow you to both get the ethernet interface to startup on boot and to use dhcp. Also, you can probably use ifup eth0 and ifdown eth0 rather than typing ifconfig eth0 up/down. The location of the above file isn't written in stone but that's the file that you need to edit. Set bootproto=dhcp and onboot = yes.

Joe

root.veg
03-07-2003, 11:03 AM
Debian uses /etc/network/interfaces , not /etc/sysconfig/networking-scripts , which I think is a Red Hat thing.

Anyway, edit /etc/network/interfaces so that it includes the following:

auto eth0
iface eth0 inet dhcp

The "auto eth0" could be separate from "auto lo", or you could have just one line for both ("auto lo eth0"). Try

man interfaces

for more info.

Magueta
03-07-2003, 11:07 AM
Yes, it's for redhat.

Joe

Junior G.
03-07-2003, 11:08 AM
Thanks Joe for your reply,
I had a look and couldn't find this file or folder under /etc.
I'm just performing a search for the file now to see if it is located somewhere else.

If the file doesn't exist, can I just create it? will I need to edit any startup scripts?

Thanks

Junior G.
03-07-2003, 11:13 AM
Sorry, didn't see the reply from root.veg (I think we posted almost at the same time)
I found the /etc/network/interfaces file so I will edit it as you advise root.veg and will post back the results.

Thanks much!

Junior G.
03-07-2003, 11:26 AM
Hi root.veg, Joe,
I have edited my /etc/network/interfaces file to add the following lines...
auto eth0
iface eth0 inet dhcp

Now after a PC reboot, the eth0 device is coming up OK (I don't need to use ifconfig eth0 up to be able to see it), but still the interface does not get an IP Address from DHCP.

I tried ifup eth0 and ifdown eth0, but with no joy. I however do get an error when running ifdown eth0 - the message reads: "cat: /var/run/dhclient.pid - no such file or directory"

Maybe there is other file I need to edit.

Thanks for your suggestions so far.

Regards

root.veg
03-07-2003, 11:54 AM
Have you checked whether you have the correct DHCP software installed...

Initially I just had the DHCP server installed (Debian package "dhcp"), but I forgot to install "dhcp-client" - ie the program I actually needed. Also try installing "pump" if that doesn't work. I *think* that ifup will look for either of these programs when it brings up a network interface.

Post back if that isn't the problem...

Magueta
03-07-2003, 12:12 PM
Wow, I would have guessed that the dhcp client is installed by default. I'm interested to see what happens.

Joe

craigad
03-07-2003, 12:50 PM
Junior G


....this is a nightmare that took me a week to sort out last time.


I'll bet 10 bucs that you have not got the module af_packet installed on your machine.

to find out what modules you have loaded do lsmod

see if it is there.

if not, it's recompile time. You ned to make sure that you havethe following in your kernel as modules:

CONFIG_PACKET and CONFIG_FILTER

this should do the trick

/craigad

Junior G.
03-09-2003, 11:34 AM
Hi graigad,
Sorry for the late reply (weekend break!)
My PC is at work, so I'm unable to check your suggestion (I will look at that tomorrow and let you know)

root.veg,
Thanks again for your help, I did make sure I had dhcpclient installed before posting. I do not know however, what software ifup looks for to configure the interfaces and I don't think the pump package is installed. I will try what graigad suggested above and see if it works, if not then I will try installing pump and see what happens.

Thanks again everyone for your help.

Junior

Junior G.
03-10-2003, 07:29 AM
Good morning all,
graigad, you were right, my kernel was missing the option CONFIG_FILTER. I'm re-compiling my Kernel now and should let you know how I get on in a while.

Thanks for your help.

PS: CONFIG_PACKET was already set to yes.

Junior G.
03-10-2003, 08:50 AM
Hey guys,
Perfect - Everything is working perfectly now.
After re-compiling my Kernel with CONFIG_FILTER support, the machine picked an IP Address from DHCP with the command ifup.

Thanks everyone for your support and specially to graigad - you hit the nail right on!

So, to recap, to be able to pick an IP Address from DHCP, you need to have CONFIG_PACKET and CONFIG_FILTER enabled in your kernel, either as modules or supported right into the Kernel. You also need the dhcpclient package installed on your PC and if running Debian, then you need to have the following entry in your /etc/network/interfaces file (here I'm configuring eth0, but I suppose you will be able to add any interface here)...

auto eth0
iface eth0 inet dhcp

For other distros, then you will need to edit a similar file (like Magueta mentioned above, for RedHat, the file you need is /etc/sysconfig/networking-scripts/ifcfg-eth0

Thanks everyone - that's what I call TeamWork!!

root.veg
03-10-2003, 09:35 AM
Congratulations!... I'm just jealous I didn't work out the CONFIG_FILTER thing myself ;)

craigad
03-12-2003, 05:53 AM
Junior G!

excellent - glad someone else benefited from my sweet, blood and toil!


/craigad