0% found this document useful (0 votes)
10 views12 pages

CN 1

Uploaded by

1032221789
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)
10 views12 pages

CN 1

Uploaded by

1032221789
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/ 12

Computer Networks CET2005B

Lab Assignments No 1

Title: Network commands

Aim: To study various network commands in Linux environment

Objectives:
1. To learn and understand various network commands command.

Theory:

1. Ping
The ping command checks if a specific device or server is reachable on a
network by sending ICMP Echo Request messages and waiting for a response.
It provides information on the time it takes for data packets to travel to the
target and back, helping diagnose network connectivity issues.

A successful ping confirms that the target device is online and reachable, while
a failure indicates a possible network problem, such as an unreachable host or
network congestion. This command is widely used for basic network
troubleshooting.

Usage:

ping <hostname or IP address>

2. IPconfig

The IPconfig commands display network configuration details such as IP


address, subnet mask, and default gateway. They are also used to configure
network settings, like renewing DHCP leases or assigning static IP addresses.

These commands are essential for network troubleshooting, as they provide a


clear view of a device's current network setup. For instance, they help in
determining if a device has a valid IP address or is correctly connected to the
network.

Usage:

ipconfig
3. Traceroute

The tracert (Windows) or traceroute (Linux) command maps the route that data
packets take to reach a specific destination across a network. It lists each hop
along the path and the time taken for each hop, providing insight into where
delays or failures occur.

This command is particularly useful for identifying network bottlenecks or


determining where packets are getting lost. It can help in pinpointing issues in
the network infrastructure, such as problematic routers or misconfigured paths.

4. Netstat

The netstat command displays active network connections, routing tables, and
various network statistics. It shows which ports are open and which services
are listening on them, making it a valuable tool for monitoring network activity
and diagnosing issues.

Network administrators use netstat to check for unauthorized connections,


identify traffic patterns, and troubleshoot network performance. It provides
detailed information about the state of the network, helping ensure security and
optimal performance.

5. Nslookup

The nslookup command is used to query DNS servers to obtain domain name
or IP address mapping. It helps verify if the DNS resolution is working
correctly by looking up the DNS records associated with a domain name.

This command is useful for troubleshooting DNS-related issues, such as


incorrect domain resolution or verifying DNS configurations. It's commonly
used to diagnose network problems related to name resolution failures.

6. Route

The route command displays and manipulates the IP routing table, allowing
users to add or delete routes. This is crucial for directing data packets to their
destination based on network topology.

By modifying routing tables, network administrators can control how data is


routed within the network, ensuring efficient traffic flow and preventing
network loops or misrouting issues.
Design Screenshots:

● ping: Tests connectivity to a network device by sending ICMP Echo Requests.

● tracert/traceroute: Shows the path packets take to a destination, listing all


hops.
● ipconfig/ifconfig: Displays and configures network interface settings like IP
address.

● netstat: Displays active connections, ports, and network statistics.


● nslookup: Queries DNS to find domain name or IP address information.

● route: Displays and modifies the routing table for network traffic.
● ftp/sftp: Transfers files between computers using the FTP/SFTP
protocols.

● arp: Displays or modifies the ARP cache, which maps IP addresses to


MAC addresses.
● whois: Retrieves domain registration information from WHOIS
databases.

● telnet: Connects to remote devices over the network using the Telnet
protocol.
● dig: Performs DNS lookups and displays detailed query responses
(Linux/Mac).

● curl: Transfers data from or to a server using various protocols (HTTP,


FTP, etc.).
● wget: Downloads files from the web via HTTP, HTTPS, and FTP.

● tcpdump: Captures and analyzes network traffic in real-time (Linux).

● mtr: Combines ping and traceroute to diagnose network issues (Linux).

● nc (netcat): Reads/writes data across network connections using TCP or


UDP.

● nmap: Scans networks for open ports and services, often used for
security auditing.

● tshark: Captures and analyzes network packets, a command-line version


of Wireshark.

Observation (Conclusion):
In conclusion, learning and understanding various network commands is
essential for effective network management and troubleshooting. These
commands provide the foundational tools needed to diagnose connectivity
issues, analyze network performance, and configure network settings. Mastery
of commands like `ping`, `tracert`, `ipconfig`, and others equips individuals
with the skills to maintain and secure network infrastructures, making them
invaluable in both academic and professional settings.

FAQ
Here’s a description of various options for each of the listed network
commands:

1. ifconfig
- `-a`: Displays all interfaces, including those that are down.
- `up`: Activates an interface.
- `down`: Deactivates an interface.
- `inet addr`: Specifies the IP address for the interface.
- `netmask`: Sets the network mask.
- `broadcast`: Sets the broadcast address.

