Roll No.
:- B1-510
Experiment No. 3
Aim: To study and implement Windows and Linux networking commands
Theory:
Windows Networking Commands
1. Hostname
Purpose: Displays the name of the current host (computer) on the network.
Functionality: Retrieves the hostname configured on the system, which is useful for
identifying a device in a network.
Use Case: Used to verify the machine’s identity in network communications or
troubleshooting.
Example: Running `hostname` in Command Prompt returns the computer’s name, e.g.,
`DESKTOP-123`.
2. Systeminfo
Purpose: Provides detailed information about the system’s configuration.
Functionality: Displays details like OS version, system type, installed hotfixes, network
adapter details, and more.
Use Case: Useful for auditing system configurations or gathering network-related
information during troubleshooting.
Example: `systeminfo` outputs details like “OS Name: Windows 10” and “Network Card(s):
1 NIC(s) Installed.”
3. arp -a
Purpose: Displays the Address Resolution Protocol (ARP) cache.
Functionality: Shows IP-to-MAC address mappings for devices in the local network.
Use Case: Helps troubleshoot connectivity issues or verify devices in the same subnet.
Example: `arp -a` lists entries like “192.168.1.1 00-14-22-01-23-45 dynamic.”
4. Ping
Purpose: Tests network connectivity between the host and a target device.
Functionality: Sends ICMP echo request packets to a specified IP or hostname and measures
response time.
Use Case: Used to check if a remote host is reachable or to measure network latency.
Example: `ping google.com` might return “Reply from 172.217.167.78: bytes=32 time=25ms
TTL=117.”
5. Netstat
Purpose: Displays network statistics and active connections.
Functionality: Shows active TCP/UDP connections, listening ports, and routing tables.
Use Case Useful for monitoring network activity or identifying open ports.
Example: `netstat -an` lists connections like “TCP 192.168.1.10:49152 93.184.216.34:80
ESTABLISHED.”
6. Nslookup
Purpose: Queries DNS servers to resolve domain names to IP addresses or vice versa.
Functionality: Provides information about DNS records, such as A, MX, or NS records.
Use Case: Used to troubleshoot DNS issues or verify domain resolution.
Example: `nslookup google.com` returns “Address: 172.217.167.78.”
7. Getmac
Purpose: Displays the MAC (Media Access Control) address of network adapters.
Functionality: Lists physical addresses of all network interfaces on the system.
Use Case: Useful for network configuration or identifying devices in a network.
Example: `getmac` outputs “00-14-22-01-23-45 Ethernet.”
8. Tracert
Purpose: Traces the route packets take to a network destination.
Functionality: Shows each hop (router) along the path to the target, including latency.
Use Case: Used to diagnose network routing issues or identify points of failure.
Example: `tracert google.com` lists hops like “192.168.1.1 → 10.0.0.1 → … →
172.217.167.78.”
9. Telnet
Purpose: Tests connectivity to a specific port on a remote host.
Functionality: Establishes a connection to a remote server using the Telnet protocol.
Use Case: Used to verify if a service (e.g., HTTP, SMTP) is running on a specific port.
Example: `telnet google.com 80` attempts to connect to port 80 of google.com.
Linux Networking Commands
1. Ifconfig
Purpose: Displays and configures network interfaces.
Functionality: Shows details like IP address, MAC address, and interface status; can also
configure interfaces.
Use Case: Used to check or set network interface parameters (though largely replaced by
`ip`).
Example: `ifconfig eth0` shows “inet 192.168.1.10 netmask 255.255.255.0.”
2. Netstat
Purpose: Displays network connections, routing tables, and interface statistics.
Functionality: Similar to Windows, it shows active connections, ports, and protocols.
Use Case: Used for monitoring network activity or troubleshooting connectivity.
Example: `netstat -tuln` lists listening ports like “tcp 0 0 0.0.0.0:22.”
3. Ss
Purpose: Provides detailed socket statistics.
Functionality: A modern replacement for `netstat`, it displays detailed information about
TCP/UDP sockets.
Use Case: Used for advanced network diagnostics, especially for socket states.
Example: `ss -tuln` shows “Netid State Recv-Q Send-Q Local Address:Port.”
4. Nmap
Purpose: Scans networks to discover hosts and services.
Functionality: Performs port scanning, OS detection, and service identification.
Use Case: Used for security auditing or network mapping.
Example: `nmap 192.168.1.0/24` scans the subnet for active hosts.
5. Dig
Purpose: Queries DNS servers for detailed DNS information.
Functionality: Retrieves DNS records like A, MX, or SOA with more detail than `nslookup`.
Use Case: Used for DNS troubleshooting or verifying domain configurations.
Example: `dig google.com` returns “ANSWER: 1, google.com. 300 IN A 172.217.167.78.”
6. Ip
Purpose: Manages and displays network interface configurations, routes, and more.
Functionality: A modern replacement for `ifconfig`, it handles IP addresses, routes, and
tunnels.
Use Case: Used to configure or troubleshoot network settings.
Example: `ip addr show` lists interfaces with details like “inet 192.168.1.10/24.”
7.
Hostname
Purpose: Displays or sets the system’s hostname.
Functionality: Similar to Windows, it retrieves or modifies the system’s network identity.
Use Case: Used for identifying or configuring a system in a network.
Example: `hostname` returns “ubuntu-server.”
8. Iwconfig
Purpose: Configures and displays wireless network interfaces.
Functionality: Shows wireless-specific details like SSID, signal strength, or mode.
Use Case: Used to manage or troubleshoot wireless connections.
Example: `iwconfig wlan0` shows “wlan0 IEEE 802.11 ESSID:MyWiFi.”
9. Ping
Purpose: Tests network connectivity to a remote host.
Functionality: Similar to Windows, it sends ICMP packets to check reachability and latency.
Use Case: Used to verify network connectivity or diagnose packet loss.
Example: `ping google.com` shows “64 bytes from 172.217.167.78: icmp_seq=1 ttl=117
time=25 ms.”
10. ARP
Purpose: Manages the ARP cache.
Functionality: Displays or modifies IP-to-MAC address mappings, similar to Windows `arp -
a`.
Use Case: Used to troubleshoot or manage local network device mappings.
Example: `arp -n` lists “Address 192.168.1.1 HWaddress 00:14:22:01:23:45.”
11. Nmcli
Purpose: Manages network connections via NetworkManager.
Functionality: Displays or configures network settings, including Wi-Fi, Ethernet, and VPN.
Use Case: Used for easy network configuration in modern Linux distributions.
Example: `nmcli device status` shows “DEVICE wlan0 TYPE wifi STATE connected.”
12. Route
Purpose: Displays or modifies the IP routing table.
Functionality: Shows routes to network destinations or allows adding/deleting routes.
Use Case: Used to troubleshoot or configure routing paths.
Example: `route -n` lists “Destination 0.0.0.0 Gateway 192.168.1.1.”
13.
Tracepath
-Purpose: Traces the path packets take to a destination, similar to `tracert`.
-Functionality: Shows hops and latency to a target, using UDP or ICMP.
Use Case: Used to diagnose routing issues or network delays.
Example: `tracepath google.com` shows “1: 192.168.1.1 0.5ms” and subsequent hops.
Conclusion
In conclusion, studying Windows and Linux networking commands reveals their essential role
in managing and troubleshooting network environments. Windows commands like ping,
tracert, and netstat offer straightforward tools for connectivity and monitoring, while Linux
commands such as ip, ss, and nmap provide advanced control and diagnostics. Despite
overlapping functions, Linux commands often offer greater flexibility. Mastering these
commands enables effective network administration across both platforms.