Configure Linux network card?

Print anything with Printful



Linux® network card setup can be done automatically or manually through GUI or CLI. GUI varies by desktop environment, while CLI uses ifconfig command to modify interfaces and settings. Configuration files can be edited for automatic loading at boot.

Setting up a network card with Linux® is often done automatically through the hardware detection software that comes with most modern Linux® distributions. There may be times, however, when your network card is not automatically configured correctly or when you want to configure a second network card with Linux®. In any case, there are a couple of primary means of working with the network adapter configuration, either through a graphical user interface (GUI) or the command line interface (CLI).

Using your Linux® distribution’s GUI will provide the most intuitive and straightforward means of configuring your network card with Linux®. This can vary, however, depending on the Linux® desktop environment for your distribution. In most cases, Linux® distributions will use the Gnome® desktop environments or K Desktop Environment (KDE®), each of which has a software GUI for configuring the network. The KNetworkManager software does this job for the KDE® desktop, while in Gnome® it is called NetworkManager. Both offer the ability to configure an already detected network card with network parameters, IP address information, and add a new network card.

Working from the CLI to configure your NIC under Linux®, however, you’ll first want to find out if your NIC is already up and running by issuing the ifconfig command in your terminal application. If the command is issued with no arguments, all current interfaces and their settings will be displayed. The two most common are eth0, which is the first ethernet network adapter on the system, and lo, the loopback interface, which is a virtual software interface. The ifconfig command can then be used to enable or disable an interface, as well as to change the IP address or other network information. For example, to set the IP address of the eth0 interface, run the following ifconfig command.

ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up

In order from left to right, the first parameter is the interface to modify, eth0, then the IP address to assign to it, and then the subnet to which the computer belongs. The final parameter given to ifconfig is “up” or “down”, which tells the computer to enable or disable the network card. Make sure you check the appropriate settings for your network, such as network type, subnet, any gateway routers to dial the correct command.

Of course, this command will configure your network card with Linux® for the current session only and should be entered every time you log into your computer. To overcome this problem, Linux® distributions implement various scripts and files that will do this automatically every time the computer boots. The locations and names of these scripts and configuration files will vary based on your Linux® distribution, so be sure to check which files to edit. By editing these configuration files in a text editor, the operating system will automatically load the appropriate network configuration.




Protect your devices with Threat Protection by NordVPN


Skip to content