01-Fundamentals Configuration Guide

HomeSupportRoutersCR16000-M SeriesConfigure & DeployConfiguration GuidesH3C CR16000-M Routers Configuration Guides-R8530Pxx-6W10101-Fundamentals Configuration Guide
09-Automatic configuration
Title Size Download
09-Automatic configuration 230.33 KB

Using automatic configuration

About automatic configuration

With the automatic configuration feature, the device can automatically obtain a set of configuration settings at startup. This feature simplifies network configuration and maintenance.

Automatic configuration can be implemented by using the implementation methods in Table 1.

Table 1 Automatic configuration implementation methods

Implementation method

Configuration file location

Application scenarios

Server-based automatic configuration

File server

A number of geographically distributed devices need to be configured.

Using server-based automatic configuration

About server-based automatic configuration

As shown in Figure 1, server-based automatic configuration requires the following servers:

·     DHCP server—A DHCP server assigns IP addresses to devices that need to be automatically configured and informs the devices of the configuration or script file paths.

·     File server (TFTP or HTTP server)—A file server stores the configuration files or scripts for automatic configuration.

·     DNS server—A DNS server obtains the configuration file names or the IP address of the file server for devices.

Figure 1 Server-based automatic configuration network diagram

Host name file

A host name file contains the host name-IP address mappings of the devices to be automatically configured.

To prepare the host name file:

1.     Create a host name file named network.cfg.

2.     Add each mapping entry in the ip host host-name ip-address format on a separate line. For example:

ip host host1 101.101.101.101

ip host host2 101.101.101.102

ip host client1 101.101.101.103

ip host client2 101.101.101.104

 

IMPORTANT

IMPORTANT:

The host name for a device must be the same as the name of the configuration file configured for the device.

Selecting an interface used for automatic configuration

The device uses the following steps to select an interface for automatic configuration:

1.     Identifies the status of the management Ethernet interface at Layer 2. If the status is up, the device uses the management Ethernet interface.

2.     Identifies the status of Layer 2 Ethernet interfaces. If one or more Layer 2 Ethernet interfaces are in up state, the device uses the VLAN interface of the default VLAN.

3.     Sorts all Layer 3 Ethernet interfaces in up state first in lexicographical order of interface types and then in ascending order of interface numbers. Uses the interface with the smallest interface number among the interfaces of the first interface type.

4.     If no Layer 3 Ethernet interfaces are in up state, the device waits 30 seconds and goes to step 1 to try again.

For fast automatic device configuration, connect only the management Ethernet interface on each device to the network.

Operating mechanism

The server-based automatic configuration mechanism for a device is as follows:

1.     The device selects an interface for automatic configuration, and sends an IP address request to the DHCP server. For more information about the procedures for selecting an interface for automatic configuration, see "Selecting an interface used for automatic configuration."

2.     Upon receiving the request, the DHCP server sends a response to the device. If no response is received within the timeout time, the device selects the next interface in sequence and sends an IP address request again.

3.     The device parses the response and performs the following operations:

¡     Obtains the IP address carried in the response and uses this IP address as the IP address of the interface to connect to the DHCP server. If the interface already has an IP address, the interface's IP address is modified to the obtained IP address, and then restored to the original IP address when automatic configuration is complete.

¡     Obtains the protocol information (HTTP or TFTP), configuration file name information, and file server address carried in the response.

4.     If no configuration file name is obtained or the obtained configuration file name does not meet the requirements, the device uses network.cfg on the file server. If network.cfg does not exist, device.cfg is used. If device.cfg also does not exist, the device fails to obtain the configuration file and goes to step 1 to try again.

5.     If the file server address carried in the response is a domain name instead of an IP address, the DNS server resolves the file server's domain name into an IP address.

6.     The device downloads the configuration file or script from the file server based on the parsed protocol, file server address, and configuration file name.

7.     After the download is successful, the device deploys the configuration or executes the script.

8.     After configuration deployment or script execution, the device automatically deletes the configuration file or script.

Server-based automatic configuration tasks at a glance

To configure server-based automatic configuration, perform the following tasks:

1.     Prepare the files for automatic configuration:

