Configuring Network Interfaces in Linux

By | 2014-10-05

For us Windows guys, managing Linux systems can be a pain in the butt. Some simple things, like setting or changing network configurations are performed a little differently on Linux systems. Don’t let the command line intimidate you, Windows guys! Here are a few ways to manage network settings for Linux boxes that are pretty painless.

This isn’t going to be an all-encompassing tutorial on configuration of network interfaces, and won’t include things like teaming. It’s just a basic intro to configuring an interface for Windows guys. So don’t write me hate mail.

Method 1

As described here, IFConfig is used to not only to display current information on network interfaces, but also to configure them.

For example, to configure and interface named eth0 with an IP address of 192.168.0.10, and a subnet mask of 255.255.255.0, you would simply enter this command:# ifconfig eth0 192.168.0.10 netmask 255.255.255.0

Method 2

If you have to have some sort of “GUI” you can use the Setup utility or NetConfig. Firing up either of these from a shell will get you text-mode menu-driven method of setting network interface parameters. Using this utilities is simply a friendly way of editing the interface configuration file, located at:/etc/sysconfig/network-scripts/ifcfg-eth0

Simply type the word setup at a prompt, and you’ll be presented with the main screen. Select Network Configuration, then Edit Devices, then the interface to edit (for example, eth0). Then edit the settings as needed. Save the changes and quit the utiliity.

Note that you’ll have to restart the networking stack with this command:# /etc/init.d/network restart

Method 3

You can also edit the files that configure your network interface directly. For Windows guys, this is akin to editing the registry settings for an interface under:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces

First, you’ll have to change to the correct directory:# cd /etc/sysconfig/network-scripts/

I like to use the vi text editor to edit files on a Linux system, and this example will utilize vi. Call me old school. You can use Nano or some other editor if you like.# vi ifcfg-eth0

Append/modify as follows:# Intel Corporation 82540EM Gigabit Ethernet Controller
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HWADDR=06:01:78:a7:00:33
NETMASK=255.255.255.0
IPADDR=192.168.0.10
TYPE=Ethernet

Save and close the file. Define default gateway and hostname in /etc/sysconfig/network configuration file:# vi /etc/sysconfig/network

Append/modify configuration as follows:NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=centos.how2centos.com
GATEWAY=192.168.0.1

Save and close the file, then restart the networking services:# /etc/init.d/network restart

Summary

And there you have it, three methods of changing the network configuration on just about any Linux system, with using a graphical user interface. Working with Linux is pretty easy, once you learn the basic ins-and-outs of how it works. Becoming a Linux administrator as well as a Windows administrator will help in broadening your toolset and make you more well rounded, and thus more attractive to potential employers, or maybe get you a raise at your current employer.

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.