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.
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.
Red Hat and many other distributions use the files in the /etc/sysconfig/network-scripts directory to configure Ethernet NICs. Each network device, even the loopback device, receives its own file. Settings for the eth0 device are found in the ifcfg-eth0 file, settings for the eth1 device are found in the ifcfg-eth1 file, and so forth.
A relatively simple entry for the second NIC in a system follows:
DEVICE=eth1 ONBOOT=yes BOOTPROTO=static IPADDR=10.0.0.4 NETMASK=255.255.255.0 GATEWAY=10.0.0.1
In this sample, the ONBOOT=yes
entry has the system activate at boot time using the /etc/init.d/network script. If you have a removable card, such as a USB wireless card, you would see the ONBOOT=no
directive.
The BOOTPROTO
directive can be either static
, as shown before, or dhcp
. As with Debian-based systems, if dhcp
is specified, all other manual settings in this file are ignored for this NIC.
If you find that an NIC will not respond to the ifup or ifconfig commands, study the files discussed in this section carefully for problems.
PCMCIA network cards are often configured using the /etc/pcmcia/network.opts file, rather than any other configuration file. You can edit this file by hand or by using the pcnetconfig command. You will likely find that editing the file by hand is easier. Essential directives to troubleshoot in this file include those in Table 41-3. Additional settings also exist; review the file to learn more.
Table 41-3. Important PCMCIA configuration directives
Directive |
Purpose |
---|---|
|
Sets the IP address for the NIC |
|
Determines the subnet mask |
|
Configures the NIC's network address |
|
Provides the default gateway |
|
Sets the DNS domain for the NIC |
|
Informs the NIC whether it should look for a DHCP server |
|
Establishes PPOE support for NICs that will be on DHCP lines |
Study the /etc/networks file. Make sure it does not list the wrong network; if it does, simply edit the file by hand and insert the correct network. If your system belonged to the 192.168.2.0 network, the entry would be:
localnet 192.168.2.0
Make sure that the /etc/nsswitch file is configured correctly for your situation. The system you are using may think that it should no longer look for a DNS server for name resolution or should look for an NIS server instead of its own password database to authenticate users.
Sometimes, systems will seem to hang for an unacceptably long period of time during a DNS lookup. It might appear that this problem is somehow related to your DNS server or to some other name resolution issue, such as resolution order.
If you are relatively sure that your DNS server is working well, that /etc/nsswitch.conf file is configured correctly, and that your system is trying to resolve with the correct server via /etc/resolv.conf, consider reviewing the /etc/host.conf and /etc/modprobe.d/aliases files. They are discussed next.
This file specifies your system's resolution order. If it is configured to look only for the /etc/host.conf file and not for BIND, make sure that a line exists that reads:
order hosts, bind
You can reverse the order if you wish.
This file contains instructions that affect which type of IP you are using. Most systems still use IPv4, but IPv6 is becoming more common all the time. Some Linux systems default to using IPv6 first. If your system is configured to look for an IPv6 address first, then an IPv4 address, network connections can become quite slow.
To solve the problem, edit the /etc/modprobe.d/aliases file as root and uncomment or add the following lines:
alias net-pf-10 off alias ipv6 off
These lines make sure that IPv6 lookups are turned off. You may find, after doing this, that resolution and other network activities work much faster. The reverse may be true, of course; you may find that your system is not using the IPv6 addresses you have configured. If that is the case, comment the two entries.
Regardless of the changes you make to the /etc/modprobe.d/aliases file, you will need to run the update-modules command as root to make sure that your system recognizes your changes.
The /etc/hostname file simply contains the system's hostname, as you might expect. The /bin/hostname command reads the contents of the /etc/hostname file at boot time.
If the name in this file conflicts with other system settings, your system may experience serious problems. This is particularly the case in older systems (e.g., circa 1999).Some applications and daemons are very rigid about reading the information in the /etc/hostname file. Some daemons may become confused, because DNS tells them one name as the IP address, and the /etc/hostname file tells them another. To solve the problem, simply edit the file using a text editor as root and provide the correct name.
Applications also often have configuration files that can cause connectivity problems. First, consider the fact that web browsers, email clients, and many other clients often need to be configured to use a proxy server. A connectivity problem may be as simple as making sure that the client is properly configured to use a proxy server.
Clients must sometimes be configured to work efficiently on a network. Firefox, for example, is sometimes configured to look for IPv6 addresses first and then IPv4. To make Firefox use IPv4 first, type about:config
into the address bar. You will see a large, long listing of configuration settings for Firefox.
Scroll down and find the following value:
network.dns.disableIPv6
Double-click on this value to change its value to true.
You can take additional steps to optimize Firefox, but they are beyond the scope of this exam. It is important to understand, however, that when troubleshooting, application settings should also be considered.