Experiment 2
Experiment 2
EXPERIMENT-2
AIM: Work with the commands Ping, Tracert, Ipconfig, pathping , telnet , ftp , getmac , ARP ,
Hostname , Nbtstat , netdiag and Nslookup
Command ping:
"Ping" is a network diagnostic command used to test connectivity to a specific device by
sending out packets and measuring the time it takes for the response to return, essentially
checking if a host is reachable on the network; you can access it through the command
prompt on most operating systems, and typically use it by typing "ping" followed by the IP
address or domain name of the target device you want to test.
Tracert:
Tracert (short for "trace route") is a network diagnostic command-line tool used to track the
route packets take to reach a destination across an IP network. It is helpful for
G.Devans,23HQ1A4614
[Type here]
G.Devans,23HQ1A4614
[Type here]
Copy code
tracert <destination>
• <destination>: The IP address or hostname of the target you want to trace.
Example Output:
plaintext
Copy code
Tracing route to example.com [93.184.216.34]
over a maximum of 30 hops:
Use Cases:
• Diagnosing Network Issues: Identifies where packet loss or high latency occurs.
• Verifying Routes: Ensures data is taking the expected path.
• ISP Troubleshooting: Helps pinpoint if the issue lies within the ISP's network or
elsewhere.
Alternatives:
• Linux/MacOS: The equivalent tool is traceroute.
• Advanced Tools: Tools like MTR (My Traceroute) provide more continuous and
detailed diagnostics.
Ipconfig:
3
G.Devans,23HQ1A4614
[Type here]
G.Devans,23HQ1A4614
[Type here]
Syntax:
bash
Copy code
ipconfig [options]
Common Commands and Options:
Basic Network Information:
bash
Copy code
ipconfig
• Displays basic network configuration for all active network adapters.
Release IP Address:
bash
Copy code
ipconfig /release
• Releases the current IP address obtained via DHCP. This is helpful if you want to
disconnect from the network temporarily or request a new IP.
G.Devans,23HQ1A4614
[Type here]
Renew IP Address:
bash
Copy code
ipconfig /renew
• Requests a new IP address from the DHCP server. Use this after releasing the IP or
when troubleshooting connectivity issues.
Example Output:
plaintext
Copy code
Windows IP Configuration
G.Devans,23HQ1A4614
[Type here]
Pathping:
Pathping is a network diagnostic tool commonly used to troubleshoot network connectivity
issues. It combines the functionality of two other tools: Ping and Traceroute, providing
detailed information about the path and latency of packets traveling through a network.
G.Devans,23HQ1A4614
[Type here]
G.Devans,23HQ1A4614
[Type here]
3. Finally, it calculates statistics, such as packet loss and round-trip time, for each hop.
Common Usage (Command Line):
To use Pathping, you typically run it in a Command Prompt or Terminal window. For
example:
bash
Copy code
pathping <destination>
• Replace <destination> with an IP address or domain name (e.g., pathping
google.com).
Output:
The output of Pathping includes:
• A list of hops along the route.
• Statistics about each hop, including latency and packet loss.
• Detailed metrics to help identify where issues may be occurring.
Benefits:
• Ideal for troubleshooting complex networks.
• Helps network administrators pinpoint where connectivity issues arise.
• Provides more comprehensive data compared to standalone Ping or Traceroute tools.
Telnet:
TELNET (short for TELecommunication NETwork) is a network protocol used for remote
communication with another computer over a network. It enables users to establish a
command-line-based communication session with a remote device, such as a server, router,
or switch.
G.Devans,23HQ1A4614
[Type here]
G.Devans,23HQ1A4614
[Type here]
FTP:
FTP (File Transfer Protocol) is a standard network protocol used to transfer files between a
client and a server over a computer network, typically the Internet. FTP allows users to
upload, download, or manage files on a remote server. Here's a breakdown:
11
G.Devans,23HQ1A4614
[Type here]
12
G.Devans,23HQ1A4614
[Type here]
GETMAC :
getmac is a term that can refer to a command or a Python module, depending on the
context. Here's an explanation of both:
13
G.Devans,23HQ1A4614
[Type here]
In Windows, the getmac command is used to display the MAC (Media Access Control)
addresses of your network interfaces. The MAC address is a unique identifier assigned to a
network interface card (NIC) for communication on the physical network.
How to use the getmac command:
1. Open Command Prompt or PowerShell.
2. Type getmac and press Enter.
Output:
The command will display a list of network adapters with their respective MAC addresses
and transport names. For example:
css
Copy code
Physical Address Transport Name
----------------- --------------------------------
00-14-22-01-23-45 \Device\Tcpip_{GUID}
14
G.Devans,23HQ1A4614
[Type here]
python
Copy code
from getmac import get_mac_address
ARP:
ARP stands for Address Resolution Protocol. It is a network protocol used in computer
networking to map an IP address to a MAC address. This mapping is essential for
communication within a local network (LAN).
15
G.Devans,23HQ1A4614
[Type here]
16
G.Devans,23HQ1A4614
[Type here]
o ARP Reply: A unicast response containing the MAC address of the queried
device.
4. ARP Table: A cache stored in each device that contains recently resolved IP-to-MAC
address mappings to speed up future communications.
5. Use Cases:
o Enabling communication in a local network.
o Required for protocols like IPv4 to work effectively at the data-link layer
(Layer 2 of the OSI model).
6. Limitations:
o ARP works only within a single network or broadcast domain (e.g., a LAN).
o It is susceptible to ARP spoofing or ARP poisoning attacks, where an attacker
can send fake ARP messages to disrupt or intercept network traffic.
Hostname:
A hostname is the unique name assigned to a device (such as a computer, server, or other
networked device) on a network. It serves as a human-readable identifier for the device,
allowing it to be recognized and accessed over a network.
The hostname is part of a fully qualified domain name (FQDN), which also includes the
domain name (like example.com). For instance, if the hostname of a server is server01 and
the domain is example.com, its FQDN would be server01.example.com.
In a local network, the hostname might be used to access a machine without needing to
know its IP address, such as hostname.local or just hostname (depending on the setup).
In summary:
• Hostname: The name assigned to a device on a network.
• FQDN: A complete address that includes the hostname and domain.
Nbtstat:
nbtstat is a command-line utility used in Microsoft Windows to troubleshoot and display
information about the NetBIOS over TCP/IP (NetBT) protocol. NetBIOS (Network Basic
17
G.Devans,23HQ1A4614
[Type here]
Netdiag:
Netdiag is a diagnostic tool used in Microsoft Windows operating systems for
troubleshooting network-related issues. It helps in analyzing and diagnosing network
connectivity problems. The tool can test various network components like IP configuration,
DNS, routing, and network adapter settings.
18
G.Devans,23HQ1A4614
[Type here]
It’s a command-line utility and is part of the Microsoft Windows Server Support Tools.
While it’s not typically included in standard Windows client versions, it can be installed on
Windows Server or downloaded from the Microsoft website.
Key features of Netdiag include:
1. Network adapter testing: It checks if the network adapters are working properly.
2. DNS resolution tests: It can check if DNS queries are successful.
3. Network connectivity tests: It tests the ability of a computer to communicate with
other network devices or servers.
4. Routing tests: It verifies routing information and checks if proper routes exist.
It’s typically used by network administrators or advanced users when troubleshooting
network problems, and it provides detailed diagnostic information that can help identify and
resolve connectivity issues.
Nslookup:
nslookup (short for "name server lookup") is a command-line tool used to query Domain
Name System (DNS) servers to obtain domain name or IP address information. It helps in
troubleshooting DNS-related issues, such as resolving domain names into IP addresses or
vice versa.
19
G.Devans,23HQ1A4614
[Type here]
20
G.Devans,23HQ1A4614
[Type here]
▪ This returns the mail exchange (MX) records for the domain, showing
the mail servers responsible for receiving emails for that domain.
Key Features:
• Works with both IPv4 and IPv6 addresses.
• Provides various record types (A, MX, CNAME, etc.).
• Helpful for diagnosing DNS resolution issues, identifying misconfigured DNS settings,
or verifying domain information.
21
G.Devans,23HQ1A4614