思科运营商级别设备系统 IOS XR系统管理
在本小节中,我们将重点学习IOS XR如何保存、回滚配置、清除配置等常用的文件系统管理,这些内容都是在今后的日常使用中非常实用的命令
1.3.1 保存配置和加载配置
IOS XR系统不同于传统IOS系统,在配置完毕之后,这些内容并不会立即执行,只有在输入commit(提交)命令后,才会生效,这称之为二级提交模式。
变更的部分称之为target config。在提交之前可以检查、修改配置,方便添加标签用于运维,支持回退特性,配置校验用户配置错误等实用命令。我们在如下的几个实施中来为大家演示IOS XR的强大之处
1.清空现有路由器上的配置:
RP/0/0/CPU0:asbr2-INIT(config)#commit replace //本设备上已经存在某些配置,该命令可以在不重启设备的情况下清除配置
Wed Sep 7 15:13:54.286 UTC
This commit will replace or remove the entire running configuration. This
operation can be service affecting.
Do you wish to proceed? [no]: y //键入Y用以确认,默认是不处理
RP/0/0/CPU0:Sep 7 15:13:59.185 : ospfv3[1024]: %ROUTING-OSPFv3-5-ADJCHG : Process 110, Nbr 11.1.1.1 on GigabitEthernet0/0/0/2 from FULL to DOWN, Neighbor Down: Interface down or detached
RP/0/0/CPU0:Sep 7 15:13:59.185 : ospfv3[1024]: %ROUTING-OSPFv3-5-ADJCHG : Process 110, Nbr 33.1.1.1 on GigabitEthernet0/0/0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
RP/0/0/CPU0:Sep 7 15:13:59.245 : isis[1006]: %ROUTING-ISIS-5-ADJCHANGE : Adjacency to PE-XR1 (GigabitEthernet0/0/0/2) (L1) Down, Interface state down
RP/0/0/CPU0:Sep 7 15:13:59.245 : isis[1006]: %ROUTING-ISIS-5-ADJCHANGE : Adjacency to PE-XR1 (GigabitEthernet0/0/0/2) (L2) Down, Interface state down
RP/0/0/CPU0:Sep 7 15:13:59.265 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/7, changed state to Down
RP/0/0/CPU0:Sep 7 15:13:59.265 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/6, changed state to Down
RP/0/0/CPU0:Sep 7 15:13:59.265 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/5, changed state to Down
RP/0/0/CPU0:ios(config)#RP/0/0/CPU0:Sep 7 15:13:59.265 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/4, changed state to Down
RP/0/0/CPU0:Sep 7 15:13:59.265 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/3, changed state to Down
RP/0/0/CPU0:Sep 7 15:13:59.265 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/1, changed state to Down
RP/0/0/CPU0:Sep 7 15:13:59.265 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface MgmtEth0/0/CPU0/0, changed state to Down
RP/0/0/CPU0:Sep 7 15:13:59.325 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/7, changed state to Up
RP/0/0/CPU0:Sep 7 15:13:59.325 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface MgmtEth0/0/CPU0/0, changed state to Up
RP/0/0/CPU0:Sep 7 15:13:59.325 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/6, changed state to Up
RP/0/0/CPU0:Sep 7 15:13:59.335 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/5, changed state to Up
RP/0/0/CPU0:Sep 7 15:13:59.335 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/4, changed state to Up
RP/0/0/CPU0:Sep 7 15:13:59.335 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/3, changed state to Up
RP/0/0/CPU0:ios(config)# //设备已经初始化,读者可以看到名字都变为了初始化内容
- 提交配置、查看特定的配置变更
RP/0/0/CPU0:ios#conf t //进入配置模式
Wed Sep 7 15:17:54.019 UTC
RP/0/0/CPU0:ios(config)#hostname QYT-Ender //通过修改主机名的简单命令测试
RP/0/0/CPU0:ios(config)#show configuration //正如前边提到的,XR系统在配置完毕命令之后并不立即生效,读者可以看到主机名还是初始化的名字,我们可以通过配置模式下的show configuration查看已经配置但未提交的命令
Wed Sep 7 15:18:03.728 UTC
Building configuration...
!! IOS XR Configuration 5.2.0
hostname QYT-Ender
end
RP/0/0/CPU0:ios(config)#commit //正式提交
Wed Sep 7 15:18:14.608 UTC
RP/0/0/CPU0:Sep 7 15:18:14.658 : ike[227]: %SECURITY-IKE-4-WARNING : You may want to configure a domain-name
IOS XR还可以查看曾经配置过的命令清单,如下所示
RP/0/0/CPU0:QYT-Ender#show configuration commit list
Wed Sep 7 15:22:57.438 UTC
SNo. Label/ID User Line Client Time Stamp~~ ~~ ~~ ~~ ~~ ~~
1 1000000027 cisco con0_0_CPU0 CLI Wed Sep 7 15:18:14 2016
2 1000000026 cisco con0_0_CPU0 CLI Wed Sep 7 15:13:59 2016
查看提交配置改变的内容,可以方便的查看哪些配置引发了错误
RP/0/0/CPU0:QYT-Ender#show configuration commit changes last 1
Wed Sep 7 15:23:52.265 UTC
Building configuration...
!! IOS XR Configuration 5.2.0
hostname QYT-Ender
end
正因为XR可以保存每一次修改的配置,那么XR也可以轻松的回滚到某次配置,这在工程师的割接中是一个“血好”的功能了
RP/0/0/CPU0:QYT-Ender#rollback configuration to INIT //在特权模式回滚配置到名为INIT的一个命名完毕的“标签”,该标签其实是对某次配置的命名,方便工程师辨别,我们将在下面的内容讲解如何给配置打上“标签”
Wed Sep 7 15:28:16.856 UTC
Loading Rollback Changes.
Loaded Rollback Changes in 1 sec
Committing.....RP/0/0/CPU0:Sep 7 15:28:22.306 : ike[227]: %SECURITY-IKE-4-WARNING : You may want to configure a domain-name
RP/0/0/CPU0:Sep 7 15:28:22.346 : ifmgr[225]: %PKT_INFRA-LINK-5-CHANGED : Interface MgmtEth0/0/CPU0/0, changed state to Administratively Down
RP/0/0/CPU0:Sep 7 15:28:22.346 : ifmgr[225]: %PKT_INFRA-LINK-5-CHANGED : Interface GigabitEthernet0/0/0/1, changed state to Administratively Down
RP/0/0/CPU0:Sep 7 15:28:22.346 : ifmgr[225]: %PKT_INFRA-LINK-5-CHANGED : Interface GigabitEthernet0/0/0/3, changed state to Administratively Down
RP/0/0/CPU0:Sep 7 15:28:22.346 : ifmgr[225]: %PKT_INFRA-LINK-5-CHANGED : Interface GigabitEthernet0/0/0/4, changed state to Administratively Down
RP/0/0/CPU0:Sep 7 15:28:22.346 : ifmgr[225]: %PKT_INFRA-LINK-5-CHANGED : Interface GigabitEthernet0/0/0/5, changed state to Administratively Down
RP/0/0/CPU0:Sep 7 15:28:22.346 : ifmgr[225]: %PKT_INFRA-LINK-5-CHANGED : Interface GigabitEthernet0/0/0/6, changed state to Administratively Down
RP/0/0/CPU0:Sep 7 15:28:22.346 : ifmgr[225]: %PKTINFRA-LINK-5-CHANGED : Interface GigabitEthernet0/0/0/7, changed state to Administratively Down
RP/0/0/CPU0:Sep 7 15:28:22.346 : SSHD[1121]: %SECURITY-MPP-6-MSG_INFO : Updated Management Plane configuration for service: ssh
RP/0/0/CPU0:Sep 7 15:28:22.446 : isis[1006]: %ROUTING-ISIS-5-ADJCHANGE : Adjacency to 49.0123.0000.0000.1111 (GigabitEthernet0/0/0/2) (L1) Up, New adjacency
73 items committed in 5 sec (14)items/sec
Updating.RP/0/0/CPU0:Sep 7 15:28:22.536 : isis[1006]: %ROUTING-ISIS-5-ADJCHANGE : Adjacency to 49.0123.0000.0000.1111 (GigabitEthernet0/0/0/2) (L2) Up, New adjacency
RP/0/0/CPU0:Sep 7 15:28:23.286 : config_rollback[65730]: %MGBL-CONFIG-6-DB_COMMIT : Configuration committed by user 'cisco'. Use 'show configuration commit changes 1000000028' to view the changes.
Updated Commit database in 1 sec
Configuration successfully rolled back to 'INIT'. //成功的回滚了配置
1.3.2 提交配置标签和查看失败的提交
对配置提交标签的功能非常实用,如果工程师某次配置没有成功,那么可以提交为标签,下次实施继续实用,如下命令提交了一个名为INIT的标签
RP/0/0/CPU0:ASBR-2(config)#hostname asbr2-INIT
RP/0/0/CPU0:ASBR-2(config)#commit label INIT
RP/0/0/CPU0:ASBR-2#show configuration commit list
Wed Sep 7 15:34:09.252 UTC
SNo. Label/ID User Line Client Time Stamp~~ ~~ ~~ ~~ ~~ ~~
1 1000000028 cisco con0_0_CPU0 Rollback Wed Sep 7 15:28:17 2016
2 1000000027 cisco con0_0_CPU0 CLI Wed Sep 7 15:18:14 2016
3 1000000026 cisco con0_0_CPU0 CLI Wed Sep 7 15:13:59 2016
4 INIT cisco con0_0_CPU0 CLI Wed Sep 7 15:13:09 2016
5 1000000024 cisco con0_0_CPU0 CLI Sat Aug 27 15:12:59 2016
XR的配置是基于层次化的,这一点读者在后续内容将会深刻的体会到,这因为如此,因为逻辑原因或者顺序原因,出现错误在所难免,XR可以快速的使用命令来定位错误。如果由于配置过多而无法快速的修改配置,读者可以用clear命令去掉当前配置,当然读者也可以采用abort命令完全放弃配置。如下所示:
RP/0/0/CPU0:ASBR-2(config)#show configuration failed //请注意直接在配置模式实施
Wed Sep 7 15:36:07.784 UTC
% No such configuration item(s) //暂时没有配置错误
RP/0/0/CPU0:Test(config)#int lo0 //试图配置环回口
RP/0/0/CPU0:Test(config-if)#show configuration //验证未提交的配置
Thu Nov 19 10:20:39.821 UTC
Building configuration...
!! IOS XR Configuration 5.2.0
interface Loopback0
!
end
RP/0/0/CPU0:Test(config-if)#clear //清除当前的实施
RP/0/0/CPU0:Test(config)#show configuration
Thu Nov 19 10:21:16.648 UTC
Building configuration...
!! IOS XR Configuration 5.2.0
end
1.3.3命令进行注解和提交确认选项
XR中虽然依旧使用了管道符,即|来查看实施以及验证重要内容,但这些内容在边缘化,因为XR提供了带导航功能的验证方式,读者可以直接加查看的协议、接口等,如下所示
RP/0/0/CPU0:ASBR-2#show running-config interface //直接查看接口的实施,读者可以慢慢摸索可以直接精确的查看配置的选项
Wed Sep 7 15:44:02.462 UTC
interface Loopback0
ipv4 address 22.1.1.1 255.255.255.255
ipv6 address 2022::2/128
!
interface MgmtEth0/0/CPU0/0
shutdown
!
interface GigabitEthernet0/0/0/0
ipv4 address 23.1.1.2 255.255.255.0
ipv6 address 2023::2/64
RP/0/0/CPU0:ASBR-2#show running-config control-plane
Wed Sep 7 15:44:50.838 UTC
control-plane
management-plane
inband
interface GigabitEthernet0/0/0/0
如果工程师已经明确了本次实施的内容,还可以为本次实施提交注解,方便后续工程师识别配置以及排错,如下所示:
RP/0/0/CPU0:QYT-R2(config)#!This is MPLS Changes //对新增的命令进行注解
RP/0/0/CPU0:QYT-R2(config)#mpls ldp
RP/0/0/CPU0:QYT-R2(config-ldp)#exi
RP/0/0/CPU0:QYT-R2(config)#commi
Thu Aug 18 13:22:58.033 UTC
RP/0/0/CPU0:QYT-R2(config)#do sh run mpls ldp
!This is MPLS Changes
mpls ldp
!
在XR上在提交的时候还提供了“确认”功能,即实验性的提交,添加一个回退计时器,超时之后系统配置自动回退到提交前的状态,如下所示:
RP/0/0/CPU0:Test(config)#int g0/0/0/1
RP/0/0/CPU0:Test(config-if)#shut
RP/0/0/CPU0:Test(config-if)#commit confirmed 30---30s之后自动回滚到之前状态,即接口会自动开启
sh run int g0/0/0/1
interface GigabitEthernet0/0/0/1
ipv4 address 13.1.1.1 255.255.255.0
shutdown
RP/0/0/CPU0:Nov 19 09:43:19.754 : ifmgr[225]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/0/0/1, changed state to Up //读者可以看到该接口在30s后自动开启,该方式可以大大的提高配置的容错性
1.3.3 快速定位配置位置以及快速退出到全局特权模式
XR是具备层次化配置的系统,有时会进入非常深层次的配置,此时读者需要用到pwd来快速定位配置位置。如果读者需要快速退出到全局配置模式可以键入命令root,如下所示:
RP/0/0/CPU0:ASBR-2(config)#router bgp 1
RP/0/0/CPU0:ASBR-2(config-bgp)#address-family ipv4 unicast
RP/0/0/CPU0:ASBR-2(config-bgp-af)#exit
RP/0/0/CPU0:ASBR-2(config-bgp)#neighbor 1.1.1.1
RP/0/0/CPU0:ASBR-2(config-bgp-nbr)#address-family ipv4 unicast
RP/0/0/CPU0:ASBR-2(config-bgp-nbr-af)#pwd //快读定位实施位置,方便理清思路
Wed Sep 7 16:10:42.992 UTC
router bgp 1
neighbor 1.1.1.1
address-family ipv4 unicast
RP/0/0/CPU0:ASBR-2(config-bgp-nbr-af)#root //快速退出到全局配置模式
RP/0/0/CPU0:ASBR-2(config)
到此本部分内容解析,敬请期待后续内容