Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Jul 9, 2024
Easy

Basic Networking Commands

Author Rituraj Seal
0 upvote
Table of contents
Learn to use AI Tools & ChatGPT to excel as Microsoft SDE
11 Jul, 2024 @ 01:30 PM
Speaker
Pranav Malik
SDE 2 @

Introduction

Networking commands are essential tools for managing and troubleshooting computer networks. From assessing connectivity with "ping" to configuring interfaces using "ifconfig" or "ipconfig," these commands provide crucial insights. Whether diagnosing issues, resolving DNS with "nslookup," or securing connections with "ssh," mastering these tools is fundamental for effective network administration.

basic networking commands

Well, you are in the right place. Here we will be discussing how you can know whether your computer is connected to the internet or not through the command line, how you can find your computer's IP address and MAC address, how your data travels through different servers in the internet when you load a website and many more things. So get ready, as we will learn about basic networking commands.

What is Networking?

Networking means a transfer of information between two or more computers connected by a physical or non-physical link. Today when we talk about networking from a computer's perspective, we think about the internet. Though the internet is the most common form of networking, there are also other examples of networking. The internet we use follows rules to send and receive data. These rules are collectively called the TCP/IP model. Another example of networking is an intranet, which organizations use to share data within themselves.

Also see,  Personal Area Network

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

What Are Networking Commands?

Networking commands are tools used in command line interfaces to execute various network tasks. They allow users to diagnose network problems, modify network settings, transfer files, and establish distant connections. These commands provide essential functionality for network administrators and troubleshooters, allowing for efficient network control and troubleshooting.

Also read, gzip command in linux

Top 8 Networking Commands

Many system commands can be used to know about the network connection parameters. You can use these networking commands on the network. Here we will be learning about a few of these commands. We will discuss what the commands do and what information they can give you about the system. So let's hop on as we learn about the various basic networking commands.

Ping

It is one of the basic networking commands to test the connection between the local machine and the host server. This command sends a small amount of data to the host server, and in return, the host server sends a reply to the computer. Information like the IP address of the host server, the amount of data sent, time to live, and time needed for sending and receiving the data are recorded and displayed to the user.

ping command

-a

The "-a" option resolves the hostname to the respective IP address.

-a option

-w timeout

The option "-w timeout" sets the timeout, the time after which the data packet will be rejected for each ping. The timeout is in milliseconds.

-w timeout option

Ipconfig

As the command name suggests, it gives information about the IP address. It not only gives the IP address of the computer it is executed on but also much more information as DNS addresses are stored in the cache. It has options to show even the computer's MAC address, renew the IP address, release the current IP address, flush the DNS cache, and help.

Ipconfig command

/all

The "/all" option of the ipconfig command displays the full configuration information.

/all option

/flushdns

The "/flushdns" option clears the DNS table stored in the cache of the local machine

/flushdns option

/registerdns

The "/registerdns" option refreshes all DHCP leases and re-registers the DNS names in the local machine's cache.

/registerdns option

Arp

The arp command is a short form for Address Resolution Protocol. This command is used to display and modify the IP to the physical address translation table used by the address resolution protocol. It has many options, of which a few are to display current ARP entries, specify an internet address, delete a host in the ARP table, specify a physical address, and many more.

-a

The "-a" command in arp displays current ARP entries by interrogating the current protocol data. If inet_addr is specified, the IP and physical addresses for only the specified computer are displayed. 

-a option

Netstat

This command displays the connections active on the computer and the ports the computer is listening to. The command displays the four parameters: proto, local address, foreign address, and state. The proto column shows the type of connection, and the local address shows the IP address and the port number of the connection local machine. The proto column also indicates the foreign address, specifies the IP address and port number of the connection in the host server, and the state shows whether the connection is established or not.

Netstat command

-a

The "-a" option of the netstat command displays all connections and listening ports.

-a option

-r

The "-r" option displays the routing table of the local machine.

-r option

-e

The "-e" option of the netstat command displays the statistics of the ethernet connection.

-e option

Tracert

The tracert command traces the route from a computer to a host server. It traces the connection for a fixed maximum number of hops. It is one of the basic networking commands. It is used to diagnose path-related problems. The information it displays about the connection route includes the IP addresses for each intermediate server and 3 round trips for each server. You can set various options for this command, like whether to resolve names of intermediate server IP addresses, the maximum number of hops in the path, and the maximum amount of time to wait for a reply.

