Administrator
Administrator
发布于 2025-04-14 / 44 阅读
0
0

常用配置

telnet /SSH/console

HuaWei

ssh

[HUAWEI] user-interface vty 0 4  

​  

[HUAWEI-ui-vty0-4] authentication-mode aaa //配置VTY用户界面认证方式为AAA认证  

​  

[HUAWEI-ui-vty0-4] protocol inbound ssh //配置VTY用户界面支持的协议为SSH,默认情况下即SSH  

​  

[HUAWEI-ui-vty0-4] user privilege level 15 //配置VTY用户界面的级别为15  

​  

[HUAWEI-ui-vty0-4] quit  

​  

[HUAWEI] ssh server-source -i Vlanif 10 //假设客户端使用IP地址10.10.10.20连接服务器,该地址对应的接口为Vlanif 10。该命令仅在V200R020C00及之后版本使用  

。  

[HUAWEI] stelnet server enable //使能设备的STelnet服务器功能  

​  

[HUAWEI] ssh user admin123 //创建SSH用户admin123  

​  

[HUAWEI] ssh user admin123 service-type stelnet //配置SSH用户的服务方式为STelnet  

​  

[HUAWEI] ssh user admin123 authentication-type password //配置SSH用户认证方式为password,默认就是密码验证  

​  

[HUAWEI] aaa  

​  

[HUAWEI-aaa] local-user admin123 password irreversible-cipher YsHsjx_202206 //创建与SSH用户同名的本地用户和对应的登录密码  

​  

[HUAWEI-aaa] local-user admin123 privilege level 15 //配置本地用户级别为15  

​  

Warning: This operation may affect online users, are you sure to change the user privilege level ?[Y/N]y  

​  

[HUAWEI-aaa] local-user admin123 service-type ssh //配置本地用户的服务方式为SSH  

​  

[HUAWEI-aaa] quit  

​  

[HUAWEI] ecc local-key-pair create  

Info: The key name will be: HUAWEI_Host_ECC.  

Info: The key modulus can be any one of the following: 256, 384, 521.  

Info: If the key modulus is greater than 512, it may take a few minutes.  

Please input the modulus [default=521]:521  

Info: Generating keys..........  

Info: Succeeded in creating the ECC host keys.

- 执行**display ssh user-information** [ username ]命令,在SSH服务器端查看SSH用户信息。如果不指定SSH用户,则可以查看SSH服务器端所有的SSH用户信息。

    

- 执行**display ssh server** status命令,查看SSH服务器的全局配置信息。

    

