• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. User Guide
  4. Creating a Private Image
  5. Creating a System Disk Image Using a Linux ECS
  6. (Optional) Deleting Network Rule Files

(Optional) Deleting Network Rule Files

This section describes how to view and clear network rule files when creating a Linux private image from an ECS.

Prerequisites

The OS, as well as xen-pv and VirtIO drivers have been installed on the ECS.

Deleting Network Rule Files

  1. Run the following command to query the files in the network rule directory:

    ls -l /etc/udev/rules.d

  2. Run the following command to delete the files whose names contain persistent and net from the network rule directory:

    Example:

    rm /etc/udev/rules.d/30-net_persistent-names.rules

    rm /etc/udev/rules.d/70-persistent-net.rules

    Replace the italic parts in the command with actual values at your site.

  3. Run the following command to check whether the initrd image file whose name starts with initrd and ends with default contains the persistent and net network device rule files (replace the italic content in the following command with the actual OS version):

    lsinitrd /boot/initrd-2.6.32.12-0.7-default |grep persistent|grep net

    • If no, you do not need to clear the files in the network rule directory.
    • If yes, go to 4.
  4. Run the following command to back up the initrd image file (replace the italic content in the following command with the actual OS version):

    cp /boot/initrd-2.6.32.12-0.7-default /boot/initrd-2.6.32.12-0.7-default_bak

  5. Run the following command to generate the initrd file again:

    mkinitrd

Perform the following operations if an OS, such as Ubuntu, uses initramfs images:
  1. Run the following command to check whether the initramfs image files starting with initrd and ending with generic contain persistent and net rule files.

    lsinitramfs /boot/initrd.img-3.19.0-25-generic|grep persistent|grep net

    If no, you do not need to clear the files in the network rule directory.

    If yes, go to 2.

  2. Run the following command to back up the initrd image file:

    cp /boot/initrd.img-3.19.0-25-generic /boot/initrd.img-3.19.0-25-generic_bak

  3. Run the following command to generate the initramfs image files again:

    update-initramfs -u

Disabling NetworkManager

There are two methods for installing Linux online:
  • NetworkManager: provides automatic network configuration function.
  • ifup commands

To enable the ECS to obtain an IP address automatically by static injection, use the predefined configuration file to overwrite the network configuration file in the ECS during the ECS creation to configure an IP address for it.

Therefore, the purpose of configuring the Linux OS online installation method is to disable the NetworkManager function. After it is disabled, the network configuration file in the ECS can be overwritten.

You can run one of the following commands to disable NetworkManager depending on the OS:

# service NetworkManager stop; chkconfig NetworkManager off

or

# systemctl stop NetworkManager.service; systemctl disable NetworkManager.service

For SUSE Linux, you can also use YaST to disable NetworkManager. The procedure is as follows:

NOTE:

These steps are not required if no NetworkManager is deployed on the OS, for example, SUSE Linux Enterprise 12.

  1. Run the following command on the ECS to enter the control center:

    yast

  2. Choose Network Devices > Network Settings.
  3. On the Network Settings page, press Alt+G.

    The Global Options page is displayed.

    NOTE:

    If the shortcut keys provided in the steps do not take effect in practice due to OS version or language diversities, use Tab, and  keys to select the required options.

  4. Press Alt+T and select Traditional Method with ifup.
  5. Press F10 to save the configuration and exit the control center.
  6. Hold down Alt and press Q.

    The command line interface (CLI) is displayed.