CN 1
CN 1
Lab Assignments No 1
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:
2. IPconfig
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.
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.
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.
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.
● route: Displays and modifies the routing table for network traffic.
● ftp/sftp: Transfers files between computers using the FTP/SFTP
protocols.
● telnet: Connects to remote devices over the network using the Telnet
protocol.
● dig: Performs DNS lookups and displays detailed query responses
(Linux/Mac).
● nmap: Scans networks for open ports and services, often used for
security auditing.
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.