LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-27-2006, 03:50 PM   #1
1337_penguin
Member
 
Registered: Jul 2005
Location: Brighton, UK
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73

Rep: Reputation: 15
Unable to ping hosts by hostname


Hi

I currently have a box running Ubuntu Server 6.06 (eliza) and 2 Windows boxes (XP Home (dell) and Pro (decentinator)), which are connected via a D-Link DSL-G604T router. When setting up Ubuntu, it configured itself for DHCP, however as I intended to run it headless I changed it to use a static IP. (192.168.1.111) (Both Windows boxes use DHCP)

The problem is that I can't seem to ping (etc.) any of the Windows boxes from the Ubuntu one or vice versa. I tried resetting the Ubuntu box to DHCP to see whether that was the problem but that didn't resolve it. (In both cases they respond that the hostname wasn't found) However I am able to ping addresses on the internet.

Here are the contents of my /etc/hostname, /etc/resolv.conf and /etc/network/interfaces:

/etc/hostname:
Code:
eliza
/etc/resolv.conf:
Code:
nameserver 192.168.1.1
/etc/network/interfaces:
Code:
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.111
gateway 192.168.1.1
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
Thanks in advance.

1337_penguin

Last edited by 1337_penguin; 08-27-2006 at 03:53 PM.
 
Old 08-27-2006, 04:10 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
To ping by hostname you need to define the hostname that equals an IP of the host your are pinging. The file for this is /etc/hosts. But since the other machines are DHCP assigned then this will not work in the event the machines get different IPs from the DHCP server.They need to be statically assigned to work this way.

Brian1
 
Old 08-27-2006, 04:11 PM   #3
bernied
Member
 
Registered: Mar 2006
Location: Edinburgh, UK
Distribution: debian
Posts: 304

Rep: Reputation: 30
Easy fix:
add the IP addresses and names of the machines to /etc/hosts on the linux machine. Mine looks a bit like this:
Code:
192.168.0.2 shiny_m
192.168.0.100 MAX max
192.168.0.3 laptop
192.168.0.4 COMP1
192.168.0.1 ngrouter
add the IP address and name of the linux machine on the lmhosts file on the Windows machines.
On my XP home install this file is at C:\WINDOWS\system32\drivers\etc\
Look for help on this in Windows Help or look for lmhosts.sam on your system.

Last edited by bernied; 08-27-2006 at 04:14 PM.
 
Old 08-27-2006, 04:14 PM   #4
bernied
Member
 
Registered: Mar 2006
Location: Edinburgh, UK
Distribution: debian
Posts: 304

Rep: Reputation: 30
Sorry, what Brian1 says is right. Much easier to just give static addresses to everything on the network. I'm sure there is another way so you can still do DHCP, but it probably involves running your own DNS server or more complex stuff. Avoid if not necessary.
 
Old 08-27-2006, 04:53 PM   #5
1337_penguin
Member
 
Registered: Jul 2005
Location: Brighton, UK
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73

Original Poster
Rep: Reputation: 15
Thanks for the quick replies. I tried what Brian1 suggested and that works, however it is possible to ping between the Windows boxes by hostname even though their addresses aer assigned via DHCP.

I suppose I might as well just change the Windows boxes to use static IPs as well though.

Thanks for the help.

1337_penguin

Last edited by 1337_penguin; 08-27-2006 at 04:55 PM.
 
Old 08-27-2006, 08:37 PM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
I would think there might be a way. I have an idea but I know I am putting to much thought into. With a script one would use nmap to scan your subnet of IP in search of port 139. Take that data and run it through nmblookup and then through smbclient. With info from this one could build and updated copy /etc/hosts. But if you other info you will need to add it as well and create the new /etc/hosts file. I think I am doing to much here. Must be something simplier.

Brian1
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
can't ping local IP address but can ping remote hosts rob_xx17 Linux - Networking 4 12-02-2006 09:39 AM
PPP establish can ping the gateway router but unable to ping the host deepalalla Linux - Networking 0 11-18-2004 10:10 AM
dhcp client can't ping gateway but can ping other local hosts dirty_forks Linux - Networking 7 10-08-2004 11:54 AM
windows 98 m/c ping to ip address of red hat server but fails to ping hostname ravilohot Linux - Networking 2 09-07-2004 05:57 AM
Unable to ping hostname? robertmarkbram Linux - General 2 11-28-2003 01:06 AM

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

All times are GMT -5. The time now is 09:52 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