- Table of Contents
-
- 01-Fundamentals
- 00-Preface
- 01-CLI configuration
- 02-RBAC configuration
- 03-Login management configuration
- 04-FTP and TFTP configuration
- 05-File system management configuration
- 06-Configuration file management configuration
- 07-Software upgrade configuration
- 08-Device management configuration
- 09-Tcl configuration
- 10-Python configuration
- 11-License management
- 12-Automatic configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
12-Automatic configuration | 135.92 KB |
Contents
Automatic configuration task list
Preparing the files for automatic configuration
Configuring the DHCP server when an HTTP file server is used
Configuring the DHCP server when a TFTP file server is used
Preparing the interface used for automatic configuration
Starting and completing automatic configuration
Automatic configuration examples
Automatic configuration using TFTP server
Automatic configuration using HTTP server and Tcl script
Automatic configuration using HTTP server and Python script
Using automatic configuration
Overview
With the automatic configuration feature, the device can automatically obtain a set of configuration settings when it starts up without a configuration file. This feature simplifies network configuration and maintenance.
As shown in Figure 1, automatic configuration requires the following servers:
· DHCP server.
· File server (TFTP or HTTP server).
· (Optional.) DNS server.
Figure 1 Automatic configuration network diagram
Automatic configuration task list
Tasks at a glance |
(Required.) Configuring the file server |
(Required.) Preparing the files for automatic configuration |
(Required.) Configuring the DHCP server |
(Optional.) Configuring the DNS server |
(Optional.) Configuring the gateway |
(Required.) Preparing the interface used for automatic configuration |
(Required.) Starting and completing automatic configuration |
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.
Preparing the files for automatic configuration
The device can use a script file or configuration file for automatic configuration.
· For devices to use configuration files for automatic configuration, you must create and save the configuration files to the file server as described in "Configuration files." If you do not configure the DHCP server to assign configuration file names, you must also create a host name file on the TFTP server.
· For devices to use script files for automatic configuration, you must create and save the script files to the file server as described in "Script files."
Host name file
The host name file contains host name-IP address mappings and must be named network.cfg.
All mapping entries in the host name file must use the ip host host-name ip-address format. Each mapping entry must reside on a separate line. For example:
ip host host2 101.101.101.102
ip host client1 101.101.101.103
ip host client2 101.101.101.104
Configuration files
To prepare configuration files:
· For devices that require different configurations, perform the following tasks:
? Determine the name for each device's configuration file.
The configuration file names must use the extension .cfg. For simple file name identification, use configuration file names that do not contain spaces.
? Use the file names to save the configuration files for the devices to the file server.
· For devices that share all or some configurations, save the common configurations to a .cfg file on the file server.
· If a TFTP file server is used, you can save a default configuration file named device.cfg on the server. This file contains only common configurations that devices use to start up. This file is assigned to a device only when the device does not have other configuration files to use.
During the automatic configuration process, a device first tries to obtain a configuration file dedicated for it. If no dedicated configuration file is found, the device tries to obtain the common configuration file. If no common configuration file is found when a TFTP file server is used, the device obtains and uses the default configuration file.
Script files
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."
To prepare script files:
· 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 DHCP server
The DHCP server assigns the following items to devices that need to be automatically configured:
· IP addresses.
· Paths of the configuration files or scripts.
Configuration 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 a DHCP address pool.
? Configure a static address binding.
? Specify a configuration file or script file.
Because an address pool can use only one configuration file, you can specify only one static address binding for an address pool.
· For devices for which you have prepared the same configuration file, use either of the following methods:
? Method 1:
- Create a DHCP address pool for the devices.
- Configure a static address binding for each of the devices in the address pool.
- Specify the configuration file for the devices.
? Method 2:
- Create a DHCP address 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
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enable DHCP. |
dhcp enable |
By default, DHCP is disabled. |
3. Create a DHCP address pool and enter its view. |
dhcp server ip-pool pool-name |
By default, no DHCP address pool is created. |
4. Configure the address pool. |
· (Method 1.) Specify
the primary subnet for the address pool: · (Method 2.) Configure
a static binding: |
Use either or both methods. By default, no primary subnet or static binding is configured. You can add multiple static bindings. 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 file 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
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enable DHCP. |
dhcp enable |
By default, DHCP is disabled. |
3. Create a DHCP address pool and enter its view. |
dhcp server ip-pool pool-name |
By default, no DHCP address pool is created. |
4. Configure the address pool. |
· (Method 1.) Specify
the primary subnet for the address pool: · (Method 2.) Configure
a static binding: |
Use either or both methods. By default, no primary subnet or static binding is configured. You can add multiple static bindings. 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. |
· (Method 1.) Specify the
IP address of the TFTP server: · (Method 2.) Specify the
name of the TFTP server: |
Use either or both methods. By default, no TFTP server is specified. If you specify a TFTP server by its name, a DNS server is required on the network. |
6. Specify the configuration file name. |
bootfile-name bootfile-name |
By default, no configuration file name is specified. |
Configuring the DNS server
A DNS server is required in the following situations:
· The TFTP server does not have a host name file. However, devices need to perform the following operations:
? Use their IP addresses to obtain their host names.
? Obtain configuration files named in the host name.cfg format from the TFTP server.
· The DHCP server assigns the TFTP server domain name through the DHCP reply message. Devices must use the domain name to obtain the IP address of the TFTP server.
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.
Preparing the interface used for automatic configuration
The device uses the following steps to select the 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.
Starting and completing automatic configuration
1. Power on the devices to be automatically configured.
If a device does not find a next-start configuration file locally, it starts the automatic configuration process to obtain a configuration file.
? If the device obtains a configuration file and executes the file successfully, the automatic configuration process ends.
? If one attempt fails, the device tries again until the maximum number of attempts is reached. To stop the process, press Ctrl+C or Ctrl+D.
If the device fails to obtain a configuration file, the device starts up without loading any configuration.
2. Use the save command to save the running configuration.
The device does not save the obtained configuration file locally. If you do not save the running configuration, the device must use the automatic configuration feature again after a reboot.
For more information about the save command, see Fundamentals Command Reference.
Automatic configuration examples
Automatic configuration using TFTP server
Network requirements
As shown in Figure 2, the AC does not have a configuration file.
Configure the servers so the AC can obtain a configuration file to complete the following configuration tasks:
· Enable the administrator of the AC to Telnet to and manage the AC.
· Require the administrator to enter the correct username and password at login.
Configuration procedure
1. Configure the DHCP server:
# Enable DHCP.
<RouterA> system-view
[RouterA] dhcp enable
# Configure address 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] dhcp server ip-pool 1
[RouterA-dhcp-pool-1] network 192.168.1.0 24
[RouterA-dhcp-pool-1] tftp-server ip-address 192.168.1.40
[RouterA-dhcp-pool-1] bootfile-name device.cfg
2. Configure the TFTP server:
# On the TFTP server, create the device.cfg configuration file.
#
telnet server enable
#
local-user user
password simple abcabc
service-type telnet
quit
#
user-interface vty 0 4
authentication-mode scheme
user-role network-admin
quit
#
interface gigabitethernet 1/0/1
port link-mode route
ip address dhcp-alloc
return
# Start TFTP service software. (Details not shown.)
Verifying the configuration
1. Power on the AC.
2. After the AC 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 the user username and abcabc password as prompted. (Details not shown.)
You are logged in to the AC.
Automatic configuration using HTTP server and Tcl script
Network requirements
As shown in Figure 3, the AC does not have a configuration file.
Configure the servers so the AC can obtain a Tcl script to complete the following configuration tasks:
· Enable the administrator to Telnet to the AC to manage the AC.
· Require the administrator to enter the correct username and password at login.
Configuration procedure
1. Configure the DHCP server:
# Enable DHCP.
<RouterA> system-view
[RouterA] dhcp enable
# Configure address pool 1 to assign IP addresses on the 192.168.1.0/24 subnet to clients.
[RouterA] dhcp server ip-pool 1
[RouterA-dhcp-pool-1] network 192.168.1.0 24
# Specify the URL of the script file for the AC.
[RouterA-dhcp-pool-1] bootfile-name http://192.168.1.40/device.tcl
2. Configure the HTTP server:
# Create the device.tcl configuration file on the HTTP server.
return
system-view
telnet server enable
local-user user
password simple abcabc
service-type telnet
quit
user-interface vty 0 4
authentication-mode scheme
user-role network-admin
quit
interface gigabitethernet 1/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 the AC.
2. After the AC 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 the user username and abcabc password as prompted. (Details not shown.)
You are logged in to the AC.
Automatic configuration using HTTP server and Python script
Network requirements
As shown in Figure 4, the AC does not have a configuration file.
Configure the servers so the AC can obtain a Python script to complete the following configuration tasks:
· Enable the administrator to Telnet to the AC to manage the AC.
· Require the administrator to enter the correct username and password at login.
Configuration procedure
1. Configure the DHCP server:
# Enable DHCP.
<RouterA> system-view
[RouterA] dhcp enable
# Configure address pool 1 to assign IP addresses on the subnet 192.168.1.0/24 to clients.
[RouterA] dhcp server ip-pool 1
[RouterA-dhcp-pool-1] network 192.168.1.0 24
# Specify the URL of the script file for the AC.
[RouterA-dhcp-pool-1] bootfile-name http://192.168.1.40/device.py
2. Configure the HTTP server:
# Create the device.py configuration file 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 4 ;authentication-mode scheme ;user-role network-admin ;quit ;interface gigabitethernet 1/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 the AC.
2. After the AC 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 the user username and abcabc password as prompted. (Details not shown.)
You are logged in to the AC.