2. ip
- `addr`: Shows and manipulates IP addresses.
- `link`: Displays and controls network interfaces.
- `route`: Shows and manipulates routing tables.
- `netns`: Manages network namespaces.
- `neigh`: Shows and manipulates ARP entries.
3. traceroute
- `-m <max_ttl>`: Sets the maximum number of hops (TTL).
- `-n`: Displays IP addresses instead of resolving hostnames.
- `-p <port>`: Specifies the destination port.
- `-w <timeout>`: Sets the timeout for each probe.

4. tracepath
- `-n`: Do not resolve hostnames to IP addresses.
- `-b`: Display both numeric IP and symbolic hostnames.
- `-l <size>`: Sets the probe packet length.
- `-p <port>`: Sets the initial destination port.

5. ping
- `-c <count>`: Sends a specific number of packets.
- `-s <size>`: Specifies the size of each packet.
- `-i <interval>`: Sets the interval between sending packets.
- `-t <ttl>`: Sets the Time-To-Live (TTL) for packets.
- `-W <timeout>`: Sets the timeout for each reply.

6. netstat
- `-a`: Displays all connections, including listening sockets.
- `-n`: Displays addresses and ports in numeric form.
- `-r`: Displays the routing table.
- `-t`: Shows TCP connections.
- `-u`: Shows UDP connections.
- `-p`: Displays the process using each socket.

7. ss
- `-t`: Shows TCP sockets.
- `-u`: Shows UDP sockets.
- `-l`: Displays listening sockets.
- `-p`: Shows processes using sockets.
- `-n`: Displays IP addresses and ports in numeric format.

8. dig
- `@server`: Queries a specific DNS server.
- `+short`: Provides a concise output.
- `+trace`: Traces the path to the authoritative DNS server.
- `-x <IP>`: Performs a reverse DNS lookup.
- `+noall +answer`: Displays only the answer section.

9. nslookup
- `-type=<record>`: Specifies the DNS record type (e.g., A, MX).
- `-query=<type>`: Another way to specify the record type.
- `-timeout=<seconds>`: Sets the timeout for a response.
- `-retry=<number>`: Specifies the number of retries.
10. route
- `-n`: Displays the routing table with numeric addresses.
- `add`: Adds a new route.
- `del`: Deletes a route.
- `default`: Specifies the default gateway.
- `-net`: Manages network routes.
- `-host`: Manages host-specific routes.

11. host
- `-a`: Performs a thorough query, equivalent to `dig`.
- `-t <type>`: Specifies the DNS record type (e.g., A, MX).
- `-C`: Displays SOA records for a zone.
- `-v`: Provides verbose output.

12. arp
- `-a`: Displays the ARP table.
- `-d <IP>`: Deletes an entry from the ARP table.
- `-s <IP> <MAC>`: Adds a static entry to the ARP table.
- `-n`: Displays addresses in numeric format.

13. iwconfig
- `essid <SSID>`: Sets the ESSID (network name).
- `mode <mode>`: Sets the operation mode (e.g., managed, ad-hoc).
- `freq <frequency>`: Sets the operating frequency.
- `txpower <power>`: Adjusts the transmission power.
- `channel <channel>`: Specifies the channel.

14. hostname
- `-s`: Displays the short hostname.
- `-d`: Displays the DNS domain name.
- `-I`: Displays all IP addresses of the host.
- `-f`: Displays the FQDN (Fully Qualified Domain Name).
- `-i`: Displays the IP address associated with the hostname.

15. curl
- `-O`: Saves the downloaded file with its original name.
- `-L`: Follows HTTP redirects.
- `-I`: Fetches the headers only.
- `-X <method>`: Specifies the request method (GET, POST, etc.).
- `-u <user:password>`: Specifies basic authentication.

wget
- `-O <file>`: Saves the downloaded content to a specific file.
- `-r`: Recursively downloads a website.
- `-c`: Continues a previous download.
- `-q`: Suppresses output.
- `--limit-rate=<rate>`: Limits the download speed.

16. mtr
- `-r`: Generates a report and exits.
- `-c <count>`: Specifies the number of pings per hop.
- `-n`: Displays numeric IP addresses only.
- `-s <size>`: Sets the packet size.

17. whois
- `-H`: Hides personal data where possible.
- `-p <port>`: Specifies a port number for the whois server.
- `-h <hostname>`: Queries a specific whois server.
- `-l`: Lists only a single level (disables recursion).

18. ifplugstatus
- `-a`: Displays status of all interfaces.
- `-u`: Shows status of up interfaces only.
- `-q`: Suppresses output (quiet mode).

19. iftop
- `-i <interface>`: Specifies the network interface to monitor.
- `-n`: Displays IP addresses instead of hostnames.
- `-P`: Shows ports along with IP addresses.
- `-N`: Shows port numbers instead of names.
- `-B`: Displays bandwidth in bytes instead of bits.

20. tcpdump
- `-i <interface>`: Specifies the network interface to listen on.
- `-n`: Displays IP addresses and port numbers numerically.
- `-s <snaplen>`: Sets the snapshot length.
- `-w <file>`: Writes the output to a file.
- `-c <count>`: Captures a specified number of packets.

You might also like