0% found this document useful (0 votes)
13 views5 pages

Exp No 2

Uploaded by

ramesh.n
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)
13 views5 pages

Exp No 2

Uploaded by

ramesh.n
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/ 5

Computer Networks Lab Experiment No: 02

Networking Commands
AIM: Work with the commands Ping, Tracert, Ipconfig, pathping, telnet, ftp, getmac,
ARP,Hostname, Netstat, netdiag, and Nslookup

commonly used networking commands across different operating systems like Windows,
Linux, and macOS. These commands are essential for troubleshooting network issues,
monitoring, and configuring network settings.
1. **ping**
- **Usage:** Tests the reachability of a host on an IP network and measures the round-trip
time for messages sent.
- **Example:** `ping google.com`
2. **tracert** (Windows) / **traceroute** (Linux/macOS)
- **Usage:** Displays the path and transit delays of packets across the network.
- **Example:** `tracert google.com` (Windows) / `traceroute google.com` (Linux/macOS)
3. **ipconfig** (Windows) / **ifconfig** (Linux/macOS)
- **Usage:** Displays or configures network interface information.
- **Example:** `ipconfig` (Windows) / `ifconfig` (Linux/macOS)
4. **nslookup**
- **Usage:** Queries DNS to obtain domain name or IP address mapping.
- **Example:** `nslookup google.com`
5. **netstat**
- **Usage:** Displays network statistics, including active connections, routing tables, and
interface statistics.
- **Example:** `netstat -a`
6. **arp**
- **Usage:** Displays and modifies the Address Resolution Protocol (ARP) cache, used to
map IP addresses to MAC addresses.
- **Example:** `arp -a`
7. **route**
- **Usage:** Displays or modifies the IP routing table.
- **Example:** `route print` (Windows) / `route -n` (Linux/macOS)
8. **hostname**
- **Usage:** Displays the hostname of the machine.
- **Example:** `hostname`
9. **dig** (Linux/macOS)
- **Usage:** A DNS lookup utility to query DNS servers for information.
- **Example:** `dig google.com`
10. **telnet**
- **Usage:** Connects to a remote host via the Telnet protocol, useful for testing open
ports.
- **Example:** `telnet 192.168.1.1 80`
11. **curl** (Linux/macOS/Windows)
- **Usage:** Transfers data from or to a server using various protocols, like HTTP,
HTTPS, FTP, etc.
- **Example:** `curl http://example.com`
12. **wget** (Linux/macOS/Windows)
- **Usage:** Non-interactive network downloader.
- **Example:** `wget http://example.com/file.zip`
Computer Networks Lab Experiment No: 02

13. **netsh** (Windows)


- **Usage:** Configures network interfaces, firewall, and routing.
- **Example:** `netsh wlan show profiles`
14. **ftp**
- **Usage:** Transfers files between a client and a server over the FTP protocol.
- **Example:** `ftp ftp.example.com`
15. **nmap**
- **Usage:** Network scanner to discover hosts and services on a computer network.
- **Example:** `nmap 192.168.1.1`
16. **pathping**

1. **ping**
The ping command is a network utility used to test the reachability of a host on an IP network
and measure the round-trip time for messages sent. Here's how it works and some common
usages:
Usage
1. *Basic Syntax*:
ping [hostname or IP address]
2. *Functionality*:
- Sends Internet Control Message Protocol (ICMP) Echo Request packets to the target host.
- Waits for Echo Reply packets to determine if the target is reachable.
Examples
1. *Ping a Website*:
ping google.com
This command tests connectivity to Google. The output will show the response time and
whether the packets were successfully received.
2. *Ping an IP Address*:
ping 8.8.8.8
This pings Google's public DNS server to check connectivity.
3. *Ping with Specific Packet Count*:
ping -n 5 google.com
This sends 5 Echo Requests instead of the default 4.
4. *Continuous Ping* (in Windows):
ping -t google.com
This sends ping requests indefinitely until stopped (Ctrl + C to stop).
5. *Ping with Timeout*:
ping -w 2000 google.com
This sets a timeout of 2000 milliseconds for each reply.
Output Interpretation
- *Reply from [IP Address]*: Indicates the target is reachable.
- *Request timed out*: Indicates that the target is not reachable.
- *Round-trip times*: Shows the time taken for packets to travel to the host and back.
Use Cases
- *Network Troubleshooting*: To check if a server or device is online.
- *Latency Measurement*: To assess the speed of a connection.
- *Network Path Testing*: Helps identify potential issues in a network path.

2. tracert
Computer Networks Lab Experiment No: 02

The tracert command (short for "trace route") is a network diagnostic tool used to track the
path that packets take from your computer to a specified destination. It helps identify the
route and measure the time taken for each hop along the way.
### Usage
1. *Basic Syntax*:
tracert [hostname or IP address]

