India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Somalia English
Canada English
Canada Français
Netherlands Nederlands

DNS commands

And now, here are the commands. To use them, open your terminal on Linux/Mac or command line in Windows.

  1. Ping

This is by far the most common command used to quickly check for reachability of an IP. You can ping an IP, domain name, host name or even name server.

Usage: On Linux/Mac, open Terminal and type as follows:

[user@hostname ~]$ ping -c 4 127.0.0.1

[user@hostname ~]$ ping -c 4 truehost.co.ke

[user@hostname ~]$ ping -c 4 ns15.truehost.cloud

Note: You need to specify how many ping test should be run before ping stops. Otherwise you will need to manually stop the ping process by typing Ctrl+Z as it will continually ping

On windows open Command Line and type:

ping 127.0.0.1

ping truehost.co.ke

ping ns15.truehost.cloud

Other than checking the reachability of an IP, the ping command also displayed the IP address of the domain name or name server.

  1. Nslookup

This one is used to query the IP address, name servers and host name. If used to query a domain name or host name, it will provide an IP address for as a result if the domain name/host name is valid and reachable. If used to query an IP, it will provide the host name, PTR and name servers for the server owning the IP.

  1. traceroute / tracert

This one shows the path taken by a packet from your computer to the server. Typically, it displays the route taken by a packet to reach destination.

Usage: On Linux/Mac, the command is used as traceroute while on Windows, the command is used as tracert. To use, open Terminal and type

[user@hostname ~]$ traceroute truehost.co.ke

[user@hostname ~]$ traceroute 127.0.0.1

  1. host

This is probably the most powerful DNS tool available for Linux machines. It is a DNS lookup utility that us used to lookup all types of DNS records. All you’ll need to do is provide the correct option.

Usage:

  • Get associated IP addresses and MX records for a domain e.g.

    [user@hostname ~]$ host truehost.co.ke

    truehost.co.ke has address 82.165.21.183

    truehost.co.ke mail is handled by 0 truehost.co.ke.

  • Use -t ns option to find domain name servers

    [user@hostname ~]$$ host -t ns truehost.co.ke

    truehost.co.ke name server ns25.truehost.cloud.

    truehost.co.ke name server ns24.truehost.cloud.

  • Use -t cname option to find the domain cname

    [user@hostname ~]$ host -t cname truehost.cloud

    truehost.cloud has no CNAME record

    [user@hostname ~]$host -t cname mail.google.com

    mail.google.com is an alias for googlemail.l.google.com.

  • Use -t mx option to find the MX records for a domain

    [user@hostname ~]$ host -t mx truehost.co.ke

    truehost.co.ke mail is handled by 0 truehost.co.ke.

  • Use -t txt to find the domains TXT record

    [user@hostname ~]$ host -t txt truehost.co.ke

    truehost.co.ke descriptive text “v=spf1 ip4:82.165.21.183 +a +mx +ip4:158.69.223.194 ~all”

  • Use -C option to find the SOA records

    [user@hostname ~]$host -C truehost.co.ke

    Nameserver 82.165.21.183:

    truehost.co.ke has SOA record ns24.truehost.cloud. truehostcloud.gmail.com. 2018030514 3600 7200 1209600 86400

    Nameserver 82.165.21.183:

    truehost.co.ke has SOA record ns24.truehost.cloud. truehostcloud.gmail.com. 2018030514 3600 7200 1209600 86400

  • Query a particular name server

    [user@hostname ~]$host truehost.co.ke ns24.truehost.cloud

    Using domain server:

    Name: ns24.truehost.cloud

    Address: 82.165.21.183#53

    Aliases:

    truehost.co.ke has address 82.165.21.183

    truehost.co.ke mail is handled by 0 truehost.co.ke.

Share some Love

Leave a comment

Your email address will not be published. Required fields are marked *

× WhatsApp us