Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
10-10-2007, 04:24 AM
|
#1
|
|
Member
Registered: May 2005
Location: Sussex, England
Distribution: Ubuntu 7.10
Posts: 131
Rep:
|
Resolve hostname from IP
Simple questions can I resolve a hostname from an IP address
When I work with windows at work I can ping -a to resolve a hostname but I would like to do this with linux?
|
|
|
|
10-10-2007, 04:33 AM
|
#2
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,363
|
You can use nslookup (deprecated) or dig:
Code:
nslookup xx.xx.xx.xx
dig -x xx.xx.xx.xx
|
|
|
|
10-10-2007, 04:34 AM
|
#3
|
|
Member
Registered: May 2005
Location: Sussex, England
Distribution: Ubuntu 7.10
Posts: 131
Original Poster
Rep:
|
Cheers mate I will try that later
|
|
|
|
10-10-2007, 05:07 AM
|
#4
|
|
Member
Registered: May 2005
Location: Sussex, England
Distribution: Ubuntu 7.10
Posts: 131
Original Poster
Rep:
|
I tired both of those options but neither of them work
|
|
|
|
10-10-2007, 05:12 AM
|
#5
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,363
|
Please define "neither of them work". Did the commands ran, or they do not exist? You can also try
Last edited by bathory; 10-10-2007 at 05:14 AM.
|
|
|
|
10-10-2007, 05:15 AM
|
#6
|
|
Member
Registered: May 2005
Location: Sussex, England
Distribution: Ubuntu 7.10
Posts: 131
Original Poster
Rep:
|
Yes they both ran but neither displayed the hostname afterwards
host didnt work either
Last edited by cornish; 10-10-2007 at 05:16 AM.
|
|
|
|
10-10-2007, 05:36 AM
|
#7
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,363
|
You should get an answer like this:
Code:
dig -x 209.85.135.147
; <<>> DiG 9.2.2 <<>> -x 209.85.135.147
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49976
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0
;; QUESTION SECTION:
;147.135.85.209.in-addr.arpa. IN PTR
;; ANSWER SECTION:
147.135.85.209.in-addr.arpa. 86165 IN PTR mu-in-f147.google.com.
;; AUTHORITY SECTION:
135.85.209.in-addr.arpa. 86165 IN NS ns1.google.com.
135.85.209.in-addr.arpa. 86165 IN NS ns4.google.com.
135.85.209.in-addr.arpa. 86165 IN NS ns3.google.com.
135.85.209.in-addr.arpa. 86165 IN NS ns2.google.com.
;; Query time: 2 msec
;; SERVER: 193.0.0.195#53(193.0.0.195)
;; WHEN: Wed Oct 10 13:29:15 2007
;; MSG SIZE rcvd: 152
host 209.85.135.147
147.135.85.209.in-addr.arpa domain name pointer mu-in-f147.google.com.
|
|
|
|
10-10-2007, 05:44 AM
|
#8
|
|
Member
Registered: May 2005
Location: Sussex, England
Distribution: Ubuntu 7.10
Posts: 131
Original Poster
Rep:
|
I get this
Quote:
mark@nb10001L:/etc$ dig -x 10.179.108.11
; <<>> DiG 9.3.4 <<>> -x 10.179.108.11
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 55919
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;11.108.179.10.in-addr.arpa. IN PTR
;; AUTHORITY SECTION:
10.in-addr.arpa. 600 IN SOA prisoner.iana.org. hostmaster.root-servers.org. 2002040800 1800 900 604800 604800
;; Query time: 44 msec
;; SERVER: 10.179.104.46#53(10.179.104.46)
;; WHEN: Wed Oct 10 11:42:09 2007
;; MSG SIZE rcvd: 121
|
The host should be myPC
|
|
|
|
10-10-2007, 05:45 AM
|
#9
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Cornish might be wanting to do this on his lan without a nameserver running.
Maybe try "arp <ipaddress>" which will return the name and MAC address if the target is listed in the kernel arp table.
If it doesn't exist in the table, you could ping the ip first:
Code:
arp 192.168.1.103
192.168.1.103 (192.168.1.103) -- no entry
> ping -c 1 192.168.1.103
PING 192.168.1.103 (192.168.1.103) 56(84) bytes of data.
64 bytes from 192.168.1.103: icmp_seq=1 ttl=64 time=10.5 ms
--- 192.168.1.103 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 10.551/10.551/10.551/0.000 ms
> arp 192.168.1.103
Address HWtype HWaddress Flags Mask Iface
laser ether 00:0E:7F:42:6C:65 C eth0
Last edited by jschiwal; 10-10-2007 at 05:47 AM.
|
|
|
|
10-10-2007, 05:52 AM
|
#10
|
|
Member
Registered: May 2005
Location: Sussex, England
Distribution: Ubuntu 7.10
Posts: 131
Original Poster
Rep:
|
There is a DNS running on the LAN as I can ping the device via its hostname
|
|
|
|
10-10-2007, 10:21 AM
|
#11
|
|
Guru
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Rep: 
|
is the rDNS entry in the DNS server ? just because it can resolve a forward lookup doesn't mean they setup the reverse..
Your dig query shows 1 Question and 0 Answers.
Dig queried your internal DNS server (10.179.104.46) and your server basically responded "I don't Know"
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:02 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|