LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-23-2007, 07:16 PM   #1
PieSquared
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Rep: Reputation: 0
Cannot ping router - DHCP not working


I am a newbie to Linux and Ubuntu, so please excuse any stupid questions.

The problem that I am having is that after installing Ubuntu, I am not able to access the internet. More specifically, I cannot ping the router and the DHCP is not working.

ping -c 5 192.168.1.1 outputs:
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.20 icmp_seq=1 Destination Host Unreachable

The second line is repeated 5 times. By the way, the reason that says "From 192.168.1.20" is because I have assigned the IP adress by executing "sudo ifconfig eth0 192.168.1.20 netmask 255.255.255.0 up". After executing sudo dhclient again, it outputs "connect: Network is unreachable" and ifconfig eth0 does not show an IP adress.

When executing dhclient, this is the output:

...
Listening on LPF/eth0/00:c0:a8:87:26:7d
Sending on LPF/eth0/00:c0:a8:87:26:7d
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3 (this line is repeated several times)
No DHCPOFFERS received.
No working leases in persisent databasee - sleeping.

Other relevant information (as gathered from other forums):

/etc/resolv.conf:
nameserver 68.87.73.242
nameserver 68.87.71.226
search 192.168.1.1
domain 192.168.1.1

route:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Reg Use Iface


I've tried to solve this, however, no solution seems to help. Please help, and if any other information is needed I'll try to provide it.
 
Old 03-23-2007, 08:43 PM   #2
dxqcanada
Member
 
Registered: Sep 2006
Location: Canada
Distribution: Gentoo
Posts: 702

Rep: Reputation: 43
How do you know the DHCP server is still working ?

When you manually assigned an IP address to your interface (and you do not run dhclient) ... can you ping the router ?
 
Old 03-23-2007, 08:53 PM   #3
PieSquared
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Original Poster
Rep: Reputation: 0
I don't know whether the DHCP servers are working

But what I posted above is what you are asking for. If I assign a static IP, then pinging the router (192.168.1.1) still doesn't work, because it gives me the "Destination Host Unreachable". That is what the ping I showed was for. Sorry if I did not make this clear.
 
Old 03-23-2007, 09:08 PM   #4
dxqcanada
Member
 
Registered: Sep 2006
Location: Canada
Distribution: Gentoo
Posts: 702

Rep: Reputation: 43
If you run ifconfig ... are there any packets received ?

I assume you have checked the physical link ie. cable ... port on hub/switch.
 
Old 03-23-2007, 09:32 PM   #5
PieSquared
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Original Poster
Rep: Reputation: 0
Yes, I have checked the physical connection

Here is the output of ifconfig:

Link encap: Ethernet HWaddr 00:C0:A8:87:26:7D
inet6 addr: fe80::2c0:a8ff:fe87:267d/64 Scope: Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets: 11947 errors:0 dropped:0 overruns:0 frame:0
TX packets: 1495 errors:0 dropped:0 overruns:0 frame:0
collisions:0 txqueuelen:1000
RX bytes: 733532 (716.3 KiB) TX bytes:505895 (494.0 KiB)
Interrupt:201 Base address:0xcc00


It also gives the stuff for lo. I think this means that it is receiving packets, right?
 
Old 03-23-2007, 10:33 PM   #6
Petro P
LQ Newbie
 
Registered: Mar 2007
Location: Toronto, Canada
Distribution: Gentoo GNU/Linux
Posts: 15

Rep: Reputation: 0
Firstly, try telling dhclient what interface to look on

Code:
sudo dhclient eth0
Just a thought. If this doesn't work, try making eth0 your default route

Code:
sudo route add default eth0
Then try dhclient as stated above. Still not working? Let's try manually assigning an IP.

Code:
sudo ifconfig eth0 192.168.x.x netmask 255.255.255.0
sudo ifconfig eth0 up
But we're not done yet, because even though we set the right IP address and subnet mask, we still need to set the default gateway.

Code:
sudo route add default gw 192.168.x.1
Now type 'route' - you will probably have something like me now:

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth1
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.2.1     0.0.0.0         UG    0      0        0 eth1
Since your /etc/resolv.conf seems to be fine, I won't go over it much, but you might want to try setting your nameserver to simply your default gateway.

Here's my /etc/resolv.conf as an example

Code:
# Generated by dhcpcd for interface eth1
search no-domain-set.bellcanada
nameserver 192.168.2.1

Mind you, DNS will play no part in being able to ping your router.

Hope this helps.




Petro.
 
Old 03-23-2007, 11:05 PM   #7
PieSquared
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Original Poster
Rep: Reputation: 0
I tried what you suggested, however, it did not help. Here is the output of "route", as it was a bit different from yours:

Code:
Kernel IP Routing table
Destination       Gateway        Genmask        Flags   Metric   Ref    Use   Iface
192.168.1.0       *              255.255.255.0   U       0         0      0     eth0
default           192.168.1.1    0.0.0.0         UG      0         0      0     eth0
default           *              0.0.0.0         U       0         0      0     eth0
Pinging the router (192.168.1.1) still gives me the "Destination Host Unreachable" message.

Any other suggestions?
 
Old 03-23-2007, 11:51 PM   #8
Petro P
LQ Newbie
 