tracert command

-d

The "-d" option tells the tracert not no resolve the IP addresses to hostnames.

-d option

-h maximum_hops

The "-h maximum_hops" option sets the maximum number of hops for which the tracert command will trace the connection.

-h maximum_hops option

-w timeout

The "-w timeout" option sets the timeout time for each reply.

-w timeout option

NsLookup

The NsLookup command is a command-line utility. It is used in networking to query the Domain Name System (DNS). Then it obtains information about domain names, IP addresses, and other DNS-related data. When you run the NsLookup command followed by a domain name or IP address, it will display the corresponding DNS records associated with that domain or IP. This command is commonly used to troubleshoot DNS-related issues, check DNS resolution, and gather information about domain configurations.

To find the IP address of a specific domain, you can use nslookup followed by the domain name:

nslookup www.example.com

This command will return the IP address associated with www.example.com. You can also specify a particular DNS server:

nslookup www.example.com 8.8.8.8

In this example, the query is sent to the Google Public DNS server (8.8.8.8) to resolve the domain name.

HostName

The HostName command is used to display the host name of the computer or device in a network. When you run the HostName command in a command prompt or terminal, it will return the name assigned to the device on the local network. The host name is a unique identifier used to distinguish devices in a network and is used in various networking protocols and configurations.

To display the hostname of your computer, simply type:

hostname

This command will output the hostname of your machine, such as DESKTOP-1234ABC. To set a new hostname, you can use:

hostname new-hostname

Note that changing the hostname typically requires administrative privileges and may require a system restart to take full effect.

SystemInfo

The SystemInfo command is used to retrieve detailed information about the hardware and software configuration of a Windows-based computer. When you run the SystemInfo command in a command prompt, it will display a comprehensive report containing information. It will display the operating system version, system manufacturer, processor details, memory size, network adapter details, and more. This command is helpful for system administrators and users to gather system-related information and diagnose issues.

To display detailed information about your system, type:

systeminfo

This command will output a comprehensive list of system details, such as the OS version, system manufacturer, BIOS version, installed memory, and network adapter configurations. For example:

systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

This command filters the output to show only the operating system name and version, making it easier to locate specific information within the extensive system report.

You can also read about mime protocol, and network models in computer network.

Frequently Asked Questions

What is the ping command?

The ping command sends a small data packet to a target address. The statistics like time to live, resolved IP address of the target address, time for a round trip, packets lost, amount of data sent, and maximum and minimum round trips are recorded. It is mostly used to check the connection between the local machine and the host server.

What is an IP address?

An IP address is a unique identifier for every computer on the internet. The IP address keeps on changing at regular intervals. You can check your computer's IP address through the "ipconfig" command.

What does the tracert command do?

The tracert is one of the basic networking commands provided by the operating system itself. It can be used to trace the route to a particular website. The tracert command pings every hop in the route and displays the IP address of the hop and the time for a round trip to that hop.

What are the most common commands for network troubleshooting?

The most common commands for network troubleshooting include Ping, Traceroute, Ipconfig/ifconfig, Netstat, Nslookup/Dig, Route, and Telnet. These commands help check network connectivity, path identification, DNS request resolution, and remote connection setup for testing. 

What are the basic networking command?

Basic networking commands include ping for connectivity, ipconfig/ifconfig for configuration, nslookup/dig for DNS resolution, traceroute/tracert for route tracing, netstat for connections, arp for ARP cache, route for routing tables, telnet/ssh for remote access, ftp for file transfer, and wget/curl for downloading. These commands aid in network diagnostics and configuration.

What is the network configuration command?

The network configuration command, commonly known as ipconfig on Windows or ifconfig on Unix-based systems, displays the current network configuration, including IP addresses, subnet masks, and default gateways. It is used to configure and troubleshoot network interfaces.

Conclusion

As we conclude, we have discussed some basic networking commands. The basic networking commands are run in the terminal of a machine, and they can be used to troubleshoot and display various statistics related to the local machine. 

For further reading, you can go to Computer Networks to learn more about how computers send and receive data.

You can also go to Computer Networks if you are a beginner in computer networks.

If you want to learn more about a topic in computer networks, visit the following websites.


Refer to our guided paths on Code360 to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. Enroll in our coursesrefer to the mock test and problems look at the interview experiences and interview bundle for placement preparations.

Happy Coding!