- 执行[**display ssh server**](https://support.huawei.com/hedex/api/pages/EDOC1100333028/AZM1017P/03/resources/dc/cmdqueryname=display+ssh+server) session命令,在SSH服务器端查看与SSH客户端连接的会话信息。

telnet

telnet

<HUAWEI> system-view  

[HUAWEI] telnet server-source -i Vlanif 10 //假设客户端使用IP地址10.10.10.20连接服务器,该地址对应的接口为Vlanif 10。该命令仅在V200R020C00及之后版本使用。  

[HUAWEI] telnet server enable  

[HUAWEI] user-interface vty 0 4  

[HUAWEI-ui-vty0-4] protocol inbound telnet //指定VTY用户界面所支持的协议为Telnet  

[HUAWEI-ui-vty0-4] authentication-mode aaa //配置认证方式为AAA  

[HUAWEI-ui-vty0-4] quit  

[HUAWEI] aaa  

[HUAWEI-aaa] local-user admin123 password irreversible-cipher abcd@123 //创建本地用户admin123,登录密码为abcd@123  

[HUAWEI-aaa] local-user admin123 service-type telnet //配置本地用户admin123的接入类型为Telnet方式  

[HUAWEI-aaa] local-user admin123 privilege level 15 //配置本地用户admin123的级别为15  

Warning: This operation may affect online users, are you sure to change the user privilege level ?[Y/N]y

H3C

ssh

[H3C]ssh server enable   ##开启ssh

[H3C]ssh user "admin" service-type stelnet authentication-type password ## 指定验证方式  

[H3C]telnet server enable   ##开启telnet

[H3C]local-user "admin" class manage ##创建用户名为admin

[H3C-luser-manage-admin]password simple "abc1234567"     ##配置密码

[H3C-luser-manage-admin]authorization-attribute user-role level-15 ##配置账号等级

[H3C-luser-manage-admin]service-type telnet http https ssh terminal   ##配置服务类型

[H3C-luser-manage-admin]authorization-attribute user-role network-operator   ##自动生成 赋予权限

[H3C]line vtv 0 4               ##进入虚拟终端视图此命令和user-interface vty一致 只不过是为了兼容

[H3C-line-vty0-4]authentication-mode scheme   ##认证为AAA

[H3C-line-vty0-4]user-role level-15           ##设置登录用户的权限为最高15

[H3C-line-vty0-4]user-role network-operator   ##自动生成

[H3C-line-vty0-4]protocol inbound all         ##表示这个认证个给telnet 和ssh使用

[H3C]line console 0

[H3C-line-console0]authentication-mode scheme   ##认证为AAA

#### 配置访问控制

acl advanced 3000

rule 0 permit ip source 192.168.0.0 0.0.0.255   //允许

ssh server acl "number" //配置acl

telnet server acl

迈普

ssh\telnet

ip ssh server              

local-user maipu class manager

service-type telnet ssh

privilege 15

password 0 user@123

exit

domain system

aaa authentication login local

exit

line vty 0 4

login aaa

exit

#### 配置访问控制

configure terminal

line vty 0 4

access-class "acl numer" in | out

锐捷

ssh/telnet

Ruijie#configure terminal       ##进入特权模式

​

Ruijie(config)#enable service ssh-server   ##开启ssh服务

​

Ruijie(config)#crypto key generate dsa           ##加密方式有两种:DSA和RSA,可以随意选择

Choose the size of the key modulus in the range of 360 to 2048 for your

Signature Keys. Choosing a key modulus greater than 512 may take

a few minutes.

How many bits in the modulus [512]:             ##直接敲回车

% Generating 512 bit DSA keys ...[ok]

​

Ruijie(config)#line vty 0 4         ##进入SSH密码配置模式,0 4表示允许共5个用户同时SSH登入到交换机

​

Ruijie(config-line)#login             ##启用需输入密码才能SSH成功

​

Ruijie(config-line)#password ruijie     ##将SSH密码设置为ruijie

​

Ruijie(config-line)#exit               ## 回到全局配置模式

​

Ruijie(config)#enable password ruijie           ## 配置进入特权模式的密码为ruijie

​

Ruijie(config)#end                           ## 退出到特权模式

​

Ruijie#write          

​

注意事项:如果要限制用户使用telnet登录,只能使用SSH登录,则需要调整配置,默认情况下telnet和SSH均可登录。

​

Ruijie(config)#line vty 0 4        

​

Ruijie(config-line)#transport input ssh

​

若是要配置用户名和密码验证登录则

Ruijie(config)#username admin password ruijie   ##多配置一条命令

​

Ruijie(config)#username "admin" privilege 12 password "ruijie" 配置用户权限

​

Ruijie(config)#show privilege ##查看自己的用户等级

​

​

配置console密码 需要配置enable密码 如上

Ruijie(config)#line vty console 0

​

Ruijie(config-line)#login     ##本地密码登录 即为无用户名

​

Ruijie(config-line)#password "ruijie"   ##设置密码为锐捷

​

Ruijie(config-line)#login local   ##配置本地用户登录   需配置用户

DHCP

H3C

[H3C]dhcp enable   ##开启DHCP服务

​

[H3C]interface GigabitEthernet 1/0/1

​

[H3C-GigabitEthernet1/0/1]ip address "X.X.X.X" "MASK"   ##配置IP地址

​

[H3C-GigabitEthernet1/0/1]dhcp select server   ##让接口工作在DHCP服务器模式 默认就是处于这个模式

​

[H3C-GigabitEthernet1/0/1]dhcp select relay ##这条命令是让接口工作在DHCP中继模式

​

[H3C]dhcp server ip-pool "name"   ##创建DHCP地址池

​

[H3C-dhcp-pool-"name"]gateway-list "设置网关地址"  

​

[H3C-dhcp-pool-"name"]network "X.X.X.X" "MASK"

​

[H3C-dhcp-pool-"name"]address range "X.X.X.X" "X.X.X.X"   ##配置分配地址范围

​

[H3C-dhcp-pool-"name"]dns-list "DNS" "DNS"

​

[H3C-dhcp-pool-"name"]expired day 0 hour 8   ##配置租期时间 day为天 hour为时,minute为分

​

[H3C-dhcp-pool-"name"]static-bind ip-address "X.X.X.X" "MASK" hardware-address "aa-aa-aa-aa" 绑定IP和MAC

​

[H3C]dhcp server forbidden-ip "X.X.X.X" "X.X.X.X" 全局设置排除地址范围

​

[H3C]dis cur | in forbidden-ip   ##查询排除地址

​

常用查询命令

display dhcp server statistics ##显示DHCP服务器统计信息

display dhcp server ip-in-use ##显示DHCP服务器地址池中已经分配的IP地址

display dhcp server conflict ##显示DHCP服务器地址池中冲突的IP地址

display dhcp server lease ##显示DHCP服务器租约信息

迈普

配置接口并使能DHCP

maipu(config)#interface vlan2

maipu(config-if- vlan2)#ip address "X.X.X.X" "mask"

maipu(config-if- vlan2)#ip dhcp server

maipu(config-if- vlan2)#ip dhcp excluded-address "X.X.X.X" "X.X.X.X" ##配置排除地址

maipu(config-if- vlan2)#ip dhcp pool "name" ##创建地址池

maipu(dhcp-config)#network "IP address" "mask"

maipu(dhcp-config)#default-router "IP address" ##网关地址

maipu(dhcp-config)#dns-server "DNS" "DNS"

maipu(dhcp-config)#lease "day" "hour" "minute" ##配置租期

maipu(dhcp-config)#bind "IP address" "MAC" ##静态绑定IP和MAC

常用查询命令

maipu(config)#show ip dhcp pool mac-binding binding ##查看静态分配地址

maipu(config)#show ip dhcp server interface vlan2 ##查看服务器关联地址池信息

maipu(config)#show ip dhcp pool "name" lease ##查看为客户端分配的地址池信息

maipu(config)#show ip dhcp pool "name" summary ##查看地址池统计信息

锐捷

Ruijie(config)#service dhcp ##开启DHCP服务

Ruijie(config)#ip dhcp pool vlan2 ##创建一个名为 valn2 的DHCP地址池

Ruijie(dhcp-config)#lease 1 2 3 ##1、2、3分别是天、时、分,地址释放时间默认为24小时。

Ruijie(dhcp-config)#network "IP address" "mask" ##配置分配地址

Ruijie(dhcp-config)#dns-server "DNS" "DNS"

Ruijie(dhcp-config)#default-router "IP address" ##分配的网关地址

Ruijie(dhcp-config)#exit

###静态绑定IP和MAC,需要重新建立地址池,绑定一个就需要新建一个绑定地址池

Ruijie(config)#ip dhcp pool zhangsan ##指定静态地址池名称为zhangsan

Ruijie(dhcp-config)#hardware-address f0de.f17f.cb4c ##配置客户端的mac,推荐根据客户端mac分配IP地址,

Ruijie(dhcp-config)#host "IP address" "mask" ##配置要固定分配的ip及掩码

Ruijie(dhcp-config)#dns-server "DNS" "DNS" ##DNS

Ruijie(dhcp-config)#default-router "IP address" ##用户网关

Ruijie(config)#ip dhcp excluded-address "IP address" "IP address" ##不向客户端分配的地址

##常用查询命令

Ruijie#show ip dhcp binding

已下发的ip地址 客户端标识(01+mac)/MAC地址 地址租期 地址分配方式

IP address Client-Identifier/Hardware address Lease expiration Type

192.168.2.88 01f0.def1.7fcb.4c 000 days 23 hours 59 mins Automatic

清空配置

迈普

clear running-config

链路聚合

基本概念:将多个端口捆绑成为一个口,聚合口的带宽就是聚合口的下的物理口之和

静态聚合:不与对端交互报文,如果是对接不同厂商,可以使用静态聚合

动态聚合(LACP):与对端交互LACP报文,协商主端口之类的参数

H3C

Ruijie

锐捷的聚合比较简单,一两条命令,不理解迈普的为啥那么多

SW(config)#interface range gigabitEthernet 0/1-3 ##同时进入到g0/1-3口配置模式

SW(config-if-range)#port-group 1 mode active ##设置为AG1口,并且模式为active ,如果设置位静态 那就后面不加mode active即可

SW(config-if-range)#exit ##退出

如果要平衡流算法,两种方式 一种全局,一种聚合接口下

SW(config)#aggregateport load-balance (平衡流算法) ##全局

SW(config-if-AggregatePort 1)#aggregateport load-balance (平衡流算法) ##接口下

另外附

- 默认设备支持的流量均衡方式为 src-dst-mac ,在不同的场景模型中,用户流量的特征不同,可能并不能使流量负载均衡到其成员链路上,需要人工调整负载均衡的方式;



- 11.x版本支持对某个AP口指定负载均衡模式,当AP口指定了均衡模式时,则按照AP口指定的均衡模式生效,不受全局均衡模式的影响,当AP口没有指定负载均衡模式时,则采用全局负载均衡模式。



- 使用端口聚合的两台交换机模式要一致,不能一边配置为动态链路聚合,一边配置为静态链路聚合(特别是我司交换机与服务器互联的时候,部分服务器只支持动态链路聚合不支持静态链路聚合,此时我司交换机也要配置为动态链路聚合)

Maipu

迈普的链路汇聚的操作key

- 操作key是成员端口的属性配置,由速率、双工模式及管理key(即汇聚组编号)组成。属性配置中,双工模式或者速率的变化都会引起操作key重新计算。



- 同一汇聚组中,如果成员端口的双工模式或者速率不同,生成的操作key必定不同,但处于选中状态的成员端口一定有相同的操作key。



静态汇聚模式

![image-20231025143726062](http://qinniu.luohongqu.cn//image-20231025143726062.png)

动态汇聚

![image-20231025144017680](http://qinniu.luohongqu.cn//image-20231025144017680.png)

配置案例

switch#configure terminal

switch(config)#link-aggregation 1 mode manual(lacp为动态) //创建聚合组 聚合方式为静态

switch(config)#interface gigabitethernet 0/1-0/2 //进入接口

switch(config)#link-aggregation 1 manual //将接口以静态的方式加入聚合组

switch(config)#exit

switch(config)#load-balance profile linkagg-profile //创建模板,但是一般用默认default 的就好了,默认的是以源目IP和MAC来做负载均衡

switch(config-hashprofile)#l2 dst-mac

switch(config-hashprofile)#ip dst-ip

switch(config-hashprofile)#active configuration pending //激活当前配置,如果没有这条命令,那么不会生效,配置新的模板时,不会覆盖原有的,而是会合并

switch(config-hashprofile)#abprt configuration pending //取消当前配置,这条命令可以取消修改当前的配置

switch(config)#interface link-aggregation 1

switch(config-link-aggregation1)#load-balance profile linkagg-profile //在聚合组中引用这个模板

监控命令

switch#show interface link-aggregation 1 //查看汇聚组信息

link-aggregation1 configuration information

Description :

Peer-description :

Status : Enabled

Link : Down

Act Speed : Unknown

Act Duplex : Unknown

Port Type : Nni

Pvid : 1

Profile:default

Configuration Valid currently:

L2: src-mac dst-mac

Ip: src-ip dst-ip l4-src-port l4-dst-port

Configuration Valid-pending to be applied:

L2:

Ip:

Configuration Invalid-pending to be applied:

L2:

Ip:

Profile:ecmp_default

Configuration Valid currently:

L2:

Ip: src-ip dst-ip l4-src-port l4-dst-port

Configuration Valid-pending to be applied:

L2:

Ip:

Configuration Invalid-pending to be applied:

L2:

Ip:

Profile:test

Configuration Valid currently:

L2: src-mac dst-mac

Ip: src-ip dst-ip

Configuration Valid-pending to be applied:

L2:

Ip:

Configuration Invalid-pending to be applied:

L2:

Ip:

![image-20231025164757695](http://qinniu.luohongqu.cn//image-20231025164757695.png)

若是为动态聚合时,可以更改端口优先级,也可以更改系统优先级

switch#configure terminal

switch(config)#lacp system-priority XXX //配置系统LACP优先级,默认为32768

switch(config)#lacp system-priority XXX ////配置接口LACP优先级,默认为32768,会影响端口ID,从而影响选中和非选中状态


评论