fortypoundhead.com

Configuring Network Interfaces in Linux

Posted On 2014-10-05 by dwirch
Keywords:
Tags: Tutorial Networking Linux Commandline Linux
Views: 1448


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.


About the Author

dwirch has posted a total of 173 articles.

You can find more information from dwirch by visiting http://www.derekwirch.com.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.198.233.27

Before you can post, you need to prove you are human. If you log in, this test goes away.



Recent Forum Posts

Fold Code Manager into main KB?
VB6Boy posted on July 22, 2017 at about 14:42 in Site News

Fold Code Manager into main KB?
dwirch posted on July 22, 2017 at about 14:41 in Site News

Fold Code Manager into main KB?
dwirch posted on July 21, 2017 at about 22:46 in Site News

Fold Code Manager into main KB?
dwirch posted on July 20, 2017 at about 7:55 in Site News

Job Spammer: Sam Mallon
dwirch posted on July 18, 2017 at about 18:36 in Spammers

When setting up a certificate authority ...
dwirch posted on July 13, 2017 at about 9:07 in General