LinuxQuestions.org
Visit Jeremy's Blog.
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 01-01-2005, 01:00 PM   #1
drowstar
Member
 
Registered: Apr 2004
Location: Germany
Distribution: Slackware, Gentoo, Fedora
Posts: 205

Rep: Reputation: 30
can't ping localhost, Internet works fine


Hello everyone,
I recently changed my network setup to use a router instead of the rp-pppoe setup I used to have running.

The problem I am having is that since I have started using dhcp, localhost does not seem to be resolved correctly anymore. This is really bothersome as many applications seem to try to resolve localhost before starting up and this takes a long while to time out.
When I try to ping the loopback address (127.0.0.1 or localhost) I am getting 100% packet loss. Interesting thing is that pinging my "outside" IP address (193.158.167.136 at the moment) works just fine.

Some other things that might be of interest:
The loopback device is activated (ifconfig -a: [snip]lo Link encap:Local Loopback[/snip]), the router is registered as a DNS (resolv.conf:[snip]nameserver 192.168.1.1[/snip]) and localhost is resolved to 127.0.0.1 (/etc/hosts: 127.0.0.1 localhost). Changing this to my current IP does not have an immediate effect.

Do you have an idea what could be causing this and how to fix it?

Thanks a lot,
- drowstar
 
Old 01-01-2005, 01:57 PM   #2
jdlcomputers
LQ Newbie
 
Registered: Dec 2004
Posts: 8

Rep: Reputation: Disabled
First you should do a route print to see what the local host is directed to, possible that it is incorrect, this caused me all sorts of headaches a few weeks ago while hooking up a VPN
 
Old 01-01-2005, 02:51 PM   #3
drowstar
Member
 
Registered: Apr 2004
Location: Germany
Distribution: Slackware, Gentoo, Fedora
Posts: 205

Original Poster
Rep: Reputation: 30
Hi jdlcomputers,
thanks for your reply. Unfortunately I am not sure if I understand what you mean. I will try my best.
My best guess at what a route print might be:
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         broadband-gatew 0.0.0.0         UG    0      0        0 eth0
This does not seem to include the localhost, right? Is that my problem? Sorry, I feel a bit lost here. I have tried adding my loopback address using an example from the man page (route add -net 127.0.0.1), but that only produces an error (SIOCADDRT: Invalid argument).

I hope this gives you a clue.

Thanks for helping,
- drowstar

EDIT: I just checked on my fedora box. There the same command (route) yields:
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
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0
default         broadband-gatew 0.0.0.0         UG    0      0        0 eth0
The problem this thread is about does not occur there.

Last edited by drowstar; 01-01-2005 at 03:02 PM.
 
Old 01-04-2005, 05:55 AM   #4
jdlcomputers
LQ Newbie
 
Registered: Dec 2004
Posts: 8

Rep: Reputation: Disabled
Hi Drowstar,
Sorry about the confussion, I let some of my Windows training get the best of me..

Do the following
open a terminal window, type in SU then enter, log into your ROOT (should be a # not a $ you will need whatever you set up as root password to do so..from there simply type in route and press enter.. post your results, I will check back later today

Jerry
 
Old 01-04-2005, 06:08 AM   #5
drowstar
Member
 
Registered: Apr 2004
Location: Germany
Distribution: Slackware, Gentoo, Fedora
Posts: 205

Original Poster
Rep: Reputation: 30
Hi Jerry,
thanks for your replies. The output I pasted in my last post is the result of the commands you told me to type in. (Thanks for the detailed instructions. I dont need them quite this exact though.)

Thank you for the routing table hint. It made it possible for me to find out that I can work around the problem when I block the route to 127.0.0.1 (route add -net 127.0.0.1 netmask 255.255.255.255 reject). I am very certain that this is not the appropriate solution, but this ugly hack lets me at least work normally for now.

With that hack in place my routing table looks like this (I used route -n as that seems more to the point to me):
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
127.0.0.1       -               255.255.255.255 !H    0      -        0 -
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
Thank you for your help. Your reply really made it a lot easier to work on this machine. You might be interested in another thread I opened on the topic (sorry, I didn't think you'd reply. I at least should have updated this thread.)

Thanks a bunch again,
- drowstar
 
Old 01-04-2005, 03:09 PM   #6
jdlcomputers
LQ Newbie
 
Registered: Dec 2004
Posts: 8

Rep: Reputation: Disabled
I'm glad that worked..
I am used to working with people with the knowlegde of the bathroom wall, so sometimes I get real detailed about the instructions... Sorry

Jerry
 
  


Reply



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
Strange Ping Issue - Can't ping localhost but can ping others on LAN code_slinger Linux - Networking 15 03-30-2015 02:39 PM
Can't ping localhost (ping: sendto: Operation not permitted) mentor99us Linux - Networking 7 09-05-2012 02:11 PM
Gateway works fine but i can't ping from it. djkadu Linux - Networking 4 10-31-2004 12:31 PM
Apache works localhost but not over the internet newuser455 Red Hat 4 05-22-2004 11:04 AM
No internet access in linux, works fine in windows c0uchm0nster Linux - Networking 8 01-29-2004 06:45 AM

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

All times are GMT -5. The time now is 06:55 AM.

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