At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.
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 occasions, however, when the network card isn't automatically configured properly, or when you want to configure a second network card with Linux®. In any case, there are a couple primary means to work with the network card's configuration, either by way of a graphical user interface (GUI) or the command line interface (CLI).
Using your Linux® distribution's GUI will provide the most user-friendly and straightforward means for configuring your network card with Linux®. This may vary, however, depending on the Linux® desktop environment for your distribution. In most cases, Linux® distributions will use either the Gnome® or K Desktop Environment (KDE®) desktop environments, each of which has a software GUI for configuring your network. The KNetworkManager software does this work 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, as well as add a new network card.
Working from the CLI to setup your network card with Linux®, however, you'll first want to discover whether your network card is already up and running by issuing the ifconfig command in the terminal application. If the command is entered without any arguments, it will output all of the current interfaces and their settings. The two most common are eth0, which is the first Ethernet network card 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 change the IP address or other network information. For example, to set the eth0 interface IP address, you would issue 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 subnetwork that the computer belongs to. The final parameter given to ifconfig is either "up" or "down," which tells the computer to enable or disable the network card. Be sure to check the appropriate settings for your network, such as the type of network, the subnetwork, any gateway routers to compose the proper command.
Of course, this command will only configure your network card with Linux® for the current session and would need to be entered after every time you log in on the computer. To work around this, Linux® distributions implement various scripts and files that will do this for you automatically every time the computer starts up. The locations and names of these scripts and configuration files will vary according to your Linux® distribution, so be sure to check it for which files to modify. By editing these configuration files in a text editor, the operating system will then load the appropriate network configuration automatically.