# eth0 and DHCP working but not internet

## Mr_Ridd

Hey

The subject title pretty much says it all. I boot up and it finds my network card and all the DHCP stuff.

It also shows the correct info when I type ifconfig. I have broadband going through ethernet, not USB,

and I can browse the internet in Windows.

But when I:

ping google.com or ping www.google.com (shouldn't make a difference)

or any host

it says, "Host not found"

Any ideas?

Thanks

----------

## Sven Vermeulen

Do you have the /etc/nsswitch.conf file? If not, create one with the following content:

```

passwd:      compat

shadow:      compat

group:       compat

hosts:       files dns

networks:    files dns

services:    db files

protocols:   db files

rpc:         db files

ethers:      db files

netmasks:    files

netgroup:    files

bootparams:  files

automount:   files

aliases:     files

```

Next, check if you have a /etc/resolv.conf which contains the correct domain name servers.

You can always try pinging to them:

```

~# cat /etc/resolv.conf

nameserver 195.130.130.11

nameserver 195.130.133.11

domain siphos.be

~# ping -c 3 195.130.130.11

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

64 bytes from 195.130.130.11: icmp_seq=1 ttl=59 time=58.6 ms

64 bytes from 195.130.130.11: icmp_seq=2 ttl=59 time=52.3 ms

64 bytes from 195.130.130.11: icmp_seq=3 ttl=59 time=58.9 ms

--- 195.130.130.11 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2014ms

rtt min/avg/max/mdev = 52.331/56.638/58.961/3.061 ms

```

If that works out well, and you can still not ping any domain name, your domain servers are probably not valid.

----------

## Crisis

Sounds like DNS.  Did you copy over /etc/resolv.conf during the install?

Try pinging an IP (not dns name).

----------

## nixnut

Moved from Installing Gentoo to Networking & Security.

Check your /etc/resolv.conf. 

Can you ping ip numbers even if you can't ping domain names?

----------

## Mr_Ridd

Let me give everything a go, and I'll post back here. Just for interest sake, what nameservers do I use?

I also haven't installed anything yet, I'm booting off the Minimal Install CD.

----------

## Mr_Ridd

No luck, I tried it all. The files and nameservers are all there.

When I ping the ip address I get "network unreachable".

----------

## Mr_Ridd

OK, I got it working. For some reason it wouldn't assign me and ip address ann gateway`.

So I did an ipconfig in Windows and got the details, and then manually set it up using ifconfig and route.

----------

## Mr_Ridd

Hey, I'm getting the same problem again, but I've installed GenToo now.

I tried what I did before but it doesn't work. It's actually quite strange, because it doesn't

say anything like, "host not found", it just sits there.

How can I fix this?

----------

## m_sqrd

ok lets see if we can pin this down

1. dose your windows box boot up with DHCP ?

2 what dose your net work look like  modem --> switch --- > computers ?

----------

## Mr_Ridd

no switches etc, it goes straight to the cable modem.

i've booted up with and without dhcp, but neither worked.

i also got the ip address and gateway from windows and set it manually but that didn't work.

The strange thing is that it did work from the LiveCD, manual config i mean.

----------

## m_sqrd

Ok but how dose the windows box boot via DHCP or do you have setting your ISP gave you to put in to windows via the control panel ... networking ect...

----------

## Mr_Ridd

Windows just picks it up automatically, thats the other thing I can't figure out.

Why doesn't linux pick it up. In the LiveCD I still had to enter it manually. Strange.

----------

## m_sqrd

ok so when you boot the linux box do you shutdown the windows box first then boot the linux box

I guess I should ask these are 2 diffrent boxes are they not.

if so cat the output of your /var/lib/dhcpc/dhcpcd-eth0.info and lets look at that.

----------

## Mr_Ridd

I'll do that.  No, same box, I am dual booting.

----------

## the_mgt

1. If you boot with windows, you can contact the internet? So you have set up your internet connection via the cable modem there, right? Or what takes you to the internet? Any hardware routers???

2. If you connect to the internet from the box you are running gentoo on, did you set up any internet connection? If not, how do you expect to connect to the internet, if you have no external hardware router?

3. If you don't have a hardware router and your only computer connects directly to the internet, what do you need dhcp for?

After all these posts here, i am still not able to figure out your problem. Describe your network configuration and the involved computers more precisely.....

As an example, my configuration:

ISP--->ADSL Modem--->GentooBox (Router, runs dhcp Server) ---> MyLaptop (is dhcp Client)

My Router connects to the internet, is the gateway and provides DNS and DHCP for my LAN. Any computer starting with "config_eth0=("dhcp")" in my network gets an IP address assigned and automatically uses my router as gateway and nameserver. The GentooBox has a fixed IP address.

So, if you only want to connect one single desktop pc to the internet, you don't need a dhcp server.

If you have a hardware router, that is your DHCP and DNS server and is your gateway.

----------

## Mr_Ridd

Ok, here goes.

I recently got a Broadband connection with modem, which I connected straight to my pc.

so it's PC -> Modem -> ISP.

The internet in Windows works fine using DHCP, it finds everything.

Now when I was installing GenToo, using the LiveCD, it didn't pick up the ip adress, gateway etc. Or perhaps it did, but it didn't work.

So I went and ipconfig'ed Windows and got the ip details and then did this in GenToo:

```

ifconfig eth0 <ip> netmask <mask> up

route add default gw <gw>

```

And that worked fine. So thinking that I would have a similar problem in the actual installed linux, I added the relevant details so it would be done on startup.

No I finished installing, and it did what it was supposed to do, except there was no internet. So I tried to use DHCP again and then it failed on netmount.

Hope that makes things a bit more clear.

----------

## Mr_Ridd

```
/var/lib/dhcpc/dhcpcd-eth0.info
```

doesn't exist on my machine. Theres a dhcp directory in the lib dir but it's empty.

----------

## m_sqrd

Ok I'm the one whos confused now.

when you boot of the live-cd you get an ipaddress. and you tested this by 

ifconfig eth0 (and it had some like)

eth0      Link encap:Ethernet  HWaddr 00:yy:zz:00:11:22

          inet addr:192.168.1.12  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:19549297 (18.6 Mb)  TX bytes:2065479 (1.9 Mb)

forget the address shown thats for over here on my network.

but you did get some like that yes ?

----------

## the_mgt

EDIT: hehe, the poster above me was faster, please answer his question first  :Wink: 

hmmm, i am still confused. Are you sure you didn't setup an internet connection under windows which dials in automatically?

What where the exact ip values, ipconfig listed in windows? How many connections did you see in windows?

What i can't figure out is, which of your computers sends the username and password to your ISP. Thats essentially for having an internet connection. So either your modem does that or you setup somthing in windows....

1.If your modem really provides internet over dhcp (which i think makes it a hardware router) then using dhcp should work.. (and your ip in windows should have been something like 192.168.x.x or 169.x.x.x or in rare cases 10.x.x.x)

Did you emerge net-misc/dhcp ? If so, using "config_eth0=( "dhcp" )" in /etc/conf.d/net and restarting /etc/init.d/net.eth0 should do the trick. If you didn't emerge net-misc/dhcp, no wonder it doesn't work.

2.If your modem does not provide internet via dhcp, than you have to set up an adsl connection under gentoo. Try using adsl-connect. (your ip in windows should have been something like 89.181.53.44 or some seemingly random number)

If you only use a single pc, you don't need netmount at all. But if netmount does not start, it is always a sign for a net device which didn't start.

I suggest you look at some howtos about setting up networks with linux. Maybe one of the examples fits your needs.

----------

## Mr_Ridd

m_sqrd:

yip, i did that. I don't think I did it after it worked though.

the_mgt:

the ip is 89.19.xx.xx (don't want to give it all out)

Hmm, I did setup up stuff in Windows, but that doesn't explain why it worked off the liveCD. I think it looks at the mac address of the modem.

I'm sure I emerged dhcp. Well I can can run it so I must have. Let me go try that config.. thing. I did iface="dhcp" and it didn't work.

----------

## the_mgt

89.x.x.x is an internet adress, so you are directly connected to your ISP.

Why it worked with the LiveCD is a miracle to me...

I think you need to establish a pppoe connection first.

----------

## Mr_Ridd

Nope, the config thing didn't work.

I think what we have to ask ourselves is:

What did LiveCD do that I'm not?

How do I establish the PPPoe connection?

----------

## m_sqrd

Hmmm..

what ISP  are you using and the modem info as well may be we can finger it out that way.

----------

## Mr_Ridd

I'm with NTL uk.

How do I set the DHCP server address?

----------

## m_sqrd

I think the_mgt is correct. I think you need one of the ppp set up's 

look at http://www.gentoo.org/doc/en/handbook/2005.1/handbook-x86.xml?part=1&chap=3#rp-pppoe

and see if that make any diffrence I was just hunk up on the fact that the fisrt time it work with out it (well kinda work ?) any way take a look at that link and see if it help and let us know.

----------

## Mr_Ridd

No, pppoe didn't work.

I tried to use dhcp again and for some reason it won't start.

I emerged pcmcia-cs and dhcp again, but still not luck.

There has to be a solution to this problem.

----------

## m_sqrd

ok let walk through this one more time

1. what type of  modem is it DSL/ADSl/cable ? make and model.

2. on your windows side did the ips (NTL) give you an install cd or have you download some software maybe via  registration pages ?

I'm pretty sure this is a auth problem (usr_name/passwd) that your not sending at the startup but right now I just dont know where to look.

----------

## Mr_Ridd

1)

I have a cable modem

model: E08C007

make: NTL cable modem

2)