Registered: Mar 2007
Location: Toronto, Canada
Distribution: Gentoo GNU/Linux
Posts: 15

Rep: Reputation: 0
Try removing this entry from the routing table:

Code:
default           *              0.0.0.0         U       0         0      0     eth0
It could be creating some conflicts. The next step after this is to check the physical wiring and stuff... there's really not much else you can do - clearly the OS is picking up the ethernet card if the interface exists, and if you're able to set parameters like ip address with no problems then there's no software faults as far as I could tell.

Try resting your router (power off, keep it off for a few minutes, turn it back on)
Try using another ethernet patch cord
Try connecting the computer via crossover cable to another system and making them communicate to isolate whether this problem is reproducible with other networks

Let us know how it goes.
 
Old 03-24-2007, 10:39 AM   #9
PieSquared
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Original Poster
Rep: Reputation: 0
No, removing that does not help.

As I understand, it can access the ethernet card, but not the router, because pinging the router or any other computer on the network results in the Destnation Host Unreachable. (All the other computers are running XP)

The same computer is also running Windows XP, and if I reboot into Windows, the internet works fine, so I don't think this could be a hardware problem.

Resting the router does not seem to help either. I'll try to see whether the same problem is reproductible with either networks though. Thanks for the suggestion.
 
Old 03-24-2007, 11:21 AM   #10
jmbrink26
Member
 
Registered: Aug 2006
Posts: 72

Rep: Reputation: 15
Ok, in Ubuntu, try this:

In the shell, type: "/etc/init.d/networking stop", hit Enter, then type "/etc/init.d/networking start", and hit Enter. That will stop/restart DHCP, and TCP/IP.

Then go back to your /sbin/ifconfig, and it should have a valid IP. If you're still having issues, clear the routing tables on your router. Sometimes, that's all it is.
 
Old 03-24-2007, 11:49 AM   #11
PieSquared
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Original Poster
Rep: Reputation: 0
Same result as before if I try to ping the router or another computer on the network: "Destination Host Unreachable"

What exactly does that message mean?
 
Old 03-24-2007, 12:01 PM   #12
Petro P
LQ Newbie
 
Registered: Mar 2007
Location: Toronto, Canada
Distribution: Gentoo GNU/Linux
Posts: 15

Rep: Reputation: 0
Quote:
Originally Posted by PieSquared
Same result as before if I try to ping the router or another computer on the network: "Destination Host Unreachable"

What exactly does that message mean?
It means that your machine is replying to you that it can't access the target network.

Try running
Code:
dmesg | tail
to get kernel messages - run this right after your ping or whatever. I found a thread at computing.net with a guy that seems to have a similar problem - here's the link: http://www.computing.net/linux/wwwbo...rum/29263.html
 
Old 03-24-2007, 03:47 PM   #13
PieSquared
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Original Poster
Rep: Reputation: 0
It is a similar problem, but on this computer everything works fine on Windows XP, so it can't be a hardware problem (I don't think)

The output from dmesg | tail after ping 192.168.1.1 is basically this:

eth0: link up, 100mbps, full-duplex, lpa 0x41E1
eth0: no IPv6 routers present
NET: registered protocol family 17
PPP generic driver version 2.4.2
NET: Registereed protocol family 24

Thanks!
 
Old 03-24-2007, 04:00 PM   #14
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
ok, seems fairly odd, subnet is fine and such, which would be my first point of call.

i've seen various things like icmp packets coming back malformed and such, we can back up to a lower level farily easily though.

firstly, is this host listed in your arp records? it shouldn't be based on the host unreachable message. after pinging it, run "arp -n" to list the known entries. if it's not, let's also look at the initial arping and icmp packets. run "tcpdump -vn arp or icmp" and try a ping. if it's not in the arp cache, you should firstly see the arp broadcast, and then IF the arp is successful, the icmp echo request itself. you'd probably want to totally fluch to arp cache first too.
 
Old 03-24-2007, 04:13 PM   #15
PieSquared
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Original Poster
Rep: Reputation: 0
Sorry, I didn't exactly understand everything you just said, but here's what I did:

After pinging 192.168.1.1, arp -n (as you said) outputs:
Code:
Address                  HWtype  HWaddress                 Flags Mask                  Iface
192.168.1.1                      (incomplete)                                          eth0
If, after that, I run "tcpdump -vn arp or icmp" it says:

tcpdump: no suitable device found

I'm afraid I didn't completely understand the last part. How do I flush the arp cache? Do I need to?

Thanks for looking into this.
 
  


Reply

Tags
dhcp, ping, router



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NIC Not Working In 10.1 - Cannot Ping Router, Access Internet contillion SUSE / openSUSE 6 09-08-2006 02:46 PM
LAN/ADSL Router ping working but DNS ping fails R N Ghosh Linux - Networking 1 01-13-2006 07:44 AM
Home network: connecting to a Linksys router for DHCP IP address - no ping gunther Linux - Networking 28 05-20-2005 10:14 PM
networking not working, nic is loaded, can ping router dns21 Slackware 11 02-16-2005 12:47 AM
My laptop receives an IP via DHCP, but can't ping router or outside IP's! Max P0wer Linux - Networking 12 08-17-2004 05:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration