Saturday, May 31, 2014

Network Troubleshooting Commands

The following are the basic commands that helps to locate network issues. To open the command line interface or consoles:
* Ubuntu : 'Ctrl + Alt + T'
* Windows Systems : 'Window key + R' --> type 'cmd' and click 'OK/Run'

ifconfig / ipconfig

It is generally the very first to check whether the computer's network interface has got a valid IP address to establish communication with other devices in the network. MAC (physical) address of the network can also be found using these commands.

On Unix based systems,

e.g.1: ifconfig ==> Displays all the network interfaces, such as Ethernet and Loopback, MAC addresses, IP addresses, and subnet masks. Depending on the flavour of Unix and type of interface, some additional details such as number of packets transmitted and received, errors, active/disabled status, and size of the maximum transmittable unit (MTU) can also be found.

e.g.2: ifconfig eth0 down ==> Disables the Ethernet interface 'eth0'. Super user (root) only.

e.g.3: ifconfig eth0 up ==> Enables the Ethernet interface 'eth0'. Super user (root) only.

e.g.4: ifconfig eth0 netmask ==> Assigns IP address and netmask manually. Super user (root) only.

On Windows systems,

e.g.1: ipconfig ==> Displays the IP address, netmask, and default gateway of all the network interfaces.

e.g.2: ipconfig /all ==> Displays more information about the network interfaces, including MAC address, DHCP status, and DNS servers used.

e.g.3: ipconfig /renew ==> Re-establishes TCP/IP connections on all network adapters and refreshes IP address with the DHCP server.

e.g.4: ipconfig /flushdns ==> Flushes the DNS cache stored locally (URL to IP address conversion)


It is the basic command to check network reachability based on echos received from a network interface. It works in both Unix and Windows systems. However, command switches for a given additional option, such continuous ping, may vary.

On both Unix and Windows based systems,

e.g.1: ping ==> reveals whether the IP protocol is up on you own computer (localhost). On Unix, continuously sends echo requests until terminated with 'Ctrl + C'.

e.g.2: ping ==> shows whether you can reach's server over the internet

On Windows,

e.g.1: ping -t ==> On windows, continuously sends echo requests until terminated with 'Ctrl + C'.

  • If no response for a well known server, then ping to the gateway IP addess found from the ifconfig / ipconfig command above. This reveals the connectivity to your network gateway.
  • When URL is used with the ping command instead of an IP address, and it does not get resolved into an IP address, then the Domain Name System (DNS) resolution could be tested. 

traceroute / tracert

A command to identify the hops in the network, and in case of failures the output indicates the intermediate hops which packets travel successfully.

On Unix based systems,

e.g.1: traceroute ==> Names of hops along the network path and time taken to receive an echo response from them

On Windows, 

e.g.1: tracert ==> Names of hops along the network path and time taken to receive an echo response from them


Returns the corresponding IP address for a given URL (also vice-versa).

On both Unix and Windows based systems,

e.g.1: nslookup 


A command to visualize the details of the ongoing network communication.

On both Unix and Windows based systems,

e.g.1: netstat ==> Details of all the established TCP connections

e.g.2: netstat -r ==> The routing table of your computer, including the default route and gateway details.


Displays the IP address to MAC address conversion, and vice versa.

e.g.1: arp -a ==> Displays all the IP addresses and corresponding MAC addresses of the known network interfaces in the local broadcast domain


Gives the name assigned to your computer.

e.g.1: hostname ==> Hostname of your system

whoami / set U

Reveals the username currently used by you.

On Unix systems:

e.g.1: whoami ==> Shows your username (or 'root' in the case of superuser)

On Windows systems,

e.g.2: set U ==> Shows your username, domain, and user profile location.

No comments:

Post a Comment