No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

The NIC Cannot Be Reset by Using the ifdown and ifup Scripts

Publication Date:  2015-06-25 Views:  73 Downloads:  0
Issue Description
Hardware configuration:
A XH620

Software configuration:
The network interface cards (NICs) eth0 and eth1 are configured as bond0 (ifcfg-bond0). The configuration files ifcfg-eth0 and ifcfg-eth1 are not configured.

Symptom:

The maintenance personnel at a site run the (bash -x /sbin/ifdown eth0 ;echo ---------; bash -x /sbin/ifup eth0) >>/tmp/log.txt 2>&1 command to reset NIC eth0, trace the NIC reset process, and run the ifconfig -a command to check that the state of NIC eth0 is down. Figure 1 shows the command output.

Figure 1 eth0 down

Handling Process
1.  NIC eth0 can be started by running the ifconfig eth0 up command.

2.  If you run the (bash -x /sbin/ifdown eth0 ;echo ---------; bash -x /sbin/ifup eth0) >>/tmp/log.txt 2>&1 command again, the problem persists.

3.  According to the log.txt in Step 2, the ifdown and ifup scripts read the configuration file ifcfg-eth0 of eth0 and set the state of eth0 based on the configuration file, as shown in Figure 2.

Figure 2 Resetting eth0 by using the fdown and ifup scripts



4.  The operating system (OS) of the onsite server does not independently configure the configuration file ifcfg-eth0 of eth0. As a result, eth0 cannot be started by running the ifup command.

5.  Check the messages log and find that "No configuration found for eth0" is displayed, as shown in Figure 3.

Figure 3 messages log

Root Cause
If the configuration file ifcfg-eth N (N indicates the NIC number, such as 0, 1, and 2) does not exist, the NIC cannot be started by running the ifup ethN command. However, you can run the ifconfig eth0 up command to start eth0. The ifconfig commands do not check NIC configuration files but directly operate on NIC hardware through drivers.

If the configuration file ifcfg-eth0 does not exist, the NIC cannot be started by running the ifup ethN command.

Solution
Recover the NIC by using one of the following methods:
  • Restart the network service
  • Run the ifconfig ethN up (N indicates the NIC number, such as 0, 1, and 2) command.
Suggestions
ifdown and ifup are shell scripts which read the NIC configuration file ifcfg-eth N when operating a NIC. The ifconfig commands are binary commands which do not read the NIC configuration file but directly operate the NIC hardware. Therefore, you can run the ifconfig eth0 up command to activate the eth0 network port when no ifcfg-eth0 exists.

Suggestion:

You are advised to run the ifconfig ethN down/up command to reset a NIC rather than the ifdown/ifup ethN command.

Note:
The (bash -x /sbin/ifdown eth0 ;echo ---------; bash -x /sbin/ifup eth0) >>/tmp/log.txt 2>&1 command is used to reset eth0, trace the reset process, and redirect to the /tmp/log.txt file. The following describes the command:
  1. bash -x indicates that the bash execution script is used. -x indicates the commissioning switch for tracing the script execution process.
  2. /sbin/ifdown eth0 indicates that eth0 is disabled. /sbin/ifup eth0 indicates that eth0 is enabled. The combination of these two commands is used to reset eth0.
  3. echo --------- indicates the output characters. --------- is the separator that separates execution processes of the bash -x /sbin/ifdown eth0 and bash -x /sbin/ifup eth0 commands.
  4. >>/tmp/log.txt 2>&1 indicates that the bash -x /sbin/ifdown eth0 ;echo ---------; bash -x /sbin/ifup eth0 execution process is redirected to the /tmp/log.txt file (including standard output and error output).

END