¡     Preparing configuration files

¡     Preparing script files

2.     Configuring the file server

3.     Configuring the DHCP server

4.     (Optional.) Configuring the DNS server

5.     (Optional.) Configuring the gateway

6.     Completing automatic configuration

7.     (Optional.) Ending automatic configuration

Preparing configuration files

Configuration file types

The device supports the configuration file types listed in Table 2.

Table 2 Configuration file types

Configuration file type

Application objects

File name requirements

Supported file server types

Dedicated configuration file

Devices that require different settings

File name.cfg

For simple file name identification, use configuration file names that do not contain spaces.

·     TFTP server

·     HTTP server

Common configuration file

Devices that share all or some settings

File name.cfg

For simple file name identification, use configuration file names that do not contain spaces.

·     TFTP server

·     HTTP server

Default configuration file

All devices.

The file contains only common configurations that devices use to start up.

device.cfg

TFTP server

Identifying requirements for and preparing configuration files

1.     Identify the requirements of the devices for configuration files.

2.     For devices that require different configurations, prepare a configuration file for each of them and save the file to the file server.

3.     For devices that share all or some configurations, save the common configurations to a .cfg file on the file server.

4.     If a TFTP file server is used, you can save the common configurations that devices use to start up to the device.cfg file on the server. The file is assigned to a device only when the device does not have any other configuration file to use.

Preparing the host name file on the file server

If a file server is used and the DHCP server does not assign configuration file names, you can configure a host name file on the file server. The host name file contains the host name-IP address mappings of the devices to be automatically configured.

Preparing script files

About this task

Script files can be used for automatic software upgrade and automatic configuration.

The device supports Python scripts (.py files) and Tcl scripts (.tcl files). For more information about Python and Tcl scripts, see "Using Python" and "Using Tcl."

The device supports dedicated script files and common dedicated script files. It does not support using a default script file. For information about dedicated script files and common dedicated script files, see Table 2.

When script files are used, you cannot use a host name file to provide the host name-IP address mappings for devices.

Restrictions and guidelines

To use a Tcl script, make sure all commands in the script are supported and correctly configured. Any error in a command causes the automatic configuration process to quit.

To use a Python script, make sure all commands in the script are supported and correctly configured. Any error in a command causes this automatic configuration to fail and triggers the start of the next automatic configuration.

Procedure

·     For devices that share all or some configurations, create a script file that contains the common configurations.

·     For the other devices, create a separate script file for each of them.

Configuring the file server

For devices to obtain configuration information from a TFTP server, start TFTP service on the file server.

For devices to obtain configuration information from an HTTP server, start HTTP service on the file server.

Configuring the DHCP server

About this task

The DHCP server assigns the following items to devices that need to be automatically configured:

·     IP addresses.

·     Paths of the configuration or script files.

Restrictions and guidelines

When you configure the DHCP server, follow these guidelines:

·     For devices for which you have prepared different configuration files, perform the following tasks for each of the devices on the DHCP server:

¡     Create an IP pool.

¡     Configure a static address binding.

¡     Specify a configuration file or script file.

Because an IP pool can use only one configuration file, you can specify only one static address binding for an IP pool.

·     For devices for which you have prepared the same configuration file, use either of the following methods:

¡     Method 1:

-     Create an IP pool for the devices.

-     Configure a static address binding for each of the devices in the IP pool.

-     Specify the configuration file for the devices.

¡     Method 2:

-     Create an IP pool for the devices.

-     Specify the subnet for dynamic allocation.

-     Specify the TFTP server.

-     Specify the configuration file for the devices.

·     If all devices on a subnet share the same configuration file or script file, perform the following tasks on the DHCP server:

¡     Configure dynamic address allocation.

¡     Specify the configuration file or script file for the devices.

The configuration file can contain only the common settings for the devices. You can provide a method for the device administrators to change the configurations after their devices start up.

Configuring the DHCP server when an HTTP file server is used

1.     Enter system view.

system-view

2.     Enable DHCP.

dhcp enable

By default, DHCP is disabled.

3.     Create an IP pool and enter its view.

ip pool pool-name

