Network Device Configuration Files

A network administrator can find himself spending a great deal of network troubleshooting time editing the configuration files for Ethernet NICs. You will need to know how to edit both the Debian-based configuration file and the configuration scripts found in Red Hat-based distributions.

The /etc/network/interfaces File

You should already know that you edit the the /etc/network/interfaces to control settings for Ethernet NICs in Debian systems. Several GUI-based applications exist for editing these files, but the test focuses on editing the file manually.

The interfaces file is organized into stanzas. Each device (even the loopback device) receives its own stanza. A typical stanza is given below:

auto eth1
iface eth1 inet static
        address 10.0.0.5
        netmask 255.255.255.0
        gateway 10.0.0.1

The auto keyword tells the system to activate the NIC when the system boots. Usually, the system uses the /etc/init.d/networking script. The stanza shows that a system has been statically configured. If you wish to configure the system for DHCP, change static to dhcp. Once you make that change, the system will not consider the rest of the stanza and will look to the DHCP server to get its configuration information. Because this is the case, make sure that the DHCP server provides the correct subnet mask, DNS server, and default gateway information, because your system won't get that information locally.

The /etc/sysconfig/network-scripts Directory

Red Hat and many ...

Get LPI Linux Certification in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.