# DHCP again![SOLVED]

## HuTcH

hi ppl

After installing gentoo my network worked correctly, but the next day when I turn on the PC, it seems to brake about 10s when it arrived to the Running DHCPCD field and then it assign an ip to my eth0 card and go on normally, but the problem is I dont had net anymore, i have already tried to ping some sites and it doesn't do anything.

The solution I found is to do chroot and then emerge -C dhcpcd and then emerge dhcdcp, after that my network work correctly, but if I turn off the pc for some time in next time it doesn't work already.

please help me because it dont want to those steps every time I turn on PC.

As my network didnt work I type at command line:

>  /etc/init.d/net.eth0 stop

then I ckeck my ethernet cards information

```

tux ~ # ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:80:5A:23:82:C5  

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:32 errors:0 dropped:0 overruns:0 frame:0

          TX packets:168 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:11334 (11.0 Kb)  TX bytes:13260 (12.9 Kb)

          Interrupt:16 Base address:0xe800 

eth1      Link encap:Ethernet  HWaddr 00:50:FC:A2:E7:25  

          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:17 Base address:0xe400 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:35 errors:0 dropped:0 overruns:0 frame:0

          TX packets:35 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:3372 (3.2 Kb)  TX bytes:3372 (3.2 Kb)

```

and here is the my network files:

```

tux ~ # cat /etc/conf.d/hostname 

# /etc/conf.d/hostname

# Set to the hostname of this machine

HOSTNAME="tux"

tux ~ # cat /etc/conf.d/domainname 

# /etc/conf.d/domainname

# When setting up resolv.conf, what should take precedence?

#  0 = let dhcp/whatever override DNSDOMAIN

#  1 = override dhcp/whatever with DNSDOMAIN

OVERRIDE=1

# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf

# (domain entry in /etc/resolv.conf and FQDN in /etc/hosts).

#

# DNSDOMAIN merely sets the domain entry in /etc/resolv.conf, see 

# the resolv.conf(5) manpage for more info.

 

DNSDOMAIN="homenetwork"

# For information on setting up NIS, please see:

#   http://www.linux-nis.org/nis-howto/HOWTO/

 

NISDOMAIN=""

tux ~ # cat /etc/conf.d/net        

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

config_eth0=( "dhcp" )

dhcp_eth0="nodns nontp nonis"

config_eth1=( "192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0" )

tux ~ # cat /etc/resolv.conf 

# Generated by dhcpcd for interface eth0

search bragatel.pt

nameserver 217.70.xx.xxx

```

so I tried to run dhcpcd again, pay attention on the code above.

```

tux ~ # /etc/init.d/net.eth0 start

 * Starting eth0

 *   Bringing up eth0

 *     Configuration not set for eth0 - assuming dhcp

 *     dhcp

 *       Running dhcpcd ...                                            [ ok ]

(when it arrived at this point as had happened before it hangs for some time and then assign an ip)

 *       eth0 received address 217.70.68.34

```

After that i tried to run ifconfig again and everything seems to be fine.

```

tux ~ # ifconfig             

eth0      Link encap:Ethernet  HWaddr 00:80:5A:23:82:C5  

          inet addr:217.70.68.34  Bcast:217.70.68.255  Mask:255.255.255.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:35 errors:0 dropped:0 overruns:0 frame:0

          TX packets:187 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:12381 (12.0 Kb)  TX bytes:14930 (14.5 Kb)

          Interrupt:16 Base address:0xe800 

eth1      Link encap:Ethernet  HWaddr 00:50:FC:A2:E7:25  

          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:17 Base address:0xe400 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:39 errors:0 dropped:0 overruns:0 frame:0

          TX packets:39 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:3768 (3.6 Kb)  TX bytes:3768 (3.6 Kb)

```

But my network still doesnt work, as you can see above:

```

tux ~ # ping -c 3 www.google.pt

ping: unknown host www.google.pt

tux ~ # ping -c 3 www.yahoo.com

ping: unknown host www.yahoo.com

tux ~ # ping www.google.pt     

ping: unknown host www.google.pt

```

I dont understand why is this happening and why network works when I chroot from LIVECD?

Help is needed!

hugsLast edited by HuTcH on Sat Jun 10, 2006 9:27 am; edited 1 time in total

----------

## Cyber_Ninja

```
config_eth1=( "192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0" ) 
```

did you set this yourself?

once your internet stops working, try doing /etc/init.d/net.eth1 restart   and see if your able to ping again.

is eth1 added to default starting?

----------

## HuTcH

cyber as u can see above i do /etc/init.d/neth.eth0 stop and then /etc/init.d/neth.eth0 start.

yes eth1 is added to default starting.

Any ideas?

hugs

----------

## Cyber_Ninja

let me try to understand this a little better..

you have 2 network cards on your system. one is using ethernet i know, but what is the other one being used for?

----------

## jmbsvicetto

Hi / Olá.  :Wink: 

 *HuTcH wrote:*   

> 
> 
> ```
> 
> config_eth0=( "dhcp" )
> ...

 

This is a name resolution problem. Try the following:

```
ping -c 4 140.211.166.170
```

Are you sure that the 217.70.xx.xxx is the address of a DNS server or that it's working correctly? I would suggest that you change /etc/conf.d/net and use dhcp_eth0="nontp nonis". You should let DHCP try to set the /etc/resolv.conf file.

----------

## HuTcH

jmbsvicetto ola'

So, you are saying to edit my /etc/init.d/net/ and delete my /etc/resolv.conf, then run dhcpcd?

What means this?

```

ping -c 4 140.211.166.170

```

----------

## jmbsvicetto

No, don't change /etc/init.d/net; update /etc/conf.d/net instead. You don't need to delete /etc/resolv.conf as DHCP will update the nameservers entries by itself if you let it.

The following will try to send 4 packets to forums.gentoo.org. If you have a name resolution problem, it will work. If it doesn't work, there's some other problem and we'll have to look deeper.

```
ping -c 4 140.211.166.170
```

----------

## HuTcH

jmbsvicetto here is the output:

```

tux ~ # ping -c 4 140.211.166.170

PING 140.211.166.170 (140.211.166.170) 56(84) bytes of data.

From 217.70.68.34 icmp_seq=2 Destination Host Unreachable

From 217.70.68.34 icmp_seq=3 Destination Host Unreachable

From 217.70.68.34 icmp_seq=4 Destination Host Unreachable

--- 140.211.166.170 ping statistics ---

4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3001ms

, pipe 3

```

What I dont understand is if I boot from LIVECD and chroot and then restart my network runs correctly.

----------

## jmbsvicetto

It seems that you might have a misconfigured gateway. Post the output of ifconfig -a and route -n under both the live-cd and your system. If you have the iproute2 package, post instead the output of ip addr and ip route.

----------

## HuTcH

here is the netstat -r output:

```

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

217.70.70.254   *               255.255.255.255 UH        0 0          0 eth0

192.168.0.0     *               255.255.255.0   U         0 0          0 eth1

217.70.68.0     *               255.255.255.0   U         0 0          0 eth0

loopback        tux.homenetwork 255.0.0.0       UG        0 0          0 lo

default         217.70.70.254   0.0.0.0         UG        0 0          0 eth0

```

[]'s

----------

## HuTcH

at this moment my network doesnt work here are the logs, boot from kernell:

```

tux ~ # ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:80:5A:23:82:C5  

          inet addr:217.70.68.34  Bcast:217.70.70.255  Mask:255.255.255.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:38 errors:0 dropped:0 overruns:0 frame:0

          TX packets:92 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:14335 (13.9 Kb)  TX bytes:6580 (6.4 Kb)

          Interrupt:16 Base address:0xe800 

eth1      Link encap:Ethernet  HWaddr 00:50:FC:A2:E7:25  

          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:17 Base address:0xe400 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:32 errors:0 dropped:0 overruns:0 frame:0

          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:3240 (3.1 Kb)  TX bytes:3240 (3.1 Kb)

tux ~ # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

217.70.70.254   0.0.0.0         255.255.255.255 UH    0      0        0 eth0

192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

217.70.68.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         217.70.70.254   0.0.0.0         UG    0      0        0 eth0

tux ~ # netstat -r                

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

217.70.70.254   *               255.255.255.255 UH        0 0          0 eth0

192.168.0.0     *               255.255.255.0   U         0 0          0 eth1

217.70.68.0     *               255.255.255.0   U         0 0          0 eth0

loopback        tux.homenetwork 255.0.0.0       UG        0 0          0 lo

default         217.70.70.254   0.0.0.0         UG        0 0          0 eth0

```

here I boot from LIVECD then chroot to /mnt/gentoo and the network runs correctly, logs below:

```

tux ~ # ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:80:5A:23:82:C5  

          inet addr:217.70.70.52  Bcast:217.70.70.255  Mask:255.255.255.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:29 errors:0 dropped:0 overruns:0 frame:0

          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:7963 (7.7 Kb)  TX bytes:3922 (3.8 Kb)

          Interrupt:16 Base address:0xec00 

eth1      Link encap:Ethernet  HWaddr 00:50:FC:A2:E7:25  

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:21 Base address:0x800 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

tux ~ # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

217.70.70.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         217.70.70.254   0.0.0.0         UG    0      0        0 eth0

```

----------

## jmbsvicetto

There's some interesting info on your previous post. Have you configured a DHCP reservation in your router? How did you ocnfigure your router and in particular the DHCP server?

 *HuTcH wrote:*   

> at this moment my network doesnt work here are the logs, boot from kernell:
> 
> ```
> 
> tux ~ # ifconfig -a
> ...

 

If you notice carefully, the most important difference on your net config under your new system and the live-cd is the network address. Your system is using the 217.70.68.34/24 address, whilst the live-cd is using the 217.70.70.52/24 address. Since your routing table is very similar, it's not surprising that your system doesn't know how to contact the default gateway at 217.70.70.254 from it's 217.70.68.34 address - your default gateway must reside inside your network address.

Look carefully at the router's DHCP config. If nothing else works, try to use a static config with the 217.70.70.150 address for your system and check if you can reach the Internet.

----------

## HuTcH

hi, jmbsvicetto i did what says at gentoo handbook to install my network and as i said before all seems to be working right, but in the next day i couldnt already connect to the internet.

can u tell me what I should do like commands?

hugs

----------

## jmbsvicetto

Try using the following for your /etc/conf.d/net.

```
#config_eth0=( "dhcp" )

#dhcp_eth0="nodns nontp nonis"

config_eth0=( "217.70.70.150 broadcast 217.70.70.255 netmask 255.255.255.0" )

routes_eth0=( "default via 217.70.70.254" )

config_eth1=( "192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0" )
```

After you restart the nic /etc/init.d/eth0 restart does it work?

----------

## HuTcH

jmbsvicetto, thks for your help.

so I change the files u said, and dchcpcd runs correcty without any brake and then i think to myself DONEEEE, but when i tried to ping www.google.pt nothing happened, then I restart and it runs again dhcpcd on eth0 without brakes,  but my networks still unavailable.

however i edit my /etc/conf.d/net

```

#config_eth0=( "dhcp" )

#dhcp_eth0="nontp nonis"

#config_eth0=( "217.70.70.150 broadcast 217.70.70.255 netmask 255.255.255.0" )

#routes_eth0=( "default via 217.70.70.254")

config_eth1=( "192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0" )

```

and run again /etc/init.d/net.eth0 restart and my network has started to work, i just hope tomorrow it still working.

now, these are my outputs

```

tux ~ # ifconfig 

eth0      Link encap:Ethernet  HWaddr 00:80:5A:23:82:C5  

          inet addr:217.70.68.161  Bcast:217.70.68.255  Mask:255.255.255.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1669 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1539 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:1596895 (1.5 Mb)  TX bytes:369601 (360.9 Kb)

          Interrupt:16 Base address:0xe800 

eth1      Link encap:Ethernet  HWaddr 00:50:FC:A2:E7:25  

          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:17 Base address:0xe400 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:19 errors:0 dropped:0 overruns:0 frame:0

          TX packets:19 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:1884 (1.8 Kb)  TX bytes:1884 (1.8 Kb)

tux ~ # route -n

Kernel IP routing table         

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

217.70.68.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         217.70.68.254   0.0.0.0         UG    0      0        0 eth0

```

jmbsvicetto, what do u think about that?

ja'  agora jmbsvicetto obrigada pela ajuda q tens prestado, sempre pronto a ajudar  :Smile: 

olha sabes onde posso arranjar informacao decente acerca deste tema redes, gateway, netmask, broadcast e rotas, o q eu queria msm era entender como into funciona por dentro assim para a proxima ja' n te chateava  :Razz: 

----------

## jmbsvicetto

Please use the file as I've asked:

```

#config_eth0=( "dhcp" )

#dhcp_eth0="nontp nonis"

config_eth0=( "217.70.70.150 broadcast 217.70.70.255 netmask 255.255.255.0" )

routes_eth0=( "default via 217.70.70.254")

config_eth1=( "192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0" )

```

 *HuTcH wrote:*   

> 
> 
> my network has started to work
> 
> ...
> ...

 

I'm convinced that there's a problem with your router's DHCP config. Please take a look at your router's config. If you tell us the model, someone might be able to help you.

----------

## HuTcH

oh god, today my network didnt work again, not even if I repeat all steps i did yestarday:(

jmbsvicetto I have already used your config and didnt work.

Router!?!, I dont have one,  i have one modem wich is plugged to my eth0 card, and also have a switch.

edit.

and if I downgrade my DHCP version or use another one?

hugs

----------

## HuTcH

ppl any ideas?

----------

## 1clue

Don't flip out, or there's nothing anyone can do for you.

You do have a router.  It's the machine which moves packets from one network to another, by definition.  Looking at your prior posts, it will be the box you're trying to configure.

Calm down, and start reading your configurations again.  It seems like you had it running for a while, then it stopped running?  Look for what changed between the time it was running and the time it stopped.  What do your log files say?

In particular, compare your ifconfig output with the prior post where you say, "my network has started to work".

----------

## HuTcH

1clue i already compared what u said, but with the same configs and the sames routs sometimes works and others not, Isn´t there any way to downgrade my dchp package, and if I try another dhcp package?

hugs

----------

## jmbsvicetto

 *HuTcH wrote:*   

> Isn´t there any way to downgrade my dchp package, and if I try another dhcp package?
> 
> hugs

 

You can emerge a particular version of a package with

```
# emerge -av =package-version
```

If you want to try with different DHCP clients, you can choose between at least the following: dhcp, dhcpcd, dhclient, dhcp-agent udhcp.

----------

## HuTcH

hi,

After I change my DHCP client, I am using pump right now, my network seems to be healthy.

thks to the ppl who has helped me  :Razz: 

----------

