Most useful basic CMD commands used in networking?

In networking commands helps too much and if we know  few of the basic commands that will absolutely helps in doing huge tasks.
These are the cmd commands mostly used in networking and each and everyone should know.
  • ipconfig
  • netstat
  • tracert
  • ping
  • pathping
  • telnet
  • route
  • arp
  • nslookup
  • nbtstat
  • netsh
  • getmac
ipconfig

This utility allows you to get the IP address information of a Windows computer.
  • ipconfig /all  Display full configuration information.
  • ipconfig /release  Release the IP address for the specified adapter.
  • ipconfig /renew  Renew the IP address for the specified adapter.
netstat

The netstat command is a Command Prompt command used to display very detailed information about how your computer is communicating with other computers or network devices.


 syntax



netstat [-a] [-b] [-e] [-f] [-n] [-o] [-p proto] [-r] [-s] [-t] [-v] [interval]

  • -a     Displays all connections and listening ports
  • -b     Displays the executable involved in creating each connection or listening port. (Added in XP SP2.)
  • -e     Displays Ethernet statistics
  • -f     Displays Fully Qualified Domain Names for foreign addresses. (In Windows Vista/7 only)
  • -n     Displays addresses and port numbers in numerical form
  • -o     Displays the owning process ID associated with each connection
  • -p proto     Shows connections for the protocol specified by proto; proto may be any of: TCP, UDP, TCPv6, or UDPv6.
  • -r     Displays the routing table
  • -s     Displays per-protocol statistics
  • -t     Displays the current connection offload state, (Windows Vista/7)
  • -v     When used in conjunction with -b, will display sequence of components involved in creating the connection or listening port for all executables. (Windows XP SP2, SP3)
  • [interval]   An integer used to display results multiple times with specified number of seconds between displays. Continues until stopped by command ctrl+c. Default setting is to display once.
traceroute


A traceroute is a function which traces the path from one network to another through  which this command can show you the path of a packet of information takes from your computer to one you specify. It will list all the routers it passes through until it reaches its destination, or fails to or is discarded.



ping



A ping test uses your internet connection to send out some packets of data to a specific address. These packets are then sent back to your computer. The test records the amount the time it took for the packets to reach the address, and whether or not any packets were lost in the process.



pathping



Pathping is a TCP/IP based utility  that provides useful information about network latency and network loss at intermediate hops between a source address and a destination address.it displays the degree of packet loss at any given router or link.Pathping sends multiple Echo Request messages to each router between a source and destination over a period of time and computes aggregate results based on the packets returned from each router. Pathping performs the equivalent of the tracert command by identifying which routers are on the path.


Syntax


      PATHPING [-n] [-h max_hops] [-g host_list] [-p period]

         [-q num_queries] [-w timeout] [-i IPAddress] [-4 ] [-6 ][TargetName]


Key



   -g host_list - Loose source route along host-list.

   -h max_hops  - Maximum number of hops to search for target.
   -i address   - Use the specified source address.
   -n           - Do not resolve addresses to host names.
   -p period    - Wait period milliseconds between pings.
   -q num_queries - Number of queries per hop.
   -w timeout   - Wait timeout milliseconds for each reply.
   -P    - Test for RSVP PATH connectivity.
   -R    - Test if each hop is RSVP aware.
   -T    - Test connectivity to each hop with Layer-2 priority tags.
   -4    - Force using IPv4.
   -6    - Force using IPv6.


telnet



The telnet commands allow you to communicate with a remote computer that is using the Telnet protocol.



Syntax



telnet [host [port]]



host :- Specifies the hostname or IP address of the remote computer.

port :-      Specifies the port number or service name.

route

It manually configures the route in routing table.\

Syntax

route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]

Example : route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1
  • -f Clears the routing tables of all gateway entries.
  • -p When used with the ADD command, makes a route persistent across boots of the system. By default, routes are not preserved when the system is restarted. When used with the PRINT command, displays the list of registered persistent routes. Ignored for all other commands, which always affect the appropriate persistent routes. This option is not supported Windows'95.

arp

