Linux 101 : Manually setting up network interfaces

On a Linux system, we use the "/etc/network/interfaces" file to manually set up our network adapters.

The file will be empty except for maybe the loopback interface if we are using the Network Manager to manage our network interfaces, as we can see in the below file:

We can check if our system is using the Network Manager using the below command:

Below is an example of the "/etc/network/interfaces" file when the Network Manager is not used:

We can see that we have the below configuration parameters for the "eth0" interface:
  • auto: tells the system to automatically bring up the "eth0" interface.
  • dhcp: the network interface uses dhcp to set itself up.

In the below example the interface is configured with a static IP address:

After changing the configuration of our interface, we will need to run the below command for the changes to take effect:

In the following directory "/etc/sysconfig/network-scripts", we have a list of files, one for each interface on the system.
For example for the "eth0" interface, we could find a corresponding file named "ifcfg-eth0".

Below are some of the parameters we could find in these files:

For a static configuration', the file will look something like the below:

-NM_CONTROLLED=no : means that the Network Manager is not managing our interface.

For the changes to take effect, we will need to restart the networking service as follows:


Leave as a comment: