basic network commands
basic network commands
1. Tracert
2. Ping
3. Ipconfig
4. Arp
5. Netstat
6. NSLOOKUP
7. HOSTNAME
8. SYSTEMINFO
Explained with Examples
tracert
This command is used to diagnose path-related problems. On an IP
network, routers exchange IP packets between the source and the
destination. They take IP packets from the source host and forward them
in a sequence until they reach the destination host. The sequence of
routers between the source and destination is known as the path. A path
consists of all routers in a sequence that IP packets sent from the source
host traverse to reach the destination host.
The tracert command prints the path. If all routers on the path are
functional, this command prints the full path. If a router is down on the
path, this command prints the path up to the last operational router.
tracertwww.google.co.in
The following image shows the output of this command.
Ping
The ping command is used to test connectivity between two hosts. It
sends ICMP echo request messages to the destination. The destination
host replies with ICMP reply messages. If the ping command gets a reply
from the destination host, it displays the reply along with round-trip
times.
Ipconfig
This command displays all current TCP/IP network configuration values
and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain
Name System (DNS) settings. This command is mainly used to view the
IP addresses on the computers that are configured to obtain their IP
address automatically.
Used Displays the IP address, subnet mask, and default gateway for a
without
parameters
/renew Renews DHCP configuration for all adapters (if an adapter is not
[Adapter] specific adapter if the Adapter parameter is included.
/flushdns Flushes and resets the contents of the DNS client resolver cache
Arp
To send IP packets, a computer needs two addresses. These addresses
are the MAC address and the IP address. A MAC address is the physical
or hardware address of the NIC. An IP address is the logical or software
address of NIC. If a computer knows the IP address of the destination
computer but it does not know the MAC address of the destination
computer, it uses the ARP protocol to know the MAC address of the
destination computer.
The ARP protocol broadcasts a given IP address over a local network. The
corresponding host responds to the broadcast with its MAC address. To
avoid repetition, ARP stores the answer in a table known as ARP table.
ARP maintains a separate ARP table for each NIC.
To view the ARP table, you can use the following command.
arp
By default, this command displays the ARP table of the active NIC. If
multiple NICs are installed on the computer, you can use the -a option
with this command. If the -a option is used, the ARP command displays
all ARP tables.
The following image shows the output of the arp command when used
with the -a option.
To display the ARP cache entry for a specific IP address, specify the IP
address with the -N option. For example, the following command
displays the ARP cache table for the interface that is assigned the IP
address 192.168.42.171.
Arp -a -N 192.168.42.171
The following image shows the output of the above command.
Netstat
This command displays active connections, ports on which the computer
is listening, Ethernet statistics, the IP routing table, and IP statistics.
The output of this command is organized in rows and columns. Each row
represents a new connection or an entry in the output. It contains four
columns. These columns provide the following information about the
row.
Proto: - This column displays the name of the protocol (TCP or UDP).
-a Displays all active TCP connections and the TCP and UDP ports on which
listening.
-o Displays active TCP connections and includes the process ID (PID) for ea
NSLOOKUP
The NSLOOKUP command is used to troubleshoot network connectivity issues in
the system. Using the nslookup command, we can access the information related
to our system’s DNS server, i.e., domain name and IP address.
HOSTNAME
The HOSTNAME command displays the hostname of the system. The hostname
command is much easier to use than going into the system settings to search for it.
Command to enter in Prompt - hostname
SYSTEMINFO
Using the SYSTEMINFO command, we can access the system’s hardware and
software details, such as processor data, booting data, Windows version, etc.