4.     Configure the IP pool.

Choose the options to configure as needed:

¡     Specify the primary subnet for the IP pool.

network network-address [ mask-length | mask mask ]

By default, no primary subnet is specified.

¡     Configure a static binding.

static-bind ip-address ip-address [ mask-length | mask mask ] { client-identifier client-identifier | hardware-address hardware-address [ ethernet | token-ring ] }

By default, no static binding is configured.

You can configure multiple static bindings. However, one IP address can be bound to only one client. To change the binding for a DHCP client, you must remove the binding and reconfigure a binding.

5.     Specify the URL of the configuration or script file.

bootfile-name url

By default, no configuration or script file URL is specified.

Configuring the DHCP server when a TFTP file server is used

1.     Enter system view.

system-view

2.     Enable DHCP.

dhcp enable

By default, DHCP is disabled.

3.     Create an IP pool and enter its view.

ip pool pool-name

4.     Configure the IP pool.

Choose the options to configure as needed:

¡     Specify the primary subnet for the IP pool.

network network-address [ mask-length | mask mask ]

By default, no primary subnet is specified.

¡     Configure a static binding.

static-bind ip-address ip-address [ mask-length | mask mask ] { client-identifier client-identifier | hardware-address hardware-address [ ethernet | token-ring ] }

By default, no static binding is configured.

You can configure multiple static bindings. However, one IP address can be bound to only one client. To change the binding for a DHCP client, you must remove the binding and reconfigure a binding.

5.     Specify a TFTP server.

Choose one option as needed:

¡     Specify the IP address of the TFTP server.

tftp-server ip-address ip-address

By default, no TFTP server IP address is specified.

¡     Specify the name of the TFTP server.

tftp-server domain-name domain-name

By default, no TFTP server name is specified.

If you specify a TFTP server by its name, a DNS server is required on the network.

6.     Specify the name of the configuration or script file.

bootfile-name bootfile-name

By default, no configuration or script file name is specified.

Configuring the DNS server

A DNS server is required in the following situations:

·     Obtaining the configuration file names for devices—The TFTP server does not have a host name file. Devices need to provide the DNS server with their IP addresses to obtain their host names. Then, the devices can obtain configuration files named in the host name.cfg format from the TFTP server.

·     Obtaining the IP address of the file server—The DHCP server assigns the file server domain name through the DHCP reply message. Devices must use the domain name to obtain the IP address of the file server.

For more information about DNS servers, see Layer 3—IP Services Configuration Guide.

Configuring the gateway

If the devices to be automatically configured and the servers for automatic configuration reside in different network segments, you must perform the following tasks:

·     Deploy a gateway and make sure the devices can communicate with the servers.

·     Configure the DHCP relay agent feature on the gateway.

A device uses broadcast packets to send requests to a TFTP server if the DHCP reply does not contain the IP address or domain name of the TFTP server or the IP address or domain name of the TFTP server is invalid.

In this case, you must configure the UDP helper feature on the gateway. This task is required if devices send requests to a TFTP server by using broadcast packets. The UDP helper transforms a broadcast packet into a unicast packet and forwards the unicast packet to the file server. For more information about UDP helper, see Layer 3—IP Services Configuration Guide.

Completing automatic configuration

1.     Power on the devices to be automatically configured.

2.     If a device does not find a next-start configuration file locally but obtains a configuration file and executes the file successfully, the automatic configuration process ends.

3.     Save the running configuration.

save

As a best practice, save the running configuration after execution of the configuration file is complete.

For more information about the save command, see Fundamentals Command Reference.

Ending automatic configuration

If one configuration file obtaining attempt fails, the device tries again until the maximum number of attempts is reached. To stop the process, press Ctrl+C or Ctrl+D.

When the device fails to obtain a configuration file, the device starts up without loading any configuration.

Using URL-based automatic configuration

About URL-based automatic configuration

URL-based automatic configuration automatically deploys basic configuration to a device by reading commands in an URL when the device starts up. Use this feature to perform zero-touch provisioning for a device.

About URLs for automatic configuration

The URLs used by URL-based automatic configuration are automatically generated by the controller. The controller can generate the following types of URLs:

