Looking up IP addresses
Archive - Originally posted on "The Horse's Mouth" - 2005-06-01 08:44:40 - Graham EllisBrowsers, mail clients, ftp and ssh and telnet clients and the rest are for ever converting fully qualified names such as www.sheepbingo.co.uk into IP addresses such as 212.227.118.78. How can you do such a lookup manually?
Firstly, there are numerous web sites out there that will help you - I'm not supplying any links here because I'm sure you already have your own favourite. But did you know that there are ... not one ... not two ... but three utilities under Linux to do the job for you?
The host command does a quick and dirty lookup:
[trainee@saturday trainee]$ host www.sheepbingo.co.uk
www.sheepbingo.co.uk has address 212.227.118.78
[trainee@saturday trainee]$
The dig command tells you a lot more:
[trainee@saturday trainee]$ dig www.sheepbingo.co.uk
; <<>> DiG 9.2.1 <<>> www.sheepbingo.co.uk
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<<- opcode: QUERY, status: NOERROR, id: 31254
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.sheepbingo.co.uk. IN A
;; ANSWER SECTION:
www.sheepbingo.co.uk. 10476 IN A 212.227.118.78
;; Query time: 17 msec
;; SERVER: 158.152.1.43#53(158.152.1.43)
;; WHEN: Wed Jun 1 08:42:54 2005
;; MSG SIZE rcvd: 54
[trainee@saturday trainee]$
And the deprecated nslookup give interactive facilites too
[trainee@saturday trainee]$ nslookup www.sheepbingo.co.uk
Note: nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead. Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
Server: 158.152.1.43
Address: 158.152.1.43#53
Non-authoritative answer:
Name: www.sheepbingo.co.uk
Address: 212.227.118.78
[trainee@saturday trainee]$