netsh Equivalent on Linux
Last Updated : 26 Dec, 2023
The netsh is the popular command in Windows CMD (Command Prompt) that permits you to retrieve network configuration information running on the PC. If you recently shifted to the Linux OS and are looking for the Netsh command there, unfortunately, Linux doesn't have this command support. Instead, several networking tools are available in Linux to troubleshoot/display the network statistics.
Linux Alternatives for Netsh Command in Linux
Linux is preferred the most regarding security and hardware compatibility to manage networks. As a network administrator, consider the following Linux utilities for network configuration or troubleshooting.
- ifconfig
- ip
- route
- netstat
- systemd (Service Manager)
All the above-mentioned commands come with the net-tools package. Below is the installation of the net-tools package on different Linux distros.
1. For Ubuntu/Debian:
$ sudo apt install net-tools
Installing net-tools package
2. For Fedora/RedHat/CentOS:
$ sudo dnf install net-tools
1. ifconfig
ifconfig is the abbreviation of Interface Configuration, a basic network command in Linux having core functionality to configure/debug/display the network interfaces. Moreover, it also permits the dynamic configuration of network interfaces, assigning IP addresses, and subnetmasks.
Example 1: View All Available Network Interfaces
The network interface is a bridge between the the computer and the public/private network. To view all available network interfaces on the system use the -a flag with ifconfig command.
ifconfig -a
Viewing all available network interfaces
The above output shows all network interfaces. In our case, the network interface "ens33" and "lo" (loopback interface) are listed.
Example 2: Enable/Disable Network Interfaces
To disable a particular network interface, provide the interface name with a "down" option. Correspondingly, to enable the network interface, use the "up" option. Please note that the root privileges will be required for both enabling/disabling processes.
$ sudo ifconfig ens33 down $ sudo ifconfig ens33 up
Enabling/Disabling Network Interfaces
2. ip
The "ip" stands for Internet Protocol, a built-in command in Linux that shows/manipulates routing, network devices, interfaces, and tunnels. It shares similar functionality as the "ifconfig" command but has some extra advanced features such as configuring policy routing, network namespace, and VLAN (Virtual Lan).
Example 1: Show Network Interfaces
The following IP command with the "addr show" flag displays all available network interfaces on the network.
$ ip addr show
Showing Network Interfaces
In case, if multiple interfaces are running, specify it at the end of the command to retrieve its information:
$ ip addr show <interface name>
Example 2: Get Routing Packets Information
In a network, communication takes place through packets and the routing table holds the routing packets to be sent to the destination. To get routing packet information on the network, this command is considered:
$ ip route
Getting Routing Packets Information
3. route
route is a Linux command that gives the routing table information. The routing table is the set of defined rules for the data packets to be transferred. Moreover, it allows to add, delete, and change the routing entries. You can consider this command if your focus main focus is to manage the IP routing table on the network.
Example 1: Display Routing Table
To obtain the Kernel (manage resources for OS ) IP routing table for the network, simply run the "route" command.
$ route
Disabling Route Table
Example 2: Set/Add Default Gateway IP
Default gateway is used to route the information for a device/network. To set the default gateway on the network, use the "add default" option and specify the IP address. Let's say, you want to set the default gateway IP "192.168.119. 1". For this objective, see this command.
$ sudo route add default gw 192.168.119.1
Setting/Adding Default Gateway IP
The default gateway "192.168.119. 1" is set.
4. netstat
The full form of netstat is Network Statistics, a powerful Linux tool for the configuration and troubleshooting the network statistics. It displays the network connections, interface statistics, routing tables, multicast memberships, and masquerade connections.
Example 1: Display All Network Interfaces
To display network all network interfaces using the netstat command, the "-i" is accomplished. For instance, see the following command execution.
$ netstat -i
Displaying all Network Interfaces
Example 2: Display Network Routing Table
As already explained in the "route" command section, the routing table holds destination addresses for the network. To print the routing table with netstat command give the "-r" flag:
$ netstat -r
Displaying Network Routing Table
5. systemd (Service Manager)
In modern Linux distributions, systemd is the default init system service manager. A network service can be managed through this i.e. enabling/disabling a controlled behavior. For instance, the commands are enabling and disabling the NetworkManager services.
$ sudo systemctl enable NetworkManager $ sudo systemctl disable NetworkManager
Managing Network Service
Conclusion
In conclusion, there's no Netsh command support available in Linux. However several alternative commands are available that share similar functionalities as netsh command does. You can use the ifocnfig, ip, route, and netstat commands. Additionally, the service manager (systemd) can be used to enable/disable the network services.
Similar Reads
How to Install Nessus on Linux?
Nessus is a vulnerability management tool that helps organizations and network environments identify and address network security issues. It helps in identifying vulnerabilities, potential threats, and irregularities. It plays an important role in maintaining a strong cybersecurity posture. Features
6 min read
Netstat command in Linux
The netstat command is like a special tool in Linux that helps you understand and check things about how your computer connects to the internet. It can tell you about the connections your computer is making, the paths it uses to send information, and even some technical details like how many packets
7 min read
Linux Network Commands Cheat Sheet
Linux is a very popular operating system. Many people use it. Developers and network admins need to know Linux network commands well. This article will going explains most of the common Linux network commands in a very easy way and It also has a cheat sheet about these commands. The cheat sheet tell
9 min read
How to Install ntopng in Linux?
ntopng is an Open Source Tool to monitor the network. It is a security network monitoring tool, also monitors web activities passively. It is also used for packet capturing, Traffic Recording, and Network Probing. A huge number of companies like Google, HP, Cisco, IBM, and many more uses ntop. It ac
2 min read
Nmap Command in Linux with Examples
Nmap is Linux command-line tool for network exploration and security auditing. This tool is generally used by hackers and cybersecurity enthusiasts and even by network and system administrators. It is used for the following purposes:Â Real time information of a networkDetailed information of all the
6 min read
Telnet Command in Linux
Telnet serves as a command line interface (CLI) tool that allows logging in and communication with a system through a TCP/IP network. Users can issue commands on a remote machine as Telnet users can log into a machine over a TCP/IP network with the use of Telnet addresses (e.g. telnet://user@hostnam
7 min read
Best VOIP Clients for Linux
VoIP systems offer significant improvements over the traditional modes of communication by providing an economic and superior mode of communication that is Voice on the Internet protocol. For users of Linux and other open source platforms, it sometimes becomes relatively hard to identify the best Vo
6 min read
ip Command in Linux with Examples
The ip command in Linux is a powerful utility for network configuration and management. It allows users to interact with various networking components such as network interfaces, routing tables, addresses, and more. Here, we will look into the 'ip' command, covering each aspect with examples, code,
7 min read
How to Install nload in Linux?
nload is a console-based application which monitors network traffic and bandwidth usage in real. It provides information about incoming and outgoing traffic using graphs, and additionally it provides information like current data transferring rate average data transferred, and minimum and maximum da
3 min read
Network Input in Java
In Java, Network Input is all about sending and getting data over a network. It's about making links, getting data from input sources, and dealing with the information we get. Java offers strong tools, like input streams and sockets. These help with these operations so communication between devices
2 min read