·     Plaintext URL—All characters in the URL are in plain text format.

·     Ciphertext URL—All characters in the URL are in cipher text format. Ciphertext URLs are more secure than plaintext URLs.

URL format

The URL format is http://ip-address/urlcfg?cmd1=system-view&link_mode=CLI&cmdn=xxx<1-149>.

Table 3 describes each field.

Table 3 Fields in an URL for automatic configuration

Field

Description

ip-address

IP address of the target device to be configured by URL-based automatic configuration. This IP address is the factory default IP address of the device.

cmd1=system-view

Enter system view.

link_mode=CLI

Indicates that the URL deploys commands.

cmdn=xxx<1-149>

Commands deployed by URL-based automatic configuration. You can specify commands as needed.

·     The n argument represents the nth command deployed. The value range for the n argument is 2 to 150.

·     The xxx argument specifies a command to be deployed. Replace spaces between keywords and arguments in the command with plus signs (+).

·     <1-149> indicates that a URL can contain 1 to 149 commands excluding the system-view command.

 

URL example

The following is a URL that can be used to configure basic settings such as device name and router ID for a device with IP address 192.168.1.1:

http://192.168.1.1/urlcfg?cmd1=system-view&link_mode=CLI&cmd2=sysname+test-vsr&cmd3=router+id+1.1.1.10&cmd4=dns+proxy+enable&cmd5=interface+GigabitEthernet2%2F0&cmd6=port+link-mode+route&cmd7=ip+address+10.1.2.1+24&cmd8=bandwidth+10000&cmd9=ip+route-static+10.1.2.10+24+10.1.2.1+preference+60&cmd10=cloud-management+server+domain+www.example.com+port+19443&cmd11=cloud-management+keepalive+60&cmd12=cloud-management+server+port+19443&cmd13=save+force

After this URL is deployed to the device, the device will automatically convert these parameters into the following commands and save them to the next-startup configuration file. Then, the device does not need to use the URL again upon the next startup.

#

sysname test-vsr

#

router id 1.1.1.10

#

dns proxy enable

#

interface GigabitEthernet2/0

port link-mode route

ip address 10.1.2.1 24

bandwidth 10000

#

ip route-static 10.1.2.10 24 10.1.2.1 preference 60

#

cloud-management server domain www.example.com port 19443

#

cloud-management keepalive 60

cloud-management server port 19443

#

URL-based automatic configuration workflow

Figure 2 Network diagram for URL-based automatic configuration

 

As shown in Figure 2, URL-based automatic configuration works as follows:

1.     The administrator imports a device to the controller, completes basic configuration for the device, and generates a URL based on the basic configuration.

2.     The administrator sends the URL to the deployment engineer.

3.     The deployment engineer establishes a connection between the deployment endpoint (PC or mobile phone) and the device, and executes the obtained URL in the address bar of the Web page on the deployment endpoint.

4.     For an encrypted URL, the deployment engineer must enter the URL encryption password on the Web page to decrypt the URL.

5.     The deployment engineer enters the username and password for logging in to the Web interface of the device.

6.     The device receives the URL request, parses the URL, and displays the obtained configuration on the Web interface for the deployment engineer to confirm.

7.     The deployment engineer confirms and deploys the configuration in the URL.

8.     After the configuration is successfully deployed, the basic configuration for the device is completed.

Enabling URL-based automatic configuration

1.     Enter system view.

system-view

2.     Enable URL-based automatic configuration.

autodeploy url enable

By default, URL-based automatic configuration is enabled.

Using USB-based automatic configuration

About USB-based automatic configuration

USB-based automatic configuration enables the device to obtain a configuration file from a connected USB disk at startup.

The configuration file for USB-based automatic configuration can be in either of the following forms:

·     Plaintext form—The configuration file is saved in plaintext form.

·     Encrypted form—The configuration file is generated by the administrator in encrypted form by using the controller. When being transmitted to a USB disk, the configuration data in the file is transmitted in encrypted form. When being used to perform automatic configuration, the configuration data is automatically decrypted by the device.

After obtaining a configuration file, the device compares the file with its main startup configuration file, if any.