Yeah I got a disk which I used. But that doesn't explain why I could connect in the LiveCD.

----------

## Mr_Ridd

This is what happens when it boots:

```

Starting PCMCIA

cardmgr[10752]: no sockets found!

cardmgr failed to start. Make sure that you have PCMCIA

modules built or support compiled into the kernel.

Starting eth0

   Bringing up eth0

      dhcp

         Running dhcpcd....

ERROR: Problem starting needed services

            "dhcp" was not started.

```

I have emerged pcmcia-cs and done the rc-update call.

Could it be that some modules aren't being loaded?

One other thing, when I boot into the LiveCD, and type ifconfig it displays eth0 and lo,

when I boot up into my installed system it only brings up lo.

----------

## m_sqrd

hmmm I look on the web I you mite try this

http://www.ntlworld.com/helpsupport/select_os.php

and see if you can pin down if its pptp or what 

I found a few links that say it is pptp and other that say pppoe and other say it just DHCP.

so I'm don't know what to think at this point. we know plain DHCP dont work you tried pppoe and no go there so I'd take a look at the pptp option.

----------

## the_mgt

Ok, i am still clueless and can't see anything making sense.

Please do the following steps:

1. Boot the LiveCD

2. Verify you can ping to the internet!! Try ping forums.gentoo.org for example.

