遥遥领先
用户:
<Huawei>system-view
<R1>save // 保存
全局:
undo
[Huawei]sysname R1 //重命名
[R1]display current-configuration //查看所有配置
[R1]quit //退出
[R1]int g0/0/0 //进接口
虚拟网关
[Huawei-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.250
多选端口
[SW1]port-group 1 //创建组
[SW1-port-group-1]group-member Ethernet 0/0/10 to e0/0/20 //将e0/0/10 到0/0/20 接口加入组
华为创建vlan
vlan 10
vlan batch 10 20
vlan batch 10 to 15
access
[Huawei]int e0/0/1 //进入接口
[Huawei-Ethernet0/0/1]port link-type access //修改端口模式
[Huawei-Ethernet0/0/1]port default vlan 10 //划入vlan10
trunk
Huawei-Ethernet0/0/2]int e0/0/3
[Huawei-Ethernet0/0/3]port link-type trunk //修改端口模式为trunk
[Huawei-Ethernet0/0/3]port trunk allow-pass vlan all //放行所有的vlan流量(华为交换机trunk默认拒绝所有流量通过)
单臂路由的配置
[R1]int g0/0/0.10
[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10 //打上vlan 10 的标签
[R1-GigabitEthernet0/0/0.10]ip add 192.168.10.254 24
[R1-GigabitEthernet0/0/0.10]arp broadcast enable //开启arp广播
vlanif的配置:
[Huawei]vlan batch 10 20
[Huawei]int Vlanif 10
[Huawei-Vlanif10]ip add 192.168.10.254 24
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
lacp 链路聚合
二层
[SW1]int Eth-Trunk 0 //创建逻辑接口
[SW1-Eth-Trunk0]mode ?
lacp-static Static working mode //LACP协商模式
manual Manual working mode //手工模式,默认情况下都是手工模式
[SW1-Eth-Trunk0]mode manual load-balance //设置为手工模式
[SW1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/4 //将0/0/1-4接口加入
[SW1-Eth-Trunk0]port link-type trunk
[SW1-Eth-Trunk0]port trunk allow-pass vlan all
[SW1]display interface brief //查看接口状态
[SW1]int Eth-Trunk 0 //创建逻辑接口
[SW1-Eth-Trunk0]mode lacp-static //修改模式为LACP
[SW1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/4
[SW1-Eth-Trunk0]port link-type trunk
[SW1-Eth-Trunk0]port trunk allow-pass vlan all
[SW1]lacp priority 1 //修改系统LACP优先级为1
[SW1-Eth-Trunk0]max active-linknumber 2 //设置最大活动接口数为2
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]lacp priority 100 //修改接口优先级
[SW1]display eth-trunk 0 //查看逻辑接口状态信息
三层
AR1:
[Huawei]int eth 1
[Huawei-Eth-Trunk1]undo portswitch //关闭二层端口,启用三层端口。因为在缺省情况下,以太网接口工作在二层模式。
[Huawei-Eth-Trunk1]ip address 12.1.1.1 24
[Huawei-Eth-Trunk1]trunkport g 0/0/0 //将端口加入聚合组
[Huawei-Eth-Trunk1]trunkport g 0/0/1
[Huawei-Eth-Trunk1]trunkport g 0/0/2
AR2:
[Huawei]int eth 1
[Huawei-Eth-Trunk1]undo portswitch
[Huawei-Eth-Trunk1]ip address 12.1.1.2 24
[Huawei-Eth-Trunk1]trunkport g 0/0/0
[Huawei-Eth-Trunk1]trunkport g 0/0/1
[Huawei-Eth-Trunk1]trunkport g 0/0/2
DHCP的配置
[R1]dhcp enable //开启dhcp服务
[R1]ip pool vlan10 //创建地址池
[R1-ip-pool-vlan10]network 192.168.10.0 mask 24 //通告网段和掩码
[R1-ip-pool-vlan10]gateway-list 192.168.10.254 //设置网关
[R1-ip-pool-vlan10]dns-list 8.8.8.8 //设置dns
[R1]int g0/0/0.10
[R1-GigabitEthernet0/0/0.10]dhcp select global
NAT
②静态NAT(一对一)
使用环境:当企业内部存在服务器,需要被外网用户访问时,需要针对该服务器进行特定的公有IP分配
服务器的私有IP----特定为服务器分配的公有IP
192.168.100.100--202.101.12.100
[R2]int g0/0/1--进入连接ISP的外部端口
[R2-GigabitEthernet0/0/1]nat static global 202.101.12.100 inside 192.168.100.100
③动态NAT--地址池NAT(同时申请多个公有IP)
no-pat:表示不进行端口复用
[R2]nat address-group 1 202.101.12.10 202.101.12.11
[R2]acl 2001
[R2-acl-basic-2001]rule permit source 192.168.100.0 0.0.0.255
一对一:
[R2-GigabitEthernet0/0/1]nat outbound 2001 address-group 1 no-pat
多对一:
[R2-GigabitEthernet0/0/1]nat outbound 2001 address-group 1
加密
1.设置console口加密:
[R1]user-interface console 0
[R1-ui-console0]authentication-mode password
Please configure the login password (maximum length 16):123
console设置aaa认证:
[R2]user-interface console 0
[R2-ui-console0]authentication-mode aaa
[R2-ui-console0]qu
[R2]aaa
[R2-aaa]local-user yucedu password cipher 456
[R2-aaa]local-user yucedu service-type terminal
[R2-aaa]local-user yucedu privilege level 15
2.设置telnet远程登录
[R1]telnet server enable //开启telnet服务
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode password
Please configure the login password (maximum length 16):123456
[R1-ui-vty0-4]protocol inbound telnet //允许使用telnet协议进行远程登录
[R1-ui-vty0-4]user privilege level 15
通过aaa认证进行配置:
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]protocol inbound telnet
[R1]aaa
[R1-aaa]local-user yucedu password cipher 123456
[R1-aaa]local-user yucedu service-type telnet
[R1-aaa]local-user yucedu level 15
ssh远程登录配置:
服务端配置:
[R1]stelnet server enable //开启ssh远程登录服务
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]protocol inbound ssh
[R1]aaa
[R1-aaa]local-user yucedu password cipher 987654321 //账户
[R1-aaa]local-user yucedu service-type ssh //服务于哪个类型 (这里为ssh)
[R1-aaa]local-user yucedu privilege level 15 //权限等级
客户端:
[R2]ssh client first-time enable
[R2]stelnet 192.168.1.1
ospf
display ospf peer brief //查看邻居表
display ospf peer //查看DR、BDR、RID
display ospf lsdb //查看拓扑表
display ip routing-table protocol ospf //查看路由表
[R2-GigabitEthernet0/0/0]ospf dr-priority 100 //优先级
[R1]ospf 10 //启用ospf进程号为10
[R1-ospf-10]area 0 //进入骨干区域
[R1-ospf-10-area-0.0.0.0]network 1.1.1.0 0.0.0.255 //通告直连路由的路由信息
[R2]ospf 10 router-id 6.6.6.6 //手工指定RID
<R2>reset ospf process //清除ospf进程
用接口
华为设备下面,进接口启用ospf
[R4]ospf 110
[R4-ospf-110]area 0
[R4-Serial2/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ospf enable 110 area 0
路由表查询
[Huawei]display ip routing-table
[Huawei]display ip routing-table protocol static //只查看静态路由的路由信息
在静态路由中,优先级 AD值 默认是60 AD值越低,优先级就越高
静态路由
ip route-static x.x.x.x y.y.y.y 下一跳IP/出接口
x.x.x.x 目标网段
y.y.y.y 目标网段的子网掩码
ip route-static 192.168.2.0 255.255.255.0 192.168.1.2
ip route-static 192.168.2.0 24 192.168.1.2
ip route-static 192.168.2.0 24 g0/0/0
数据的通信是双向的
arp代理
使用接口出包需在接口对方做arp
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]arp-proxy enable //启用arp代理
默认路由
特殊的静态路由:默认路由/缺省路由
ip route-static 0.0.0.0 0.0.0.0 下一跳IP/出接口
环回口:测试接口/虚拟接口
[R7]int LoopBack 1
[R7-LoopBack1]ip add 10.10.10.10 24
用于测试,并且环回口配置完默认是开启的,除非人为的shutdown
浮动路由:备份 主从关系
[R5]ip route-static 10.10.10.10 32 57.57.57.7 preference 100 //修改默认路由优先级
acl
基本acl的配置:
[R2]acl 2000 //创建表号为2000的基本acl
[R2-acl-basic-2000]rule 5 deny source 12.12.12.1 0.0.0.0 //拒绝源IP为12.12.12.1的地址
[R2]int g0/0/1 //进入出站接口
[R2-GigabitEthernet0/0/1]traffic-filter outbound acl 2000 //调用acl2000
高级ACL的配置:
[R2]acl 3000
[R2-acl-adv-3000]rule deny icmp source 12.12.12.1 0 destination 23.23.23.3 0
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]traffic-filter inbound acl 3000
实现单向通信:
[R2]acl 3000
[R2-acl-adv-3000]rule 1 deny icmp icmp-type echo source 12.12.12.1 0 destination 23.23.23.3 0
[R2-acl-adv-3000]rule 1 deny icmp icmp-type echo-reply source 12.12.12.1 0 destination 23.23.23.3 0
查看
tracert
display vlan //查看vlan (huawei)
display current-configuration 显示当前配置
display ip int brief 查看接口ip地址
display interface brief 查看接口的简要信息
display current-configuration 显示当前配置文件
display current-configuration 关键词(查看关键词的配置)
display saved-configuration 显示保存的配置文件
display ip routing-table 查看路由表
display ospf peer 查看ospf邻居关系
display ospf lsdb 查看链路关系数据库
display clock 查看系统当前时间
display this 查看当前模式下的配置,比如在接口上敲这条命令就可以看到当前接口下的信息
display alarm urgent 查看设备的告警信息,可以用命令
display temperature all 查看设备温度,可以用命令
display reboot-info 查看设备复位情况
display device 查看子卡的运行状态
display cpu-usage 查看cpu状态
display memory-usage 查看内存占用情况
display logbuffer或者display trapbuffer 查看日志信息
作者:qianyuzz
出处:https://www.cnblogs.com/qianyuzz/p/17735487.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)