It stands for address resolution protocol.Displays current ARP cache tables for all interfaces an also used to display the ARP cache entry for a specific IP address
This protocol is used by network nodes to match IP addresses to MAC addresses. If two hosts on the same subnet cannot ping each other successfully, try running the arp -a command on each computer to see whether the computers have the correct media access control (MAC) addresses listed for each other. You can use Ipconfig to determine a host's correct MAC address.


But functionally it is devided in two parts.

The first part defines the phycial address means MAC address
And the other part answer the request from machine


Name
Effect
-d < IP address >
Delete
Removes the listed entry from the ARP cache
-s < MAC address >
Static
Adds a static entry to the ARP cache
-N < Interface IP address >
Interface
Lists all ARP entries for the interface specified
-a
Display
Displays all the current ARP entries for all interfaces
-g
Display
Displays all the current ARP entries for all interfaces


nslookup


It stands for  Name server lookup.This command line utility enables a user to look up an IP address of a domain or host on a network. The nslookup command also allows for a reverse lookup using an IP address to find the domain or host associated with that IP address.

syntax

nslookup [-opt ...] [{Host| [Server]}]

-opt       Specifies one or more Nslookup subcommands as a command-line option.
Host Looks up information for Host using the current default DNS server, if no other server is   specified. To look up a computer not in the current DNS domain, append a period to the name.
Server Specifies to use this server as the DNS name server. If you don't specify a server, the default DNS server is used.

nbtstat

Using IP address we can know which IP belongs to which user or PC?Yeah!!! we can ping an IP address but that will only tells you if there is connectivity. 
DOS command nbtstat is another command line utility that help us  finding the computer name associated with an IP address.

syntax

NBTSTAT [-a RemoteName] [-A IP address] [-c] [-n] [-r] [-R] [-s] [-S] [interval] ]
  • -a (adapter status) Lists the remote machine's name table given its name
  • -e (Adapter status) Lists the remote machine's name table given its
  • -A Displays addresses and port numbers in numerical form.
  • -c (cache) Lists the remote name cache including the IP addresses
  • -n (names) Lists local NetBIOS names.
  • -r (resolved) Lists names resolved by broadcast and via WINS
  • -R (Reload) Purges and reloads the remote cache name table
  • -S (Sessions) Lists sessions table with the destination IP addresses.
  • -s (sessions) Lists sessions table converting destination IP addresses to host names via the hosts file.
  • RemoteName Remote host machine name.
  • IP address Dotted decimal representation of the IP address.
  • interval Redisplays selected statistics, pausing interval seconds between each display. 

netsh


Netsh is a command-line scripting utility that allows us to  display or modify the network configuration of a computer that is currently running either it is locally or on remote.



syntax



netsh [-a AliasFile] [-c Context] [-r RemoteComputer] [{NetshCommand|-f ScriptFile}]

  • -a   : Returns you to the netsh prompt after running AliasFile.
  • AliasFile   : Specifies the name of the text file that contains one or more netsh commands.
  • -c   : Changes to the specified netsh context.
  • Context   : Specifies the netsh context. The following table lists the available netsh contexts.

getmac

Sometimes it is needed to know MAC address of the devices like computers, routers, switch or some others.At that time we use this command line utility.
you can just enter getmac  to know your own mac address or by typing getmac and IP address you can know the mac address of remote device.

Syntax

getmac[.exe] [/s Computer [/u Domain\User [/p Password]]] [/fo {TABLE|LIST|CSV}] [/nh] [/v]

  • /s   Computer   : Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
  • /u   Domain \ User   : Runs the command with the account permissions of the user specified by User or Domain\User. The default is the permissions of the current logged on user on the computer issuing the command.
  • /p   Password   : Specifies the password of the user account that is specified in the /u parameter.
  • /fo { TABLE | LIST | CSV } : Specifies the format to use for the query output. Valid values are TABLE, LIST, and CSV. The default format for output is TABLE.
  • /nh   : Suppresses column header in output. Valid when the /fo parameter is set to TABLE or CSV.
  • /v   : Specifies that the output display verbose information.
  • /? : Displays help at the command prompt.



Comments