Saturday 12 April 2014

Manually Configure NIC on Fedora

Summary
   
    Introduction
    Location of Network Configuration Files
    Creating the Configuration File
    Contents of the File
    Reload Network Connection

Introduction

After installed Fedora distribution on a machine and need to give this engine a fixed network configuration. However, this is not like Debian, Ubuntu, etc ... i.e. the file "/etc/network/interfaces".

There is a simple way to have done from the GUI. But I prefer to learn to do it directly from a configuration file. This is why I propose you through this tutorial to show you how to manually configure a network interface.

Location of Network Configuration Files

The network configuration files are located in the following directory:

/etc/sysconfig/network-scripts/

Among the set of files, one can notice that there is a file named "ifcfg-lo" which infact is the configuration of the local loopback interface on your machine.

Creating the Configuration File

To find out what name carries the physical network interface of our machine, it runs the command "ifconfig". See output as shown below:

ifcfg-eth0

With the following command (change according to your text editor):

vim ifcfg-eth0

Contents of the File

Now for the most crucial of this tutorial, the file contents. Found essentially the same guidelines as Debian but we do not write the same way.
Here is a sample configuration file with explanatory comments:

# Name of the NIC
DEVICE = eth0
# The network
NETWORK = 192.168.1.0
# The broadcast address
BROADCAST = 192.168.1.255
# Start the interface at startup (yes/no)
ONBOOT = YES
# The name of the connection
NAME = lan
# The connection type
TYPE = Ethernet
# Network Configuration Protocol (dhcp/none)
BOOTPROTO = none
# Static IP address
IPADDR = 192.168.1.100
# The subnet mask (255.255.255.0 = 24)
PREFIX = 24
# The default gateway
Gateway = 192.168.1.1
# The primary DNS server
DNS1 = 192.168.1.1


Reload Network Connection

For the new configuration to take effect must, of course, charge the network connection through the following command:

/etc/init.d/network restart

Enjoy, your network interface is configured!

No comments:

Post a Comment