·     If the two files have the same settings, the device loads its main startup configuration file.

·     If the two files have different settings, the device performs the following operations:

a.     Identifies whether its main startup configuration file is using the same name as the obtained configuration file. If yes, the device renames its main startup configuration file by adding _bak to the base name of the file.

b.     Saves the obtained configuration file locally.

If a non-startup configuration file in the directory is using the same name as the obtained configuration file, the device overwrites the existing file without a prompt.

c.     Loads the obtained configuration file.

-     If all commands in the obtained configuration file are successfully loaded, the device sets the obtained configuration file as the main startup configuration file.

-     If a command in the obtained configuration file fails, the device removes all loaded settings and searches for a local configuration file.

If a configuration file is found, the device loads the configuration file. If no configuration file is found, the device finishes the automatic configuration process without loading any configurations.

Preparing the USB disk for automatic configuration

1.     Prepare a USB disk that has only one partition.

2.     Display the serial number of the device.

display device manuinfo

For more information about this command, see Fundamentals Command Reference.

3.     Create a configuration file named Device serial number.cfg or autodeploy.cfg, and save the file to the root directory of the file system on the USB disk.

If a configuration file named Device serial number.cfg coexists with configuration file autodeploy.cfg, the configuration file named Device serial number.cfg is used.

Configuring and using USB-based automatic configuration

1.     Enable USB-based automatic configuration on the device:

a.     Enter system view.

system-view

b.     Enable USB-based automatic configuration.

autodeploy udisk enable

By default, USB-based automatic configuration is enabled.

A device reboot is required for USB-based automatic configuration. Save the running configuration to ensure that the USB-based automatic configuration feature takes effect after a reboot.

c.     Save the running configuration.

save

2.     Connect the USB disk to the USB1 interface on the active MPU.

The USB disk will be identified as usba0. The device supports USB-based automatic configuration on only one MPU. The obtained configuration file will be synchronized from the active MPU to the standby MPU.

3.     Manually reboot the device and observe the LEDs of the device.

¡     If the SYS LED flashes green quickly for 5 seconds, the automatic configuration succeeded. Proceed to step 5.

¡     If the SYS LED flashes yellow quickly for 10 seconds, the automatic configuration failed. Display the log file named Fully qualified configuration file name.log in the USB disk root directory to locate and resolve the problem.

How LED status reflects automatic configuration results depends on the device model.

4.     If the automatic configuration succeeded, use the display current-configuration command to verify that the configuration file has been loaded correctly.

5.     Remove the USB disk.

Server-based automatic configuration examples

Example: Using a TFTP server for automatic configuration

Network configuration

As shown in Figure 3, Router B does not have a configuration file.

Configure the servers so Router B can obtain a configuration file to complete the following configuration tasks:

·     Enable the administrator to Telnet to Router B to manage Router B.

·     Require the administrator to enter the correct username and password at login.

Figure 3 Network diagram

Procedure

1.     Configure the DHCP server:

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Configure IP pool 1 to assign IP addresses on the 192.168.1.0/24 subnet to clients. Specify the TFTP server and configuration file name for the clients.

[RouterA] ip pool 1

[RouterA-ip-pool-1] network 192.168.1.0 24

[RouterA-ip-pool-1] tftp-server ip-address 192.168.1.40

[RouterA-ip-pool-1] bootfile-name device.cfg

[RouterA-ip-pool-1] quit

2.     Configure the TFTP server:

# On the TFTP server, create a configuration file named device.cfg.

#

telnet server enable

#

local-user user

password simple abcabc

service-type telnet

quit

#

user-interface vty 0 63

authentication-mode scheme

user-role network-admin

quit

#

interface ten-gigabitethernet 3/0/1

port link-mode route

ip address dhcp-alloc

return

# Start TFTP service software. (Details not shown.)

Verifying the configuration

1.     Power on Router B.

2.     After Router B starts up, display assigned IP addresses on Router A.

<RouterA> display dhcp server ip-in-use

IP address       Client identifier/    Lease expiration      Type

                 Hardware address

