- Table of Contents
-
- 01-Fundamentals Configuration Guide
- 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-Target configuration management configuration
- 09-Automatic configuration
- 10-Device management configuration
- 11-Tcl configuration
- 12-Python configuration
- 13-Management with BootWare
- Related Documents
-
Title | Size | Download |
---|---|---|
09-Automatic configuration | 155.83 KB |
Using server-based automatic configuration
About server-based automatic configuration
Server-based automatic configuration tasks at a glance
Preparing the interface used for automatic configuration
Starting and completing automatic configuration
Server-based automatic configuration examples
Example: Using a TFTP server for automatic configuration
Example: Using an HTTP server and Tcl scripts for automatic configuration
Example: Using an HTTP server and Python scripts for automatic configuration
Example: Setting up an IRF fabric
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.
The device supports only server-based automatic configuration. Server-based automatic configuration is typically used in scenarios where 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.
· File server (TFTP or HTTP server).
· (Optional.) DNS server.
Figure 1 Server-based automatic configuration network diagram
Server-based automatic configuration tasks at a glance
To configure server-based automatic configuration, perform the following tasks:
1. Configuring the file server
2. Prepare the files for automatic configuration:
¡ Preparing configuration files
3. Configuring the DHCP server
4. (Optional.) Configuring the DNS server
5. (Optional.) Configuring the gateway
6. Preparing the interface used for automatic configuration
7. 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 configuration files
Configuration file types
The device supports the configuration file types listed in Table 1.
Table 1 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 |
· TFTP server · HTTP server |
Default configuration file |
Other 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 TFTP server
If a TFTP server is used and the DHCP server does not assign configuration file names, you can configure a host name file on the TFTP server. The 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: The host name for a device must be the same as the name of the configuration file configured for the device. |
Preparing script files
About 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."
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 1.
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.
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 DHCP server
About the DHCP server
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 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
1. Enter system view.
system-view
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
4. Configure the address pool.
Choose the options to configure as needed:
¡ Specify the primary subnet for the address 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 a DHCP address pool and enter its view.
dhcp server ip-pool pool-name
4. Configure the address pool.
Choose the options to configure as needed:
¡ Specify the primary subnet for the address 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:
· 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.
· 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.
· Configure the UDP helper feature on the gateway.
This task is required if devices send requests to a TFTP server by using broadcast packets. A device uses broadcast packets to send requests to a TFTP server in the following situations:
¡ The DHCP reply does not contain the IP address or domain name of the TFTP server.
¡ The IP address or domain name of the TFTP server is invalid.
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.
Preparing the interface used for automatic configuration
The device uses the following steps to select the interface for automatic configuration:
1. Identifies the data link layer status of the management Ethernet interface. If the status is up, the device uses the management Ethernet interface.
2. Identifies the data link layer 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.
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. Save the running configuration.
save
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.
Server-based automatic configuration examples
Example: Using a TFTP server for automatic configuration
Network configuration
As shown in Figure 2, 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.
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
[RouterA-dhcp-pool-market] 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 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 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 3, 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.
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 clients.
[RouterA-dhcp-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.
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 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 4, 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.
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 clients.
[RouterA-dhcp-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 4 ;authentication-mode scheme ;user-role network-admin ;quit ;interface gigabitethernet 1/0/1 ;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: Setting up an IRF fabric
Network configuration
As shown in Figure 5, Router A and Router B do not have a configuration file.
Configure the servers so the routers can obtain a Python script to complete their respective configurations and form an IRF fabric.
Procedure
1. Assign IP addresses to the interfaces. Make sure the devices can reach each other. (Details not shown.)
2. Configure the following files on the HTTP server:
File |
Content |
Remarks |
.cfg configuration file |
Commands required for IRF setup. |
You can create a configuration file by copying and modifying the configuration file of an existing IRF fabric. |
sn.txt |
Serial numbers of the member routers. |
Each SN uniquely identifies a router. These SNs will be used for assigning a unique IRF member ID to each member router. |
(Optional.) .ipe or .bin software image file |
Software images. |
If the member routers are running different software versions, you must prepare the software image file used for software upgrade. |
.py Python script file |
Python commands that complete the following tasks: a (Optional.) Verify that the flash memory has sufficient space for the files to be downloaded. a Download the configuration file and sn.txt. b (Optional.) Download the software image file and specify it as the main startup image file. c Resolve sn.txt and assign a unique IRF member ID to each SN. d Specify the configuration file as the main next-startup configuration file. e Reboot the member routers. |
For more information about Python script configuration, see "Using Python." |
3. Configure Device A as the DHCP server:
# Enable DHCP.
<DeviceA> system-view
[DeviceA] dhcp enable
# Configure address pool 1 to assign IP addresses on the 192.168.1.0/24 subnet to clients.
[DeviceA] dhcp server ip-pool 1
[DeviceA-dhcp-pool-1] network 192.168.1.0 24
# Specify the URL of the script file for the clients.
[DeviceA-dhcp-pool-1] bootfile-name http://192.168.1.40/device.py
[DeviceA-dhcp-pool-1] quit
# Enable the DHCP server on GigabitEthernet 1/0/1.
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] dhcp select server
[DeviceA-GigabitEthernet1/0/1] quit
4. Power on Router A and Router B.
Router A and Router B will obtain the Python script file from the DHCP server and execute the script. After completing the IRF configuration, Router A and Router B reboot.
5. After Router A and Router B start up again, use a cable to connect Router A and Router B through their IRF physical ports.
Router A and Router B will elect a master member. The subordinate member will reboot to join the IRF fabric.
Verifying the configuration
# On Router A, display IRF member devices. You can also use the display irf command on Router B to display IRF member devices.
<RouterA> display irf
MemberID Slot Role Priority CPU-Mac Description
1 1 Standby 1 00e0-fc0f-8c02 ---
*+2 1 Master 30 00e0-fc0f-8c14 ---
--------------------------------------------------
* indicates the device is the master.
+ indicates the device through which the user logs in.
The Bridge MAC of the IRF is: 000c-1000-1111
Auto upgrade : yes
Mac persistent : always
Domain ID : 0
Auto merge : yes
The output shows that the routers have formed an IRF fabric.