3. If you are able to ping, post the output of ifconfig and /etc/resolv.conf

4. lsmod output would be nice, too (especially anything about pppoe or dhcp or pptp)

How did you install your kernel for the installed gentoo? Genkernel or hand-made?

----------

## Mr_Ridd

genkernel

----------

## m_sqrd

Just found this at 

http://www.faqs.org/docs/Linux-HOWTO/Cable-Modem.html

3.36. NTL, United Kingdom

This information is provided by cogNiTioN <cog-cablemodem@cognite.net>:

This assumes that you've spoken to NTL, you have the cable modem, the cable line installed and your network card installed and recognised. You should also have you MAC address registered with NTL. (NTL contact: http://www.ntl.com/cablemodems/)

Now all you have to do is connect your cable modem to your network card and run the DHCP client. I've found that you have to specify the username you supplied during the registration process, on the command line: e.g. root # dhcpcd -h cognition (substitute cognition for your user name.). For any other problems with DHCP please check out the DHCP mini-HOWTO.

I've also found that occasionally the 3COM CMX modem used needs to be rebooted (power off, press the reset button on the back, power on) if left connected 24/7.

Nameservers used by NTL are: 194.168.4.100 and 194.168.8.100, so those should be added to your /etc/resolv.conf.

I've found NTL's tech support to be close to useless, most the time and they don't officially support Linux, so you're probably better off contacting your local LUG (http://www.lug.org.uk/ ), or you could even try mailing me direct (but I don't promise to be able to respond).

----------

## Mr_Ridd

Good find. I'll try it.

Why won't dhcpcd start though? It used to. I think it stopped working after i installed pppoe

----------

## Mr_Ridd

Nope, didn't work. This is pissing me off now. Why does it work on the LiveCD and not

on my system?

----------

## m_sqrd

off hand I'd say 

Starting PCMCIA

cardmgr[10752]: no sockets found!

cardmgr failed to start. Make sure that you have PCMCIA

modules built or support compiled into the kernel. 

this is the problem.. if you don't have PCMCIA-card's  I'd unemerg it and remove it from the default run level. then net_scripts check this and hotplug, and some other for failuer.

then add some like dhcpcd_eth0="-h your_ID"  to the /etc/conf.d/net file and see what she do.

----------

## Mr_Ridd

Removed PCMCIA and it still didn't work.

I also removed and then reinstalled dhcp, which didn't help.

I think what we need to sought out first is why isn't dhcp starting?

Why's it giving me an error?

----------

## m_sqrd

ok whats the output of

rc-update show default

rc-status default.

----------

## OABUS

I am experiencing the same, heres my setup on a a7n8x deluxe using the 3com nic

pc<------>adsl/router in one<------>isp

router set to dhcp(this is a checked fact), so my /etc/conf.d/net is 

config_eth0=("dhcp")

recieving everything as I should it seems from the router(ip,nameservers...), resolv.conf contains two nameservers which are correct -checked them.

everything works in winxp , I do a ipconfig /all and see basicly the same info as when I ifconfig in gentoo...

when i type route 

```

Kernel IP routing table 

Destination          Gateway         Genmask             Flags Metric Ref    Use  Iface 

10.24.156.200      *                 255.255.255.255     UH     0      0        0     eth0 

10.24.156.200      *                 255.255.255.248     U       0      0        0     eth0 

loopback              localhost      255.0.0.0               UG       0      0       0      lo 

```

I find this puzzeling, what can I have done wrong , what to check and what more info do you need

winxp ipconfig /all (on a laptop,not my gentoo)

```

Windows IP-konfigurasjon

        Vertsnavn  . . . . . . . . . . . : SN177102130123

        Primær DNS-suffiks . . . . . . . :

        Nodetype . . . . . . . . . . . . : Ukjent

        IP-ruting aktivert . . . . . . . : Nei

        WINS Proxy aktivert. . . . . . . : Nei

Ethernet-kort Lokal tilkobling:

        Tilkoblingsspesifikt DNS-suffiks :

        Beskrivelse  . . . . . . . . . . : VIA-kompatibelt Fast Ethernet-kort

        Fysisk adresse . . . . . . . . . : 00-40-D0-3D-94-D0

        DHCP aktivert. . . . . . . . . . : Ja

        Automatisk konfigurasjon aktivert: Ja

        IP-adresse . . . . . . . . . . . : 10.24.156.202

        Nettverksmaske . . . . . . . . . : 255.255.255.248

        Standard gateway . . . . . . . . : 10.24.156.200

        DHCP-server. . . . . . . . . . . : 10.24.156.200

        DNS-servere. . . . . . . . . . . : 217.13.7.140

                                           217.13.4.24

        Leasingavtale mottatt. . . . . . : 27. september 2005 05:22:50

        Leasingavtale utgår. . . . . . . : 27. september 2005 17:22:50

```

(norwegian crash course ja=yes nei=no aktivert=activated.... now you're a professsor in linguestics  :Wink: )

----------

## OABUS

I'll get more info out as soon as I start up a samba server on my gentoo, or get my usb memory stick to work on my a7n8x(which is also a pain in the xxx).

----------

## OABUS

managed to telnet to the router from winxp and guessed correct passwords. then snooped around. Some interesting stuff where a dhcp client list where my gentoo was listed. Also I found a pinging tool in the router, tried to ping my gentoo machine. Sent 4 packages and 4 was lost. tried to ping my windows machine and 4 out 4 in.

----------

## m_sqrd

OABUS.

your correct on the routes looking funky can you show us the output of

 ifconfig eth0; netstat -rn; cat /var/lib/dhcpc/dhcpcd-eth0.info

----------

