Linux – DNS – commands

When Hostname is converted to IP = Forward Lookup
When IP is converted to Hostname = Reverse Lookup

Fetch MX records

#host -t mx facebook.com
facebook.com mail is handled by 10 msgin.t.facebook.com.

Fetch A records

#host -t a facebook.com
facebook.com has address 173.252.110.27

Get List of Nameservers

#dig NS facebook.com

; <<>> DiG 9.9.2-P1 <<>> NS facebook.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34603
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;facebook.com.            IN    NS

;; ANSWER SECTION:
facebook.com.        2949    IN    NS    a.ns.facebook.com.
facebook.com.        2949    IN    NS    b.ns.facebook.com.

;; Query time: 14 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Fri Dec 27 15:37:14 2013
;; MSG SIZE  rcvd: 76

Get Domain Registrar for a Domain

#whois youtube.com
Domain Name: youtube.com
Registrar Name: Markmonitor.com
Registrar Whois: whois.markmonitor.com
Registrar Homepage: http://www.markmonitor.com

Get Info on an IP

#whois 173.252.110.27
NetRange:       173.252.64.0 - 173.252.127.255
CIDR:           173.252.64.0/18
OriginAS:       AS32934
NetName:        FACEBOOK-INC
NetHandle:      NET-173-252-64-0-1
Parent:         NET-173-0-0-0-0
NetType:        Direct Assignment
RegDate:        2011-02-28
Updated:        2012-02-24
Ref:            http://whois.arin.net/rest/net/NET-173-252-64-0-1

OrgName:        Facebook, Inc.
OrgId:          THEFA-3
Address:        1601 Willow Rd.
City:           Menlo Park
StateProv:      CA
PostalCode:     94025
Country:        US
RegDate:        2004-08-11
Updated:        2012-04-17
Ref:            http://whois.arin.net/rest/org/THEFA-3

OrgTechHandle: OPERA82-ARIN
OrgTechName:   Operations
OrgTechPhone:  +1-650-543-4800 
OrgTechEmail:  noc@fb.com
OrgTechRef:    http://whois.arin.net/rest/poc/OPERA82-ARIN

OrgAbuseHandle: OPERA82-ARIN
OrgAbuseName:   Operations
OrgAbusePhone:  +1-650-543-4800 
OrgAbuseEmail:  noc@fb.com
OrgAbuseRef:    http://whois.arin.net/rest/poc/OPERA82-ARIN


#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/whois_tou.html
#
Advertisements

One thought on “Linux – DNS – commands

  1. Another potentially handy look up — look up a netname. For example,

    let’s say you do a WHOIS on an IP and get output like this –>

    whois 76.74.254.123

    ServerBeach PEER1-SERVERBEACH-08A (NET-76-74-248-0-1) 76.74.248.0 – 76.74.255.255
    Automattic, Inc PEER1–AUTOMATTIC-SERVERBEACH-ACCOUNT–01 (NET-76-74-254-0-1) 76.74.254.0 – 76.74.254.127
    Peer 1 Network (USA) Inc. PEER1-BLK-10 (NET-76-74-128-0-1) 76.74.128.0 – 76.74.255.255

    You can then look up the netname for ServerBeach to get their contact information (such as their abuse address) –>

    whois -h whois.arin.net NET-76-74-248-0-1

    You’ll get output like this (output shortened a bit here) –>

    NetRange: 76.74.248.0 – 76.74.255.255
    CIDR: 76.74.248.0/21
    OriginAS: AS13768
    NetName: PEER1-SERVERBEACH-08A
    NetHandle: NET-76-74-248-0-1
    Parent: NET-76-74-128-0-1
    NetType: Reallocated
    RegDate: 2007-12-05
    Updated: 2009-12-23
    Ref: http://whois.arin.net/rest/net/NET-76-74-248-0-1

    OrgName: ServerBeach
    OrgId: SERVER-17
    Address: 8500 Vicar Drive 8500, Suite 500
    City: San Antonio
    StateProv: TX
    PostalCode: 78218
    Country: US
    RegDate: 2002-05-29
    Updated: 2012-05-14
    Ref: http://whois.arin.net/rest/org/SERVER-17

    OrgAbuseHandle: SNAE-ARIN
    OrgAbuseName: Serverbeach Network AUP Enforcement
    OrgAbusePhone: +1-604-484-2588
    OrgAbuseEmail: abuse@serverbeach.com
    OrgAbuseRef: http://whois.arin.net/rest/poc/SNAE-ARIN

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s