0% found this document useful (0 votes)
47 views21 pages

Experiment 2

The document outlines various network diagnostic commands including Ping, Tracert, Ipconfig, Pathping, Telnet, FTP, Getmac, ARP, and Hostname. Each command is described with its purpose, usage, and examples, providing essential information for network troubleshooting and management. Key features, limitations, and use cases for each command are also highlighted to assist users in understanding their functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views21 pages

Experiment 2

The document outlines various network diagnostic commands including Ping, Tracert, Ipconfig, Pathping, Telnet, FTP, Getmac, ARP, and Hostname. Each command is described with its purpose, usage, and examples, providing essential information for network troubleshooting and management. Key features, limitations, and use cases for each command are also highlighted to assist users in understanding their functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

[Type here]

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]

troubleshooting network connectivity issues, identifying network latency points, and


understanding the path data travels through the internet or a local network.

How Tracert Works:


1. Packet Sending: Tracert sends packets to the destination address with increasing
Time-to-Live (TTL) values. TTL determines the maximum number of hops (routers) a
packet can traverse before being discarded.
2. Response from Routers: Each router along the path decrements the TTL by 1. When
the TTL reaches 0, the router sends back an Internet Control Message Protocol
(ICMP) "Time Exceeded" message to the sender.
3. Identifying the Path: Tracert records the router's IP address, hostname (if available),
and the time taken for the response. It repeats this process for each hop until it
reaches the destination or the maximum number of hops.
Syntax (Windows Command Prompt):
bash

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:

1 <1 ms <1 ms <1 ms router.local [192.168.1.1]


2 10 ms 15 ms 11 ms isp-gateway.example [203.0.113.1]
3 25 ms 30 ms 28 ms core-router.example [203.0.113.2]
4 50 ms 60 ms 55 ms destination.example [93.184.216.34]
Trace complete.

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]

Ipconfig (short for "Internet Protocol configuration") is a command-line tool in Windows


operating systems used to view and manage the network configuration of a computer. It is
essential for troubleshooting network connectivity issues, displaying IP addresses, and
releasing or renewing DHCP (Dynamic Host Configuration Protocol) leases.

Common Uses of Ipconfig:


1. View Network Information:
o Displays the IP address, subnet mask, default gateway, and DNS servers
assigned to your network adapters.
2. Troubleshoot Connectivity:
o Identify if the computer has a valid IP address.
o Check if the gateway or DNS server is accessible.
3. Release/Renew IP Address:
o Use with DHCP to release an old IP address and request a new one.
4. Flush DNS Cache:
o Clear the DNS resolver cache to resolve issues with outdated or incorrect DNS
entries.

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.

Detailed Network Information:


bash
Copy code
ipconfig /all
• Provides detailed information about each network adapter, including MAC address,
DHCP status, lease expiration, and more.

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.

Flush DNS Cache:


bash
Copy code
ipconfig /flushdns
• Clears the DNS resolver cache, ensuring that the computer queries DNS servers for
updated information.

Display DNS Cache:


bash
Copy code
ipconfig /displaydns
• Shows the contents of the DNS resolver cache, listing recently resolved domain
names.

Example Output:
plaintext
Copy code
Windows IP Configuration

G.Devans,23HQ1A4614
[Type here]

Ethernet adapter Ethernet:

Connection-specific DNS Suffix . : example.local


IPv4 Address. . . . . . . . . . . : 192.168.1.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

When to Use Ipconfig:


• Network Setup: Verify your IP address and default gateway.
• Troubleshooting: Diagnose network connectivity issues (e.g., "No Internet Access").
• Reset Connections: Renew the IP or flush the DNS cache when experiencing errors

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]

Key Features of Pathping:


1. Packet Path Analysis: It identifies the route (hops) packets take to reach the
destination.
2. Latency and Packet Loss Measurement: It measures the latency and packet loss at
each hop on the route.
3. Detailed Metrics: Unlike Ping or Traceroute, Pathping provides more detailed
statistics about each hop after analyzing the data over time.
4. Layered Insight: Helps in identifying problematic nodes in a network, such as those
causing delays or packet drops.
How Pathping Works:
1. It first performs a Traceroute to determine the route to the destination.
2. Then it sends multiple Ping packets to each hop over a specified period.

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]

Key Features of TELNET:


1. Remote Access: TELNET allows users to log in to remote computers and manage
them as if they were physically present at the device.
2. Protocol: It operates over TCP/IP and typically uses port 23 for communication.
3. Command-Line Interface: TELNET provides a text-based interface for interacting with
the remote machine.
4. Lack of Encryption: TELNET transmits data, including usernames and passwords, in
plain text, making it vulnerable to eavesdropping and security breaches. This is why it
has largely been replaced by more secure protocols like SSH (Secure Shell).
5. Use Cases:
o Managing network devices (before SSH became standard).
o Testing and troubleshooting basic connectivity in a network.
o Connecting to legacy systems that only support TELNET.
10

G.Devans,23HQ1A4614
[Type here]

How TELNET Works:


• A client initiates a TELNET session by connecting to a server using a TELNET client
application.
• Once the connection is established, the client can execute commands on the server,
and the server responds by sending the output back to the client.
Example:
1. To initiate a TELNET session, you can use the command:
bash
Copy code
telnet <hostname> <port>
For example:
bash
Copy code
telnet 192.168.1.1 23
Limitations of TELNET:
• Security Risks: TELNET does not encrypt the communication, making it susceptible to
interception.
• Obsolescence: Modern systems typically use SSH for secure communication.
Alternatives to TELNET:
• SSH (Secure Shell): A secure protocol for remote access and command execution.
• RDP (Remote Desktop Protocol): For graphical remote access.
• HTTP/HTTPS: For web-based management interfaces.

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]

Key Features of FTP:


1. File Transfers:
o Upload files from a local computer to a server.
o Download files from a server to a local computer.
2. Connection Modes:
o Active Mode: The client opens a port and waits for the server to connect.
o Passive Mode: The server opens a port and waits for the client to connect,
often used to bypass firewalls.
3. Authentication:

12

G.Devans,23HQ1A4614
[Type here]

o Requires a username and password to access files (though anonymous FTP is


also possible).
o Secure versions, like FTPS (FTP Secure), encrypt the credentials and data.
4. Command-Based Operations:
o Users can interact with an FTP server using commands (e.g., GET to download
or PUT to upload files).
5. Access Methods:
o FTP clients: Standalone applications like FileZilla or WinSCP.
o Command-line tools: Built into operating systems.
o Web browsers: Some browsers support FTP URLs (though less common now).
Limitations:
• Lack of Security: Traditional FTP transfers data in plain text, making it vulnerable to
interception.
• Obsolescence: Modern protocols like SFTP (Secure FTP) and HTTPS are often
preferred for secure file transfers.
Use Cases:
• Web development: Uploading website files to a hosting server.
• Data sharing: Moving large files between systems.
• Backups: Transferring backup files to remote storage.

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:

1. getmac Command (Windows)

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}

2. getmac Python Module


The getmac module is a Python library used to programmatically obtain the MAC address of
a network interface or device.
Installation:
You can install it via pip:
bash
Copy code
pip install getmac
Usage:
Here’s an example of how to use it:

14

G.Devans,23HQ1A4614
[Type here]

python
Copy code
from getmac import get_mac_address

# Get the MAC address of the default network interface


mac = get_mac_address()
print(f"The MAC address is: {mac}")

# Get the MAC address of a specific interface


mac_specific = get_mac_address(interface="eth0")
print(f"The MAC address of eth0 is: {mac_specific}")

When to use getmac:


• Command: Use when you quickly need MAC addresses in a Windows environment.
• Python Module: Use in scripts or programs where you need to access or process
MAC addresses programmatically.

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]

Key Points About ARP:


1. Purpose: ARP allows devices to communicate within a network by resolving an IP
address (logical address) into a MAC address (physical address), which is required for
data transmission over Ethernet or Wi-Fi networks.
2. How It Works:
o When a device wants to communicate with another device on the same
network, it checks its ARP table (a cache of recently resolved IP-to-MAC
address mappings).
o If the mapping is not found, the device broadcasts an ARP Request to the
network, asking "Who has this IP address? Tell me your MAC address."
o The device with the matching IP address replies with an ARP Reply, providing
its MAC address.
3. Components:
o ARP Request: A broadcast message sent to all devices in the LAN.

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]

Input/Output System) is an old networking protocol that allows applications on different


computers to communicate within a local area network (LAN).
nbtstat is commonly used for the following purposes:
1. Viewing NetBIOS Name Table: It displays the local computer's NetBIOS name table,
which maps NetBIOS names to IP addresses.
2. Displaying NetBIOS Statistics: It shows the current statistics of the NetBIOS over
TCP/IP connections, such as the number of sessions and errors.
3. Resolving NetBIOS Names: It helps resolve NetBIOS names to IP addresses, which
can be useful for troubleshooting network issues or identifying the source of a
problem.
Some common nbtstat commands include:
• nbtstat -a [IP address]: Displays the NetBIOS name table for a remote system by
specifying its IP address.
• nbtstat -A [IP address]: Shows the NetBIOS name table for a system identified by its
IP address in numeric form.
• nbtstat -n: Displays the local NetBIOS name table (the names that the local system
has registered).
• nbtstat -r: Shows the NetBIOS resolution statistics, including the number of names
successfully resolved via WINS (Windows Internet Name Service) and broadcasts.
• nbtstat -s: Displays NetBIOS session statistics, such as information about active
NetBIOS sessions.
This utility is most often used for troubleshooting network-related issues, especially when
dealing with older networks or legacy systems that still rely on NetBIOS.

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]

Common use cases of nslookup:


1. Finding the IP address associated with a domain:
o Command: nslookup example.com
o Result: Returns the IP address for the domain "example.com".
2. Reverse DNS lookup (getting the domain name for an IP address):
o Command: nslookup 192.168.1.1
o Result: Returns the domain name associated with the given IP address.
3. Querying a specific DNS server:
o Command: nslookup example.com 8.8.8.8
o Result: Queries Google's DNS server (8.8.8.8) for the IP of "example.com".
4. Get more detailed information using the set options:
o Example: nslookup -type=mx example.com

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

You might also like