# Unable to get an IP from DHCP.

## Davela

The PC that I'm using for DHCP Server is FC4. But I do have a Gentoo PC. Anyway now that the DHCP Server is supposed to be working I can't figure out why my Gentoo PC won't pick up and IP address?

/etc/conf.d/net

config_eth0=( "dhcp" )

dhcp_eth0="nodns nontp nonis"

routes_eth0=( "default gw 192.168.1.1" )

Plus I already ran the follwoing commands:

rc-update add net.eth0 default

ln -s net.eth0

/etc/hosts

127.0.0.1 localhost NEBULUS

I've then rebooted. But still it doesn't pull IP addr. auto. ?

----------

## rrok

Try with empty /etc/conf.d/net. Comment all lines in it.

You could try this as well:

```
config_eth0=( "dhcp" )

dhcp_eth0="nodns nontp nonis"
```

----------

## Davela

I already have that entry in /etc/conf.d/net . Or are you saying it's better to have a completely empty /etc/conf.d/net file ? If that file is empty will it automatically use DHCP?

----------

## rrok

Well I have empty file and it works just fine  :Wink: 

----------

## Davela

Ok I'll try it.

On the DHCP Server,

Do I need to enter the line DHCP_HOSTNAME="my server name" into /etc/sysconfig/network-scripts/ifcfg-eth1 ? 

Currently it looks like this:

/etc/sysconfig/network-scripts/ifcfg-eth1 <Internal Network>

IPV6INIT=no

ONBOOT=yes

USERCTL=yes

PEERDNS=yes

TYPE=Ethernet

DEVICE=eth1

HWADDR=00:05:5d:46:c8:16

BOOTPROTO=dhcp

NETMASK=255.255.255.0

IPADDR=192.168.2.1

/etc/sysconfig/network-scripts/ifcfg-eth0 < This connects to DSL for Internet>

DEVICE=eth0

BOOTPROTO=dhcp

HWADDR=00:04:5A:5E:EA:2B

ONBOOT=yes

TYPE=Ethernet

USERCTL=no

PEERDNS=yes

IPV6INIT=noLast edited by Davela on Tue Feb 21, 2006 5:08 pm; edited 1 time in total

----------

## UberLord

On Gentoo, no configuration implies DHCP.

You have emerged a DHCP client yes? I ask we don't install one by default.

----------

## rrok

```
# emerge dhcpcd
```

----------

## Davela

Yeah I've done the emerge dhcpcd...

Still not picking up an IP.

Here's what I noticed when rebooting though...When I boot as you know all the devices and services start initializing, but when it get's to eth0 i get:

eth0        [ok]

dhcpcd    [!!]

Then the system moves on and finishes the boot. This happpens no matter what the /etc/conf.d/net files has in it. Or even if it's empty.

 What do you guys think?

----------

## UberLord

Sure eth0 is your ethernet and not something like firewire?

What's the output of ifconfig -a

----------

## rrok

Make sure your kernel has loaded the driver for your network card

----------

## Davela

The kernel definetly has my driver for the nic. And if I connected my DSL modem directly to the nic I can configure and get on the net. But I just am not pulling an IP from my DHCP server. 

Maybe this will help.. Let me explain the setup.

I have a PC I am using as a Router/ DhCP Server. I in turn have the 2nd nic on that PC connected to a linksys hub < not a router> . The 1st nic is connected to the DSL modem. The Gentoo PC in question has only 1 nic and is also connected to the linksys hub. The lights on the hub are blinking but no Ip address is coming over to to be assigned.

 On the PC serving as the Router/DHCP Server it's configured with the following.

/etc/dhcpd.conf 

ddns-update-style interim;

ignore client-updates;

subnet 192.168.2.0 netmask 255.255.255.0 {

   # The range of IP addresses the server

   # will issue to DHCP enabled PC clients

   # booting up on the network

   range 192.168.2.2 192.168.2.20;

   # Set the amount of time in seconds that

   # a client may keep the IP address

   default-lease-time 86400;

   max-lease-time 86400;

   # Set the default gateway to be used by

   # the PC clients

   option routers 192.168.2.1;

 # Forward DHCP requests from this

   # NIC interface to other NIC

   # interfaces

   option ip-forwarding on;

   # Set the broadcast address and subnet mask

   # to be used by the DHCP clients

   option broadcast-address 192.168.2.255;

   option subnet-mask 255.255.255.0;

   # Set the DNS server to be used by the

   # DHCP clients

   # option domain-name-servers 192.168.1.100;

   # Set the NTP server to be used by the

   # DHCP clients

   # option nntp-server 192.168.1.100;

  # If you specify a WINS server for your Windows clients,

   # you need to include the following option in the dhcpd.conf file:

   # option netbios-name-servers 192.168.1.100;

   # You can also assign specific IP addresses based on the clients'

   # ethernet MAC address as follows (Host's name is "laser-printer":

   host laser-printer {

     # hardware ethernet 08:00:2b:4c:59:23;

     # fixed-address 192.168.1.222;

   }

}

#

# List an unused interface here

#

subnet 192.168.3.0 netmask 255.255.255.0 {

}

the nic eth0 is set for DHCP because it's connected to DSL

the nic eth1 is static IP 192.168.1.1 Submask 255.255.255.0 GW: 59.x.x.25

the ppp0 Ip 59.x.x.25

The Gentoo Pc in question has nothing in the /etc/dhcpd.conf file and nothing in the /etc/conf.d/net file.

Thnx again for all your help..Last edited by Davela on Tue Feb 21, 2006 5:07 pm; edited 1 time in total

----------

## UberLord

Have you checked the server side dhcp logs for requests and offers?

----------

## Davela

No I haven't I will look through the dhcp logs. Where are the dhcp logs?

Should I be using a coss over cable? If so where should it be connected?

Has anyone been able to successfully change their router<Linksys> into a hub?

Thnx.

----------

## Davela

okay forum buddies...I got the DHCP to to broadcast. I'm recieving Ip's on the other PC's. 

The only thing left is to get everyone websurfing. I cant get anyone out to the internet. But I can ping my static ISP address 59.x.x.25. And all the PC's can see each other amd the printer using IP printing.  On the primary PC eth0 is connected to DSL, and eth1 is connected to the hub with statically assigned IP 192.168.2.1 the other PC's have DHCP assigned address.

What am I missing?  :Crying or Very sad: 

I'm right there.

Thnx for all you guys support.

----------

## UberLord

Is your router doing NAT for the lan?

----------

## magic919

 *Davela wrote:*   

> eth1 is connected to the hub with statically assigned IP 192.168.2.1 the other PC's have DHCP assigned address.
> 
> 

 

Is this just a typo here?  Others show 192.168.1.1 as g/w.

----------

## Davela

eth1 is connected to the hub with statically assigned IP 192.168.2.1 the other PC's have DHCP assigned address.

The above is not a typo. What I realized was that my Linksys router is using 192.168.1.1, even though I made it into a hub and disabled the DHCP server functions. So I changed my subnet to 192.168.2.0, so then I could make eth1 192.168.2.1. Once I made that change my server started serving Ip addresses. So in other words I can't have 2 devices with the same Ip address 192.168.1.1.

And once I added the route command: route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1 eth1. I was then able to have my gentoo PC do an nslookup on outside websites and it it would return DNS info. . ie..nslookup www.yahoo.com.

However I can't use Firefox/ Mozilla to websurf. And I can't ping my windows PC from Gentoo. But I can ping all other devices from the windows PC, nslookup doesn't work from Windows, and I can't websurf from there either.

Thnx

----------

