Home » , , » Configuring Networks at Boot Time in Linux

Configuring Networks at Boot Time in Linux

Written By Sajib Barua on Sunday, August 19, 2012 | 8:42 AM

previous Linux: Managing the Network

It makes sense to start your network automatically every time you boot the system. For that to happen, various startup scripts must contain appropriate commands. You don’t have to do anything special other than configure your network (either during installation or by using the network configuration tool at a later time). If the network balks at startup, however, you can troubleshoot by checking the files I mention in this section.

In Debian, Ubuntu, and Xandros, the /etc/network/interfaces file describes the network interfaces available in your system, and the /sbin/ ifup command activates the interfaces when you boot the system. Here is the content of a typical /etc/network/interfaces file from a Debian system:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp

The auto eth0 line indicates that you can bring up the Ethernet interface at initialization by using the command ifup -a invoked by a system startup script. The line ifup eth0 inet dhcp identifies Ethernet as a TCP/IP network interface that is configured by Dynamic Host Configuration Protocol (DHCP).

In Fedora, the network-activation script uses a set of text files in the /etc/

sysconfig directory to activate the network interfaces. For example, the script checks the variables defined in the /etc/sysconfig/network file to decide whether to activate the network. In /etc/sysconfig/network, you see a line with the NETWORKING variable as follows:

NETWORKING=yes

The network activates only if the NETWORKING variable is set to yes. A number of scripts in the /etc/sysconfig/network-scripts directory activate specific network interfaces. For example, the configuration file for activating the Ethernet interface eth0 is the file /etc/sysconfig/ network-scripts/ifcfg-eth0. Here’s what a typical /etc/sysconfig/ network-scripts/ifcfg-eth0 file contains:

DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:08:74:E5:C1:06
ONBOOT=yes
TYPE=Ethernet

The DEVICE line provides the network device name. The BOOTPROTO variable is set to dhcp, indicating that the IP address is obtained dynamically by using DHCP. The ONBOOT variable states whether this network interface activates when Linux boots. If your PC has an Ethernet card and you want to activate the eth0 interface at boot time, ONBOOT must be set to yes. The configuration file ifcfg-eth0 in the /etc/sysconfig/networkscripts directory works only if your PC has an Ethernet card and the Linux kernel has detected and loaded the specific driver for that card.

In SUSE, the network information is kept in the /etc/sysconfig/network directory in files with names beginning with ifcfg. For Ethernet interfaces, the configuration filename begins with ifcfg-eth-id- followed by the unique hardware address of the Ethernet card. Here are the key lines in a typical Ethernet configuration file:

BOOTPROTO=’dhcp’
STARTMODE=’auto’

The BOOTPROTO=’dhcp’ line indicates that the interface is set up using DHCP, and STARTMODE=’auto’ means that the interface is initialized when the system boots.

Within KDE, you can start the Control Center by typing Session Manager in the Search box and configuring the default operations for the system, as shown in Figure 4-2.

The Session Manager

Figure 4-2: The Session Manager.

Within KDE and GNOME, you can run the Login Manager utility to choose the default operations for the system. Figure 4-3 shows an example of the Login Manager dialog box as it appears in Fedora (based upon your version, the Login Manager may not be installed by default). If a boot manager was installed to handle multiple operating systems, the Boot Manager option in Figure 4-3 would be enabled.

The Login Manager offers several options

Figure 4-3: The Login Manager offers several options.

next Linux: The Internet

Share this article :

0 comments:

Post a Comment

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Linux - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger