Problem Pinging out of Linux

I am unable to ping from Linux. Other machines can however access my linux box thru samba, but i cannot ping from it.
What could be the problem ?
Who is Participating?
ahoffmannConnect With a Mentor Commented:
you need to setup your /etc/resolv.conf with valid values for domain and nameserver, or you need to add the IP - name - mapping to your /etc/hosts file. That's all.
Possibly your resolver config in /etc/resolv.conf and/or nsswitch.conf, but that's a guess at this point.  

Can you list for us what happens exactly when you try to ping ?
farhadtaraporeAuthor Commented:
Nothing happens when I ping. The program just halts there.
I can ping localhost, but not, say,
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

please post etc/resolv.conf and nsswitch.conf

You need to add your DNS server in /etc/resolve.conf.
farhadtaraporeAuthor Commented:
The nameserver entry is already there in resolv.conf along with two other entries for domain and search. But still the ping gives me : unknown host: when I try to ping
please post etc/resolv.conf and nsswitch.conf
try to ping the ip address directly, if it still doesn't work, do you have iptables/ipchains rules rejecting icmp packets ?

type iptables -L / ipchains -L to see the rules
Some distro's require root rights to be able to ping
So su to root
farhadtaraporeAuthor Commented:
I am pinging as root only.
Here are the files:
# /etc/nsswitch.conf
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
# Legal entries are:
#     nisplus or nis+          Use NIS+ (NIS version 3)
#     nis or yp          Use NIS (NIS version 2), also called YP
#     dns               Use DNS (Domain Name Service)
#     files               Use the local files
#     db               Use the local database (.db) files
#     compat               Use NIS on compat mode
#     hesiod               Use Hesiod for user lookups
#     [NOTFOUND=return]     Stop searching if not found so far

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:     db files nisplus nis

passwd:     files nisplus nis
shadow:     files nisplus nis
group:      files nisplus nis

#hosts:     db files nisplus nis dns
hosts:      files nisplus nis dns

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files    

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files

netgroup:   nisplus

publickey:  nisplus

automount:  files nisplus
aliases:    files nisplus

RESOLV.CONF (dummy addresses here, but this is what it looks like)

in your nsswitch.conf:
  hosts:      files nisplus nis dns

DNS is consulted last, after NIS have timed out sevaral times. So you need to wait 'til ping gives up, that's ok according to your setup.
Do you have NIS available in you network?

what does following report (please post full output):

It shure looks like a fire wall issue here.
Can you show the output of the following command:

ipchains -L -n

in a previous comment:
> .. But still the ping gives me : unknown host: 

This is a resolver problem, and not a ICMP filter problem.
Forget about the firewall/packetfilter, except it filters DNS.
farhadtaraporeAuthor Commented:
Output of nslookup
***cant find server name for address <my ip add>: no response from server
***Default servers are not available

Output of ipchains
bash:ipchains: command not found

ipchains is not there on my machine. I can ping the intranet machines, but not outside.
Something in your gateway or no default route to your gateway?
Hoffman is wright it isn't a firewall issue
If you do not have NIS or are unsure, then change your /etc/nsswitch.conf file...  

**** Change this line :  
hosts:      files nisplus nis dns

**** To look like this :  
hosts:      files dns

After you make this change, then try these commands and post your results for us :  

ping -v

traceroute -v
**(may need to specify path with command as /usr/sbin/traceroute )
changing /etc/nsswitch.conf without changing /etc/resolv.conf and/or /etc/hosts, will not solve the problem here
what was wrong/unsufficient with my suggestions?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.