2. *Functionality*:
- Sends ICMP Echo Request packets to each router (hop) along the path to the destination.
- Measures the time taken for each hop and displays the route taken.
### Examples
1. *Trace a Website*:
tracert google.com
This command will show the route packets take to reach Google, displaying each hop's IP
address and response time.
2. *Trace an IP Address*:
tracert 8.8.8.8
This traces the route to Google's public DNS server.
3. *Using the -d Option*:
tracert -d google.com
This option prevents the command from resolving IP addresses to hostnames, displaying
only the IPs for faster results.
4. *Limit the Number of Hops*:
tracert -h 10 google.com
This limits the trace to a maximum of 10 hops.
5. *Verbose Output*:
tracert -w 500 google.com
This sets a timeout of 500 milliseconds for each reply, which can help diagnose slower
connections.
### Output Interpretation
- Each line in the output represents a hop.
- *Hop Number*: Indicates the sequence of hops.
- *Round-Trip Time (RTT)*: The time taken to receive a reply from each hop.
- *IP Address and Hostname*: Displays the address and, if resolved, the name of each hop.
### Use Cases
- *Network Troubleshooting*: Helps identify where packets are being dropped or delayed.
- *Path Analysis*: Useful for understanding the network path to a destination, which can be
helpful in diagnosing routing issues.

3. **ipconfig**
The ipconfig command is a network utility used to display and manage the IP configuration
of your computer. Here are the primary uses of the command:
1. *View IP Configuration*: Running ipconfig displays the current network
configuration, including the IP address, subnet mask, and default gateway for each
network adapter.
2. *Release and Renew IP Address*:
- *Release*: ipconfig /release releases the current DHCP lease, effectively dropping the
assigned IP address. –
*Renew*: ipconfig /renew requests a new IP address from the DHCP server.
Computer Networks Lab Experiment No: 02

3. *Display Detailed Information*: ipconfig /all provides detailed information about


each network adapter, including MAC address, DHCP status, and DNS servers.
4. *Flush DNS Cache*: ipconfig /flushdns clears the DNS resolver cache, which can
help resolve DNS-related issues.
5. *Display DNS Configuration*: ipconfig /displaydns shows the contents of the DNS
resolver cache.
6. *Set DNS Servers*: While ipconfig itself doesn't set DNS servers, it can be used to
view current settings which can be adjusted in the network settings.
4. **nslookup**
The nslookup command is a network utility used to query the Domain Name System (DNS)
to obtain domain name or IP address mappings. It helps diagnose DNS-related issues and
gather information about DNS records. nslookup is a powerful tool for diagnosing DNS
problems and understanding domain name configurations.

### Usage
1. *Basic Syntax*:
nslookup [hostname or IP address]

2. *Functionality*:
- Resolves domain names to IP addresses.
- Can retrieve various types of DNS records.
### Examples
1. *Basic Domain Lookup*:
nslookup google.com
This command retrieves the IP address(es) associated with google.com.
2. *Reverse Lookup*:
nslookup 8.8.8.8
This performs a reverse DNS lookup to find the domain name associated with the IP
address 8.8.8.8 (Google's DNS server).
3. *Specify a Different DNS Server*:
nslookup google.com 8.8.8.8
This queries Google's DNS server (8.8.8.8) instead of the default DNS server configured
on your system.
4. *Retrieve Specific DNS Records*:
nslookup -type=MX gmail.com
This command retrieves the Mail Exchange (MX) records for the domain gmail.com,
showing which servers handle email for that domain.
5. *Interactive Mode*:
nslookup
Simply typing nslookup and pressing Enter enters interactive mode, allowing you to run
multiple queries without retyping the command. You can use commands like set type=AAAA
to query for IPv6 addresses or exit to leave interactive mode.
### Output Interpretation
- *Non-authoritative answer*: Indicates the response came from a cache, not directly from
the DNS server hosting the domain.
- *Name*: The domain name being queried.
- *Addresses*: Lists the associated IP addresses.
### Use Cases
- *Troubleshooting DNS Issues*: Helps verify if a domain name resolves correctly.
Computer Networks Lab Experiment No: 02

- *Gathering DNS Information*: Useful for checking records like A, AAAA, MX, CNAME,
etc.
- *Testing DNS Servers*: Can determine if different DNS servers provide consistent results.

16. **pathping**

The pathping command is a network utility that combines the functionality of ping and tracert
to provide detailed information about network latency and packet loss along the route to a
specified host. It helps diagnose network performance issues by tracing the path and measuring
the quality of each hop. pathping is a valuable tool for network diagnostics, providing insights
into both the path taken by packets and the quality of that path.

### Usage
1. *Basic Syntax*:
pathping [hostname or IP address]

## Key Features
- *Combines Ping and Tracert*: It provides both the path to the destination and statistics
about packet loss.
- *Detailed Statistics*: After sending packets, it summarizes results, including latency and
packet loss for each hop.
### Examples
1. *Basic Pathping Command*:

pathping google.com

This command traces the route to Google and measures the packet loss and round-trip times
for each hop.
2. *Specify a Timeout*:

pathping -w 500 google.com

Sets a timeout of 500 milliseconds for each reply.


3. *Limit the Number of Hops*:
pathping -h 10 google.com
Limits the trace to a maximum of 10 hops.
### Output Interpretation
- *Hop Number*: Displays the sequence of hops along the route.
- *Round-Trip Time (RTT)*: Indicates the time taken to receive replies.
- *Packet Loss*: Shows the percentage of packets lost at each hop, which is critical for
diagnosing connectivity issues.
### Use Cases
- *Diagnosing Network Issues*: Helps identify where packet loss occurs and which hop is
causing latency.
- *Performance Measurement*: Useful for assessing the quality of the connection to a
specific host.

You might also like