And now, here are the commands. To use them, open your terminal on Linux/Mac or command line in Windows.
- 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.
- 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.
- 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
- 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.