第一种方法 直接设置后确认:
huxiaoming@huxiaoming# run show configuration | display set | no-more
set version 8.5R1.14
set system host-name huxiaoming 只拿这个做例子
huxiaoming@huxiaoming# set system host-name juncie-lab 通过set命令直接修改
[edit]
huxiaoming@huxiaoming# commit check
configuration check succeeds
[edit]
huxiaoming@huxiaoming# commit
[edit]
huxiaoming@juncie-lab# 可以看出已经生效发生了变化
第二种方法 复制粘贴:
huxiaoming@juncie-lab# run show configuration | no-more
## Last commit: 2010-04-19 23:35:09 UTC by huxiaoming
version 8.5R1.14;
system {
host-name ccie16689;
domain-name ciscolang.com;
backup-router 192.168.1.1;
root-authentication {
encrypted-password "$1$i0u9jbAk$dPNFboFtyKKmxvDNs64bZ0"; ## SECRET-DATA
}
[1] [2] 下一页
我们可以看到hostname位于system {的层次下
huxiaoming@juncie-lab# load merge terminal 我在这个模式下粘贴命令,
[Type ^D at a new line to end input]
system {
host-name ccie16689;
domain-name ciscolang.com;
backup-router 192.168.1.1;
root-authentication {
encrypted-password "$1$i0u9jbAk$dPNFboFtyKKmxvDNs64bZ0"; ## SECRET-DATA
}
terminal:7:(0) syntax error
[edit system]
''
syntax error 可以看到有层次上的错误
load complete (1 errors)
[edit]
[edit system]
huxiaoming@juncie-lab# load merge terminal
[Type ^D at a new line to end input]
system {
host-name ccie16689;
domain-name ciscolang.com;
backup-router 192.168.1.1;
root-authentication {
encrypted-password "$1$i0u9jbAk$dPNFboFtyKKmxvDNs64bZ0"; ## SECRET-DATA
}
}注意这里,有点像html 语言的<>和</>一定要前后有头有尾巴
load complete
[edit system]
huxiaoming@juncie-lab# commit
commit complete
[edit system]
huxiaoming@ccie16689#
第三种方法:命名配置,载入生效
huxiaoming@ccie16689# set host-name huxiaoming
[edit system]
huxiaoming@ccie16689# show | compare 这个命令可以对比配置变化
[edit system]
- host-name ccie16689;
+ host-name