LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cannot obtain DHCP lease (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-obtain-dhcp-lease-329297/)

TroelsSmit 06-01-2005 03:52 PM

Cannot obtain DHCP lease
 
Hi,

Im using Debian 2.6.9 and it has worked fine for at long time. Now the box has been moved to a new network, and I cannot obtain an ipadress.
The windows computer next to it tells me the following about the network:

Code:

IP Address. . . . . . . . . . . . : 192.168.1.34
 Subnet Mask . . . . . . . . . . . : 255.255.255.0
 Default Gateway . . . . . . . . . : 192.168.1.1
 DHCP Server . . . . . . . . . . . : 192.168.1.1
 DNS Servers . . . . . . . . . . . : 212.54.64.170
                                          212.54.64.171

When I run ifup -av, the output is:

Code:

Internet Systems Consortium DHCP Client v.3.0.1
...
Listening on LPF/eth0/00:e0....
Sending on LPF/eth0/00:e0....
Listening on LPF/lo/
Sending on LPF/lo/
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER.......
DHCPDISCOVER.......
DHCPDISCOVER.......
DHCPDISCOVER.......
DHCPDISCOVER.......
No DHCPOFFERS received


I think the configuration file is /etc/network/interfaces. This file has the following in it:

Code:

audo lo
iface lo inet loopback

hostname myname
auto eth0
iface eth0 inet dhcp

What can I do to get an ip address ????

thank you very much in advance

vimico 06-01-2005 06:33 PM

The config seems ok... it did work before, didn't it?

Have you checked the hardware?

I know it sounds lame, but have you checked the cable? Does the cable of your Debian box is connected to the same hub/switch/router than the Windows computer next to you?

Is the LED on your ethernet card switched on?
Is the LED of the port used by the Debian box on the hub/switch/router switched on? (Perhaps you used the wrong input)

If you use a switch, have you made a reset? (Switches remember the ID of the ethernet card they are connected to. If you unplug one and plug in another, you might not get through).

I presume eth0 is the only network card in your system....

TroelsSmit 06-02-2005 02:37 AM

Thanks you very much for the kind reply :-)

1. Hardware has not been checked, but I will check it asap.
2. Led and Cable connection is OK.
3. Switch has been reset - no change.

What I've noticed is that the subnet mask is : 255.255.255.0 on the windows system and seems to be 255.255.255.255 on the linux system ??

TroelsSmit 06-02-2005 02:39 AM

Oh - and it was on a different system that it used to work! (also DHCP based though, but this time it is a router not a linux box which handles the ip adresses).

TroelsSmit 06-02-2005 10:25 AM

anyone ?

0pal_t0ad 06-02-2005 11:04 AM

i've had problems with dhclient before. try dhcpcd -d

*oh! you're not using dhclient :) but still, give dhcpcd a go

TroelsSmit 06-03-2005 04:16 AM

Thank you very much, I will try this asap :-)
dhclient is actually what I am using (what should work), ifup/ifdown is just additional tools.

Honestly I believe that it is a setup problem though... we'll c.

0pal_t0ad 06-04-2005 03:43 AM

did it work?

vimico 06-04-2005 12:34 PM

Quote:

Originally posted by TroelsSmit
What I've noticed is that the subnet mask is : 255.255.255.0 on the windows system and seems to be 255.255.255.255 on the linux system ??
255.255.255.255 is not the subnet mask. The subnet mask is provided by the DHCP server, after it has been found.

My guess is, that this is a broadcast address, meaning: "to anybody out there".

Broadcasts are dropped at some point - otherwise the Internet would be filled with them. Is the Windows computer connected to the same switch as your Debian box? (This would give them the same start position).

My suggestions for a more systematic approach to find the fault in your system:

Download the Knoppix Live CD.
Knoppix starts a DHCP client during the boot process.

Boot your Windows computer with the Knoppix CD. Verify that you have Internet access.

Back to the Linux box:
Boot your Linux box with the Knoppix CD. Check if you have Internet access or not.

If you get access on the Windows machine, but not on the Linux box, try to plug the network cable of the Windows machine into the Linux machine and reboot. This combination (Knoppix + Windows cable) should work.

From there, you can try the various combinations to find the component which is responsible.
(Debian + Windows cable)
(Knoppix + Linux cable)

