33-H3C VSR1000虚拟路由器定时执行任务典型配置举例
本章节下载: 33-H3C VSR1000虚拟路由器定时执行任务典型配置举例 (126.24 KB)
H3C VSR1000虚拟路由器定时执行任务典型配置举例
Copyright © 2014 杭州华三通信技术有限公司 版权所有,保留一切权利。 非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部, 并不得以任何形式传播。本文档中的信息可能变动,恕不另行通知。 |
本文档介绍使用定时执行任务功能的典型配置举例。
本文档不严格与具体软件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文档假设您已了解定时执行任务功能特性。
如图1所示,路由器Router连接两台主机,现要求:对Router配置定时执行任务功能,使得在星期一到星期五的上午八点到下午十八点开启GigabitEthernet1/0和GigabitEthernet2/0,其它时间关闭端口。
本举例是在E0301版本上进行配置和验证的。
· 通过command指定的命令行必须是设备上可成功执行的命令行;否则,命令行不能自动被执行。
· 通过command指定的命令行不能包括telnet、ftp、ssh2和monitor process命令。
· 在配置定时任务前,需查看系统时间是否正确。如果系统时间不正确的话,可以通过配置NTP功能或者clock命令进行修改,保证设备获得准确的时间。
(1) 配置关闭和开启接口的工作任务
# 创建名称为shutdown-GigabitEthernet1/0的工作任务并进入Job视图。
[Router] scheduler job shutdown-GigabitEthernet1/0
# 为Job分配命令,以进入系统视图。
[Router-job-shutdown-GigabitEthernet1/0] command 1 system-view
# 为Job分配命令,以进入GigabitEthernet1/0接口视图。
[Router-job-shutdown-GigabitEthernet1/0] command 2 interface gigabitethernet 1/0
# 为Job分配命令,以执行关闭GigabitEthernet1/0接口。
[Router-job-shutdown-GigabitEthernet1/0] command 3 shutdown
[Router-job-shutdown-GigabitEthernet1/0] quit
# 创建名称为shutdown-GigabitEthernet2/0的工作任务并进入Job视图。
[Router] scheduler job shutdown-GigabitEthernet2/0
# 为Job分配命令,以进入系统视图。
[Router-job-shutdown-GigabitEthernet2/0] command 1 system-view
# 为Job分配命令,以进入GigabitEthernet2/0接口视图。
[Router-job-shutdown-GigabitEthernet2/0] command 2 interface gigabitethernet 2/0
# 为Job分配命令,以执行关闭GigabitEthernet2/0接口。
[Router-job-shutdown-GigabitEthernet2/0] command 3 shutdown
[Router-job-shutdown-GigabitEthernet2/0] quit
# 创建名称为start-GigabitEthernet1/0的工作任务并进入Job视图。
[Router] scheduler job start-GigabitEthernet1/0
# 为Job分配命令,以进入系统视图。
[Router-job-start-GigabitEthernet1/0] command 1 system-view
# 为Job分配命令,以进入GigabitEthernet1/0接口视图。
[Router-job-start-GigabitEthernet1/0] command 2 interface gigabitethernet 1/0
# 为Job分配命令,以执行开启GigabitEthernet1/0接口。
[Router-job-start-GigabitEthernet1/0] command 3 undo shutdown
[Router-job-start-GigabitEthernet1/0] quit
# 创建名称为start-GigabitEthernet2/0的工作任务并进入Job视图。
[Router] scheduler job start-GigabitEthernet2/0
# 为Job分配命令,以进入系统视图。
[Router-job-start-GigabitEthernet2/0] command 1 system-view
# 为Job分配命令,以进入GigabitEthernet2/0接口视图。
[Router-job-start-GigabitEthernet2/0] command 2 interface gigabitethernet 2/0
# 为Job分配命令,以执行开启GigabitEthernet2/0接口。
[Router-job-start-GigabitEthernet2/0] command 3 undo shutdown
[Router-job-start-GigabitEthernet2/0] quit
(2) 配置定时执行任务
# 创建名为connect-host1/host2的Schedule,并进入Schedule视图。
[Router] scheduler schedule connect-host1/host2
# 为Schedule分配名为start-GigabitEthernet1/0的job。
[Router-schedule-connect-host1/host2] job start-GigabitEthernet1/0
# 为Schedule分配名为start-GigabitEthernet2/0的job。
[Router-schedule-connect-host1/host2] job start-GigabitEthernet2/0
# 为Schedule配置循环执行的时间,在星期一到星期五的上午8点开启GigabitEthernet1/0和GigabitEthernet2/0接口。
[Router-schedule-connect-host1/host2] time repeating at 08:00 week-day Mon Tue Wed Thu Fri
[Router-schedule-connect-host1/host2] quit
# 创建名为unconnect-host1/host2的Schedule,并进入Schedule视图。
[Router] scheduler schedule unconnect-host1/host2
# 为Schedule分配名为shutdown-GigabitEthernet1/0的job。
[Router-schedule-unconnect-host1/host2] job shutdown-GigabitEthernet1/0
# 为Schedule分配名为shutdown-GigabitEthernet2/0的job。
[Router-schedule-unconnect-host1/host2] job shutdown-GigabitEthernet2/0
# 为Schedule配置循环执行的时间,在星期一到星期五的下午18点关闭GigabitEthernet1/0和GigabitEthernet2/0接口。
[Router-schedule-unconnect-host1/host2] time repeating at 18:00 week-day Mon Tue Wed Thu Fri
[Router-schedule-unconnect-host1/host2] quit
# 使用display scheduler job命令显示Job的配置信息。
<Router> display scheduler job
Job name: shutdown-GigabitEthernet1/0
system-view
interface gigabitethernet1/0
shutdown
Job name: shutdown-GigabitEthernet2/0
system-view
interface gigabitethernet2/0
shutdown
Job name: start-GigabitEthernet1/0
system-view
interface gigabitethernet1/0
undo shutdown
Job name: start-GigabitEthernet2/0
system-view
interface gigabitethernet2/0
undo shutdown
# 使用display scheduler schedule命令显示定时任务的运行信息。
<Router> display scheduler schedule
Schedule name : connect-host1/host2
Schedule type : Run on every Mon Tue Wed Thu Fri at 08:00:00
Start time : Thu Nov 14 08:00:00 2013
Last execution time : Yet to be executed
-----------------------------------------------------------------------
Job name Last execution status
start-GigabitEthernet1/0 -NA-
start-GigabitEthernet2/0 -NA-
Schedule name : unconnect-host1/host2
Schedule type : Run on every Mon Tue Wed Thu Fri at 18:00:00
Start time : Wed Nov 13 18:00:00 2013
Last execution time : Yet to be executed
-----------------------------------------------------------------------
Job name Last execution status
shutdown-GigabitEthernet1/0 -NA-
shutdown-GigabitEthernet2/0 -NA-
# 在上午7:59时,使用display ip interface brief命令查看三层接口状态。
[Router] display ip interface brief
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE1/0 *down down -- --
GE2/0 *down down -- --
GE3/0 up up 192.168.100.67 --
# 当到上午8:00时候,设备有如下日志信息显示。
%Apr 22 08:00:10:245 2014 Router IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet1/0 changed to up.
%Apr 22 08:00:10:245 2014 Router IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0 changed to up.
%Apr 22 08:00:10:250 2014 Router IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet2/0 changed to up.
%Apr 22 08:00:10:250 2014 Router IFNET/5/LINK_UPDOWN: Line protocol state on the
interface GigabitEthernet2/0 changed to up.
# 在上午8:00时,使用display ip interface brief命令查看三层接口状态。
[Router] display ip interface brief
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE1/0 up up -- --
GE2/0 up up -- --
GE3/0 up up 192.168.100.67 --
# 当到下午18:00时候,设备有如下日志信息显示。
%Apr 22 18:00:06:250 2014 Router IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet1/0 changed to down.
%Apr 22 18:00:06:250 2014 Router IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0 changed to down.
%Apr 22 18:00:06:256 2014 Router IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet2/0 changed to down.
%Apr 22 18:00:06:256 2014 Router IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet2/0 changed to down.
# 在下午18:00时,使用display ip interface brief命令查看三层接口状态。
[Router] display ip interface brief
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE1/0 *down down -- --
GE2/0 *down down -- --
GE3/0 up up 192.168.100.67 --
#
scheduler job shutdown-GigabitEthernet1/0
command 1 system-view
command 2 interface gigabitethernet1/0
command 3 shutdown
#
scheduler job shutdown-GigabitEthernet2/0
command 1 system-view
command 2 interface gigabitethernet2/0
command 3 shutdown
#
scheduler job start-GigabitEthernet1/0
command 1 system-view
command 2 interface gigabitethernet1/0
command 3 undo shutdown
#
scheduler job start-GigabitEthernet2/0
command 1 system-view
command 2 interface gigabitethernet2/0
command 3 undo shutdown
#
scheduler schedule connect-host1/host2
job start-GigabitEthernet1/0
job start-GigabitEthernet2/0
time repeating at 08:00 week-day Mon Tue Wed Thu Fri
#
scheduler schedule unconnect-host1/host2
job shutdown-GigabitEthernet1/0
job shutdown-GigabitEthernet2/0
time repeating at 18:00 week-day Mon Tue Wed Thu Fri
#
· 《H3C VSR1000虚拟路由器配置指导》中的“基础配置指导”
· 《H3C VSR1000虚拟路由器命令参考》中的“基础配置命令参考”
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!