nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Can't ping to a linux box by its machine name.

This is a discussion on Can't ping to a linux box by its machine name. within the Linux software forums, part of the Linux Getting Started category; Hi everyone, I got an issue with my SuSe10 linux machine for a long time, and I still can't figure ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 05-15-2007, 02:43 AM
Member
User
 
Join Date: May 2007
Posts: 56
Rep Power: 2
lacloai is on a distinguished road
Default Can't ping to a linux box by its machine name.

Hi everyone,

I got an issue with my SuSe10 linux machine for a long time, and I still can't figure out the problem. All my machines (Windows and Linux) are plugged into the LinkSys Router. Everytime I try to ping/ssh to my linux box from my windows machine by using the machine name, it never works and saying something like request time out.... . However, I can ssh and ftp to my linux by using its IP address, and it works just fine. (Note: everything is done on LAN only) So, I am thinking about the DNS, but I don't know anything about DNS in linux. I really appreciate that if anyone can help me with this. Thank you so much.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-15-2007, 01:37 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,036
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Yup you need to setup DNS server. If you have just 1-2 computers, you can do static mapping by adding hosts to /etc/hosts file and you can ping by names.
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #3 (permalink)  
Old 05-16-2007, 07:44 PM
Member
User
 
Join Date: May 2007
Posts: 56
Rep Power: 2
lacloai is on a distinguished road
Default Hi

I tried to do the static mapping like you said, but somehow it's still not working yet. What I did is vi /etc/hosts and then insert my linux machine's name and IP address and save it.

192.168.1.146 cn-linux1

I still can't ping to it by the machine name. Can you please walk me through with step by step? I am linux newbie. Thank you very much for your time.
Reply With Quote
  #4 (permalink)  
Old 05-16-2007, 08:27 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,036
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Cat you paste your /etc/nsswitch.conf file here?

Code:
cat /etc/nsswitch.conf
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #5 (permalink)  
Old 05-16-2007, 10:29 PM
Member
User
 
Join Date: May 2007
Posts: 56
Rep Power: 2
lacloai is on a distinguished road
Default Content of nsswitch.conf

Hi,

Thanks a lot for your help. Here is what I got on my nsswitch.conf



login as: root
===> Welcome To Cuong's Linux Machine. Authorized Access Only ===>
Using keyboard-interactive authentication.
Password:
Have a lot of fun...
cn-linux1:~ # clear
cn-linux1:~ # cat /etc/nsswitch.conf
#
# /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:
#
# compat Use compatibility setup
# nisplus Use NIS+ (NIS version 3)
# nis Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# [NOTFOUND=return] Stop searching if not found so far
#
# For more information, please read the nsswitch.conf.5 manual page.
#

# passwd: files nis
# shadow: files nis
# group: files nis

passwd: compat
group: compat

hosts: files dns
networks: files dns

services: files
protocols: files
rpc: files
ethers: files
netmasks: files
netgroup: files
publickey: files

bootparams: files
automount: files nis
aliases: files


cn-linux1:~ #
Reply With Quote
  #6 (permalink)  
Old 05-16-2007, 11:06 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,036
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Your hosts and network is in correct order; you should able to ping or ssh using hostname cn-linux1

Code:
hosts:          files dns
networks:       files dns
Try
Code:
ssh  user@cn-linux1
ssh root@cn-linux1
Hope you have added correct IP and hostname in /etc/hosts file or just paste the same.
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #7 (permalink)  
Old 05-17-2007, 03:56 AM
Member
User
 
Join Date: May 2007
Posts: 56
Rep Power: 2
lacloai is on a distinguished road
Default /etc/hosts

Hi,

This is from cat/etc/hosts command on my linux. Please let me know what I need to do. The IP of my linux is 192.168.1.146. Thank you very much.


login as: root
===> Welcome To Cuong's Linux Machine. Authorized Access Only ===>
Using keyboard-interactive authentication.
Password:
Have a lot of fun...

cn-linux1:~ # cat /etc/hosts
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#
192.168.1.146 cn-linux1
127.0.0.1 localhost
# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback

fe00::0 ipv6-localnet

ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
192.168.1.146 cn-linux1.site cn-linux1
cn-linux1:~ #
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Unable to ping ??? raina_ajeet Linux software 2 04-24-2008 06:39 PM
Best Linux distro for a not fast machine Azmandius The Hangout 6 03-24-2008 11:31 PM
virtual machine detection nikale Getting started tutorials 1 03-04-2008 04:37 AM
script to ping + date dendi_rm Shell scripting 3 09-11-2007 11:42 AM
How to share local machine folder to outside network rajuk Linux software 1 03-25-2005 11:57 AM


All times are GMT +5.5. The time now is 08:43 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36