站点图标 IDC铺

华为5700交换机路由常用命令

1、基础命令
system view
clock timezone BJ add|minus 8 //设置时区
clock datetime 16:36:00 2016-07-01 //设置交换机的时间
sysname myname //设置交换机名
telnet server enable //打开telnet登录服务
display current-configuration //显示当前配置
display port vlan //显示接口类型、vlan信息
display ip interface brief //显示接口IP地址列表
display vlan //查看vlan信息
interface Gigabitethernet 0/0/0
description *** //添加描述
quit
save


2、登录配置
1、vty配置
user-interface maximum-vty 15 //配置vty最大连接数(可选)
user-interface vty 0 4 //进入vty用户界面视图
idle-timeout //超时时间
user privilege level 3 //设置vty登入的用户级别(可选)
authentication-mode aaa //设置vty登入时的验证模式用户名和密码验证
aaa //进入aaa
local-user huawei password cipher/simple huawei@123 //设置aaa登入用户名密码
local-user huawei service-type telnet //设置admin用户远程登入时的协议
2、console配置
user-interface console 0 //进入第0个console口的用户界面
authentication-mode passwd //配置从console口登入交换机的认证模式为密码认证
set authentication password cipher admin@123 //配置从console口登入交换机的密码
3、web http配置
http server enable
http secure-server enable
http server port ***
http secure-server port ***


3、创建vlan信息:
vlan 2
interface vlan 2
ip address 192.168.11.1 24
quit


4、单接口加入vlan:
interface GigabitEthernet 0/0/1
port link-type access
port default vlan 2
quit


5、多接口加入vlan:
port-group mygroup //删除port-group:undo port-group mygroup
group-menber GigabitEthernet 0/0/2 GigabitEthernet 0/0/5
port link-type access
port default vlan 2
quit


6、配置Vlan跨交换机通信
interface GigabitEthernet 0/0/24
port link-type trunk
port trunk allow-pass vlan 2 3
port trunk pvid vlan 1 //默认vlan1可选配置


7、配置路由与交换机通信
1、配置路由接口
interface GigabitEthernet 0/0/1
ip address 192.168.1.254 24 //路由器接口直接配置ip地址
2、配置交换机接口
vlan 1
interface GigabitEthernet 0/0/1
ip route-static 192.168.107.0 24 192.168.1.254
undo ip route-static 192.168.107.0 24 192.168.1.254


8、SNMP配置
1、启动SNMP-agent服务
snmp-agent
undo snmp-agent
2、设置”public”团体名具有只读权限
snmp-agent community read public
undo snmp-agent community read public
3、设置”private”团体名具有读写权限
snmp-agent community write private
undo snmp-agent community write private
4、设置联系方式
snmp-agent sys-info contact xxxx
undo snmp-agent sys-info contact xxxx
5、设置网络设备位置
snmp-agent sys-info location xxxx
undo snmp-agent sys-info location xxxx
6、SNMP的版本支持
snmp-agent sys-info version v1 v3
snmp-agent sys-info version all
undo snmp-agent sys-info version xxxx
9、RIP路由协议
1、开启RIP
rip 1 //指定通道名
version 2 //不指定版本默认发送v1,接受v1 v2协议
2、通报在链路的主类网段
undo summary //可选关闭路由汇总
network 10.0.0.0
network 192.168.1.0
3、查看rip信息
display rip 1 GigabitEthernet 0/0/1 verbose
display rip 1 database
display ip routing-table protocol rip
4、接口RIP报文抑制
//三层接口连接的是pc时抑制rip广播发送
rip 1
silent-interface GigabitEthernet 0/0/1
//接口input、output抑制发送和接收rip报文
interface GigabitEthernet 0/0/1
rip input
undo rip input
rip output
undo rip output
//末端路由可配置RIP抑制发送和路由协议单播
rip 1
silent-interface GigabitEthernet 0/0/0
silent-interface GigabitEthernet 0/0/1
peer 10.1.0.2 //邻居路由器地址
5、出口路由配置默认路由
ip route-static 0.0.0.0 0 172.50.50.125
rip 1
default-route originate //邻居路由学习到默认路由

10、OSPF路由协议
ospf 1 router-id //router唯一id,也可系统选举,常用loopback地址
area 0 //链路状态区域0
network 10.1.0.0 0.0.255.255 //通告主类网络,反掩码通配

11、DHCP全局地址池配置
1、vlan逻辑接口地址配置
vlan 10
q
interface Vlanif 10
ip address 192.168.10.1 24
q
2、pool地址池配置
display ip pool //查看地址池信息
ip pool poolname //创建地址池
network 192.168.10.0 mask 255.255.255.0 //ip地址池
dns-list 61.139.2.69
gateway-list 192.168.10.1 //网关
lease day 7 //可选租约时间
exclude-ip-address 192.168.10.200 192.168.10.254 //排除保留ip地址
q
3、vlan逻辑接口选择全局地址池
interface Vlanif 10
dhcp select global
q

12、ACL访问控制列表
acl 2000 //创建基本访问控制列表
rule deny/permit source 192.168.10.0 0.0.0.255 //控制规则,注意通配反掩码写法
1、基本控制用法
interface GigabitEthernet 0/0/1
traffic-filter inbound acl 2000 //以路由器为参照对象inbound和outbound

13、Easy IP NAT端口转换配置
acl 2001
rule permit source any
interface GigabitEthernet 0/0/0
nat outbound 2001 //所有ip可以通过出口ip转换端口上

退出移动版