Note: This all assumes that there IS a DHCP server available :) and that it uses some vanilla configuration. (DHCP servers can be configured to be very restrictive on whose queries to answer).

TroelsSmit 06-08-2005 04:39 PM

I guess the cable was loose or something, today almost everything seem to work, just the last part needed. Nameserver lookup and gateway :-)

First of all, everything works when I use knoppix!!

After having booted Debian, ifconfig tells me that I have an ipadress: 192.168.1.105

I can ping the rooter: ping 192.168.1.1 and get response !!
I can ping my windows machine and get response: 192.168.1.106

Now, when I write:

ping erlang.gbar.dtu.dk (university server) this fails with:
ping: unknown host erlang.gbar.dtu.dk

when I try to contact the ip directly:
ping 192.38.95.25
it tells me:
connect: Network is unreachable


As already mentioned I am using Debian - what do I have to do, to setup gateway/nameserver - and whatever more I might be missing ??

Thanks :-)

TroelsSmit 06-09-2005 03:08 AM

Debian gurus, please assist :-)

vimico 06-13-2005 12:43 PM

To summarize:

If you use Debian, you can reach the local network only. If you use Knoppix, you can also reach the rest of the world.

Quote:

when I try to contact the ip directly:
ping 192.38.95.25
it tells me:
connect: Network is unreachable
This means there is no route to the outside world.

Quote:

ping erlang.gbar.dtu.dk (university server) this fails with:
ping: unknown host erlang.gbar.dtu.dk
This means, that the name resolution is not working. Possible causes:
  • no DNS server has been defined
  • a DNS server has been defined, but it does not exist
  • the host name itself does not exist

The fact that a DHCP server should be contacted is defined in /etc/network/interfaces, as you mentioned earlier:

Code:

...
iface eth0 inet dhcp
...

Another config file controls which information supplied by the DHCP server will actually be used: /etc/dhclient.conf. As mentioned earlier, the DHCP server not only provides the IP number, but also the IP of the DNS server (2nd problem), the IP of the router to the rest of the world (1st problem), etc.

dhclient.conf controls what info will be used and what info will be ignored.

The following options are useful:
  • request ... selects what info should be used
  • require ... if the options mentioned here are not provided by the DHCP server, the client aborts with an error message
  • send host-name "your host name": sends your host-name to the server, so that a DNS server can make "your host-name" accessible to others

Other hints: man dhclient.conf

mcd 06-13-2005 07:32 PM

you probably also need to tell your linux box that it should use the router (192.168.1.1) as the default gateway:

route add default gw 192.168.1.1

this can be specified in a config file, and i can tell you that in slackware that file is /etc/rc.d/rc.inet1.conf. i have a feeling it's gonna be different for you though...

vimico 06-14-2005 11:41 AM

Quote:

Originally posted by mcd
you probably also need to tell your linux box that it should use the router (192.168.1.1) as the default gateway:

route add default gw 192.168.1.1

This shouldn't be necessary. It did work under Knoppix (a Live-CD) without manually setting a default gateway. This information is being offered by the DHCP server (otherwise Knoppix wouldn't know about it), but apparently not used by his Debian installation.

TroelsSmit 06-14-2005 01:51 PM

regarding: dhclient.conf

request ... selects what info should be used
require ... if the options mentioned here are not provided by the DHCP server, the client aborts with an error message
send host-name "your host name": sends your host-name to the server, so that a DNS server can make "your host-name" accessible to others

I have enabled all three lines with the standard debian arguments. I then ran "sudo ifconfig eth0 down" and then up.
According to dmesg there are no errors only: eth0: link up, 100 Mbps, full-duplx, lpa 0x45E1.

ifconfig shows that I indeed have an ip address.

the command: "sudo route add default gw 192.168.1.1" was tried - where should this be added so I don't have to run it after every boot ?

if I do a traceroute 192.38.95.25
I can then move through the router - but DNS still doesnt work.
192.168.1.1 1.996 ms
213.237.127.74 46 ms
*** *** *** ***
*** *** *** ***
130.225.244.209 333 ms
* * *
* * *
* * *
* * *
zzzZZzzzZZ ????

Doesn't a tool to setup these things exist ? I mean, I have all the information Im just not sure where to put it ??

Thanks for all the replys :-)


All times are GMT -5. The time now is 10:39 PM.