192.168.1.2      0030-3030-632e-3239-  Dec 12 17:41:15 2013  Auto(C)

                 3035-2e36-3736-622d-

                 4574-6830-2f30-2f32

3.     Telnet to 192.168.1.2 from Router A.

<RouterA> telnet 192.168.1.2

4.     Enter username user and password abcabc as prompted. (Details not shown.)

You are logged in to Router B.

Example: Using an HTTP server and Tcl scripts for automatic configuration

Network configuration

As shown in Figure 4, Router B does not have a configuration file.

Configure the servers so Router B can obtain a Tcl script to complete the following configuration tasks:

·     Enable the administrator to Telnet to Router B to manage Router B.

·     Require the administrator to enter the correct username and password at login.

Figure 4 Network diagram

Procedure

1.     Configure the DHCP server:

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Configure IP pool 1 to assign IP addresses on the 192.168.1.0/24 subnet to clients.

[RouterA] ip pool 1

[RouterA-ip-pool-1] network 192.168.1.0 24

# Specify the URL of the script file for the clients.

[RouterA-ip-pool-1] bootfile-name http://192.168.1.40/device.tcl

2.     Configure the HTTP server:

# Create a configuration file named device.tcl on the HTTP server.

system-view

telnet server enable

local-user user

password simple abcabc

service-type telnet

quit

user-interface vty 0 63

authentication-mode scheme

user-role network-admin

quit

 

interface ten-gigabitethernet 3/0/1

port link-mode route

ip address dhcp-alloc

return

# Start HTTP service software and enable HTTP service. (Details not shown.)

Verifying the configuration

1.     Power on Router B.

2.     After Router B starts up, display assigned IP addresses on Router A.

<RouterA> display dhcp server ip-in-use

IP address       Client identifier/    Lease expiration      Type

                 Hardware address

192.168.1.2      0030-3030-632e-3239-  Dec 12 17:41:15 2013  Auto(C)

                 3035-2e36-3736-622d-

                 4574-6830-2f30-2f32

3.     Telnet to 192.168.1.2 from Router A.

<RouterA> telnet 192.168.1.2

4.     Enter username user and password abcabc as prompted. (Details not shown.)

You are logged in to Router B.

Example: Using an HTTP server and Python scripts for automatic configuration

Network configuration

As shown in Figure 5, Router B does not have a configuration file.

Configure the servers so Router B can obtain a Python script to complete the following configuration tasks:

·     Enable the administrator to Telnet to Router B to manage Router B.

·     Require the administrator to enter the correct username and password at login.

Figure 5 Network diagram

Procedure

1.     Configure the DHCP server:

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Configure IP pool 1 to assign IP addresses on the 192.168.1.0/24 subnet to clients.

[RouterA] ip pool 1

[RouterA-ip-pool-1] network 192.168.1.0 24

# Specify the URL of the script file for the clients.

[RouterA-ip-pool-1] bootfile-name http://192.168.1.40/device.py

2.     Configure the HTTP server:

# Create a configuration file named device.py on the HTTP server.

#!usr/bin/python

 

import comware

comware.CLI(‘system-view ;telnet server enable ;local-user user ;password simple abcabc ;service-type telnet ;quit ;user-interface vty 0 63 ;authentication-mode scheme ;user-role network-admin ;quit ;interface ten-gigabitethernet 3/0/1 ;port link-mode route ;ip address dhcp-alloc ;return’)

# Start HTTP service software and enable HTTP service. (Details not shown.)

Verifying the configuration

1.     Power on Router B.

2.     After Router B starts up, display assigned IP addresses on Router A.

<RouterA> display dhcp server ip-in-use

IP address       Client identifier/    Lease expiration      Type

                 Hardware address

192.168.1.2      0030-3030-632e-3239-  Dec 12 17:41:15 2013  Auto(C)

                 3035-2e36-3736-622d-

                 4574-6830-2f30-2f32

3.     Telnet to 192.168.1.2 from Router A.

<RouterA> telnet 192.168.1.2

4.     Enter username user and password abcabc as prompted. (Details not shown.)

You are logged in to Router B.

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Intelligent Storage
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
  • Technical Blogs
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网