华为交换机配置的导出和导入

本文是记录如何导入导出华为交换机的配置文件的技术文章。

导出配置文件

设备作为FTP服务器,用户PC作为FTP客户端

配置设备的FTP功能及FTP用户信息。

<HUAWEI> system-view
[HUAWEI] ftp server enable
[HUAWEI] sysname Paul //设置主机名成为Paul
[HUAWEI] paul
[HUAWEI-paul] local-user wenglei password irreversible-cipher wl@163
[HUAWEI-paul] local-user wenglei privilege level 15
[HUAWEI-paul] local-user wenglei service-type ftp
[HUAWEI-paul] local-user wenglei ftp-directory cfcard:/  //这里注意是你交换机当前目录dir
[HUAWEI-paul] quit
[HUAWEI] quit
//保存设备当前配置。
<HUAWEI> save

PC端通过FTP连接设备

从终端PC通过FTP连接设备,输入用户名wenglei和密码wl@163,并采用binary模式进行文件传输。
终端以Window10操作系统为例说明。

C:\Documents and Settings\Administrator> ftp 10.136.23.5
Connected to 10.136.23.5.
220 FTP service ready.
User (10.136.23.5:(none)): wenglei
331 Password required for wenglei.
Password: wl@163
230 User logged in.
ftp> binary
200 Type set to I.
ftp>

导出配置文件。

ftp> get vrpcfg.zip
200 Port command okay.
150 Opening BINARY mode data connection for vrpcfg.zip.
226 Transfer complete.
ftp: 收到 1257 字节,用时 0.0340.55千字节/秒。

设置恢复的配置文件为下次启动配置文件并重启设备
C:\Users\Administrator>这是备份的配置文件的默认路径
至此备份成功

导入配置文件

设备作为FTP服务器,本地PC作为FTP客户端,将备份的配置文件上传到设备中

配置设备的FTP服务器功能及FTP用户信息。

<HUAWEI> system-view
[HUAWEI] ftp server enable
[HUAWEI] paul
[HUAWEI-paul] local-user wenglei password irreversible-cipher wl@163
[HUAWEI-paul] local-user wenglei privilege level 15
[HUAWEI-paul] local-user wenglei service-type ftp
[HUAWEI-paul] local-user wenglei ftp-directory cfcard:/
[HUAWEI-paul] quit
[HUAWEI] quit

PC端通过FTP连接设备

从终端PC通过FTP连接设备,输入用户名wenglei和密码wl@163,并采用binary模式进行文件传输。
终端以Window10操作系统为例说明。

C:\> ftp 10.136.23.5
Connected to 10.136.23.5.
220 FTP service ready.
User (10.136.23.5:(none)): wenglei
331 Password required for wenglei.
Password: wl@163
230 User logged in.
ftp> binary
200 Type set to I.
ftp>

上传配置文件到设备中。

ftp> put vrpcfg.zip
200 Port command okay.
150 Opening BINARY mode data connection for vrpcfg.zip.
226 Transfer complete.
ftp: 发送 1257 字节,用时 0.0340.55千字节/秒。

至此上传配置文件成功了
dir命令查看是否上传成功了

设置恢复的配置文件为下次启动配置文件并重启设备

<HUAWEI> startup saved-configuration config.cfg
<HUAWEI> display startup
MainBoard:
  Configured startup system software:        cfcard:/device_software.cc
  Startup system software:                   cfcard:/device_software.cc
  Next startup system software:              cfcard:/device_software.cc
  Startup saved-configuration file:          cfcard:/config_old.cfg   //设备当前的配置文件名。
  Next startup saved-configuration file:     cfcard:/config.cfg   //下次启动的配置文件名。
  Startup paf file:                          default
  Next startup paf file:                     default
  Startup license file:                      default
  Next startup license file:                 default
  Startup patch package:                     NULL
  Next startup patch package:                NULL
<HUAWEI> reboot   //重启设备。
Info: The system is now comparing the configuration, please wait.
Warning: The configuration has been modified, and it will be saved to the next startup saved-configuration file cfcard:/config.cfg. Continue? [Y/N]:N
//输入N防止设备当前的配置保存到备份的配置文件中。
Now saving the current configuration to the slot 13.
Save the configuration successfully.
Info: If want to reboot with saving diagnostic information, input 'N' and then execute 'reboot save diagnostic-information'.
System will reboot! Continue?[Y/N]:Y   //输入Y重启设备。
### 如何在华为交换机配置IP地址 #### 配置VLAN接口的IP地址 为了使华为交换机能作为网关工作,需要为其定义一个三层接口并分配相应的IP地址。以下是具体的操作方法: 1. **进入系统视图** 使用`system-view`命令切换至系统视图。 2. **创建或进入VLAN接口视图** 假设目标是为VLAN 10配置IP地址,则需执行以下命令: ```shell vlan 10 ``` 3. **启用VLAN接口** VLAN接口默认可能处于关闭状态,因此需要手动开启该接口。 ```shell interface Vlanif 10 undo shutdown ``` 4. **配置IP地址** 设置指定的IP地址及其子网掩码。例如,将VLAN 10的管理IP设置为`119.167.206.129/25`。 ```shell ip address 119.167.206.129 255.255.255.128 ``` 此操作完成后,VLAN 10即拥有了对应的三层路由功能[^1]。 #### 验证配置 完成上述步骤后,可以通过以下命令验证配置是否成功: ```shell display ip routing-table ``` 此命令可以查看当前交换机上的路由表信息,确认新配置的IP地址已生效。 --- #### 密码安全注意事项 如果尚未设置登录密码,在实际环境中建议立即加强安全性。可通过如下方式设定Console口访问密码: ```shell user-interface console 0 authentication-mode password set authentication password cipher your_password_here ``` 其中`your_password_here`应替换为你希望使用的强密码[^4]。 --- #### 自动化批量导入配置 对于多台相同型号的华为S系列交换机(如S5700),可采用FTP导出已有设备的配置文件`vrpcfg.txt`,修改后再利用超级终端或其他工具上传至其他设备实现快速部署[^3]。 --- #### 总结 以上流程涵盖了从基础到高级层面关于如何在华为交换机配置IP地址的方法论,并强调了必要的安全管理措施以保障网络环境稳定运行。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

彖爻之辞

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值