Linux Services Organization

Our goal, introduce Linux services to the enterprise world.
Contact us in

Linux Services Organization : Linux Network Linux Server

On Red Hat Linux the network communications between nodes is done through the software network interfaces (real or virtual) related with the physical network interfaces (real). The following are the keys files in order to integrate a system on the network :


The main propose of this file is provide local DNS resolving. It can be used to resolve hostnames in small networks without DNS server.

$ cat /etc/hosts localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 server

On this system server hostname is resolved to


In this file is where the connection with a DNS server is configured.

$ cat /etc/resolv.conf


This system will forward all (an other domains) DNS queries to DNS server.


In this file is where the network activation is configured. It also set-up the system hostname.

$ cat /etc/sysconfig/network

With the parameter 'NETWORKING=no' the system will not have network connections.


These are the configuration scripts (real or virtual) associated with the physical interfaces (real). For example the configuration script for eth0 network interface is /etc/sysconfig/network-scripts/ifcfg-eth0

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0


* These interfaces can activated/deactivated individually with the commands ifup/ifdown :

$ ifup eth0
Activates network interface eth0 as specified on /etc/sysconfig/network-scripts/ifcfg-eth0

$ ifdown eth0
Deactivates interface eth0

* If the interface eth0 is configured with the parameter "ONBOOT=yes" it will be activated as specified on ifcfg-eth0 with the command :

$ /etc/init.d/network start

And deactivated with

$ /etc/init.d/network stop

All interfaces configured with "ONBOOT=yes" will be activated/deactivated at the same time with the command '/etc/init.d/network start/stop'

* The following are some useful options to be considered on /etc/sysconfig/network-scripts/ifcfg-* file :

The interface will get the ip with dhcp protocol

When is BOOTPROTO="dhcp" the dhcp server provides an ip to the interface and the DNS server on /etc/resolv.conf.

Non-root users can activate/deactivate the network interface.

Useful Network commands


This command displays/change the routing table information.

$ route -n
Displays system routing information

$ route add default gw
Sets the system default gateway to


With this command the network interfaces can be configured overwriting the values on ifcfg-* files.

$ ifconfig
Shows the network configuration of all configured network interfaces.

$ ifconfig eth0
It assigns the ip to the network interface eth0

$ ifconfig eth0:1
It creates a virtual network interface eth0:1 from eth0 with the ip

$ ifconfig eth0 up/down
Activates/deactivates eth0 network interface


This command is a dhcp-client that queries dhcp network configuration for the network interface to any active dhcp server.

$ dhclient eth0
Configures eth0 with the dhcp configuration retrieved.


This command launches a graphical application that configures the network interfaces, including wireless interfaces.


The arp command manages the relation between IP address and MAC address.

$ arp -a
? ( at 00:0c:29:4b:ce:ed [ether] on eth0
? ( at 00:0c:29:21:f7:7f [ether] on eth0

Shows all arp entries cached by the system

$ arp -d hostname
Removes hostname arp entry

$ arp -s hostname MAC
Adds hostname arp entry with mac MAC


Display/changes the network card settings.

$ ethtool eth0
Settings for eth0:
Current message level: 0x00000007 (7)
Link detected: yes

This commands verifies that there is a network wire plugged on eth0 network card.


1.- By default when a hostname resolution is done first the file /etc/hosts is checked and then the DNS server specified on /etc/resolv.conf (true/false)

2.- Only one DNS server can be configured on /etc/resolv.conf (true/false)

3.- Only root can manage network interfaces via ifcfg-* scripts (true/false)

4.- Which parameter must be specified on ifcfg-eth1 network script in order to start eth1 at boot ?

5.- Which parameter must be specified on ifcfg-eth0 network script in order to get eth0 network configuration via dhcp server ?

6.- Which command must be used in order to display the system arp table ?

7.- The command 'route -n' sets the system default gateway to (true/false)

8.- Which command must be used in order to verify if there is a network wire plugged on eth1 network interface ?

9.- Which of the following commands can be used in order activate eth0 network interface ?
A - ifup eth0
B - ifconfig eth0 up
C - Both of them
D - None of them

10.- Which of the following commands can be used in order configure as default gateway ?
A - route add default gw
B - ifconfig eth0 default gw
C - Both of them
D - None of them


1.- Configure the network interface eth0 to start as a client dhcp at boot.

2.- Create the virtual network interface eth0:1 with the ip Make sure eth0:1 start at boot.

3.- Configure the system default gateway to .

-- This page is part of Linux Server online tutorial --