神州交换机常用命令
基本配置
Switch > enable 进入特权模式
Switch # config 进入全局配置模式
Switch (config)# exit 退出
Switch (config)# hostname Switch 配置交换机名称
Switch (config)# vlan <2-4095> 创建vlan
Switch (config)# interface vlan 2 <2-4095> 进入vlan配置模式
Switch (config-if-vlan2)#ip add 192.168.2.1 255.255.255.0 配置vlanip地址和子网掩码
Switch (config)# interface ethernet 进入端口
Switch (config-if-interface1/0/1)# switchport access vlan 2 配置端口vlan 模式access
Switch (config-if-interface1/0/1)# switchport mode trunk 端口开启trunk模式
Switch (config-if-interface1/0/1)# switchport trunk allowed vlan 配置端口vlan 模式trunk
access口:用于连接终端设备,提供单个VLAN的接入。只允许一个VLAN的流量通过,设备连接到access口时只能访问与其PVID相同的VLAN。
trunk口:用于连接交换机之间或交换机与路由器之间的链路,提供多个VLAN的传输。允许多个VLAN的流量同时通过,可以接收和转发带有VLAN标签的帧。
ospf路由配置命令
Switch (config)#router ospf 1 启用ospf进程 进程号 1
SWitch (config-router)#router-id 1.1.1.1 配置路由id 路由id一般是loopback的ip地址
SWitch (config-router)#netword 192.168.2.1 0.0.0.255 area 0 宣告IP地址、子网掩码、区域号 24/0.0.0.255 32/0.0.0.0 30/0.0.0.3
SWitch (config-router)#area 0 authentication message-digest 区域0启用MD5认证
SWitch (config-if-vlan)#ip ospf authentication message-digest vlan启用MD5认证
SWitch (config-if-vlan)#ip ospf message-digest-key ID<1-255> md5 0 用户密码 设定区域验证密码 0为明文密码
SWitch (config-if-vlan)#ip ospf message-digest-key ID<1-255> md5 7 用户密码 设定区域验证密码 7为密文密码
SWitch (config-if-vlan)#ip ospf hello-interval 配置ospf hello报文间隔 时间单位 秒
SWitch (config-if-vlan)#ip ospf dead-interval 配置ospf 死亡间隔时间 时间单位秒
DHC服务器配置
SWitch (config)service dhcp 启用DHCP
Switch (config)ip dhcp excluded-address 192.168.2.1 排除网段
SWitch (config)ip dhpc pool Poolv4-Vlan2 创建地址池 Poolv4-Vlan2
Switch (dhcp-poolv4-vlan2- config)#network-address 192.168.1.2 255.255.255.0 宣告地址范围
Switch (dhcp-poolv4-vlan2- config)#default-router 192.168.2.1 宣告网关
Switch (dhcp-poolv4-vlan2- config)#dns-server 10.10.40.1 10.10.10.1 DNS服务器
Switch(dhcp-pc-config)#host 客户机IP地址和掩码
DHPC中继
Switch(config)#service dhcp 启用DHCP
Switch(config)#ip forward-protocol udp bootps 全局开启转发
Switch(config)#interface vlan 2
Switch(config)ip helper-address 192.168.2.1 转发到DHCP服务器地址
RIP路由
Switch(config)#router rip 启用RIP路由
Switch(config-router)#version 2 设置RIP路由版本2
Switch(config-router)#network 10.10.10.101/24 与交换机所连vlan网段
Switch(config-router)#redistrbute connect metric 0 引入直接路由
Switch(config-router)#default-information originate 下发默认路由
bgp路由
Switch(config)#router bgp 65001 建立BGP进程号为65001
Swith(config-router)#neighbor 192.168.2.1 remote-as 65001 对端进程号
Swith(config-router)#neighbor 192.168.2.1 update-source 10.10.1.1 配置互联地址目的地址与原地址
Swith(config-router)#neighbor 192.168.2.1 next-hop-self 配置下一跳自我
Swith(config-router)#neighbor 10.10.3.1 ebgp-multihop 255 修改TTL值,通过直连检测
端口镜像
Switch(config)#monitor session 1 source interface ethernet 1/0/1 镜像源端口
Switch(config)#monitor session 1 destination interface ethenet 1/0/24 镜像接收端口
链路聚合
Switch(config)#port-group1 创建链路聚合组1
Switch(config)#interface ethernet 1/0/1
Switch(config)#port-group 1 mode active/passive active为主动模式 passive为被动模式
Switch(config)#load-balance 设置流量分担方式
Switch(config)#interface port-channel 1 进入链路组1
Switch(config-if-port-channel1)#switchport mode trunk 设置链路为中继模式
Switch(config-if-port-channel1)#switchport trunk allowed vlan all 允许所有vlan通过
ssh命令
Switch(config)#ssh-server enable 启用ssh
Switch(config)#ssh-server timeout 配置ssh连接超时时间 时间单位秒
Switch(config)#exec-timeout 配置console超时时间 时间单位分钟
Switch(config)#username admin password 0 /7 admin 0为明文密码 7为密文密码
ntp命令
Switch(config)#ntp enable 开启ntp协议
Switch(config)#ntp disable 关闭ntp协议
Switch(config)#ntp syn-interval 时间同步时间 时间单位秒
Switch(config)#clock timezone 设置时钟时区和时区名
snmp服务命令
Switch(config)#snmp-server enable 启用snmp
Switch(config)#snmp-server engineid <1-32> 配置snmpv3的引擎号
Switch(config)#snmp-server community ro/re 2024_R 配置组的读,写视图2024_R ro进行只读访问 re进行读写访问
07-12
10-24
03-11
669
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-10
2219
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-30
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交