H3C交换机软件版本ComwareV7的一些基本操作命令
H3C 交换机(软件版本ComwareV7)的一些基本操作命令
H3C 交换机(软件版本ComwareV7)的一些基本操作命令
The saved configuration file will be erased. Are you sure? [Y/N]:y—————这里输入y确认
Start to check configuration with next startup configuration file, please wait………DONE!
Current configuration may be lost after the reboot, save current configuration? [Y/N]:n———–这里提示是否保存设置,输入n
This command will reboot the device. Continue? [Y/N]:y——————–这里提示是否继续,输入y。注意哪里是y哪里是n,否则不能恢复。
设置时间日期,需要先执行 clock protocol none命令
To manually set the system time, execute the clock protocol none command first.
[H3C]clock protocol none
[H3C]quit
如需设置console口连时的密码,或者采用 用户名/密码 认证方式,需进入用户接口。
[H3C]user-interface aux 0
[H3C-line-aux0]authentication-mode ?
none Login without authentication
password Password authentication
scheme Authentication use AAA
[H3C-line-aux0]authentication-mode password
[H3C-line-aux0]set authentication password simple 1234abcd
允许telnet访问,需先开启telnet服务,再进行后续配置
[H3C]telnet server enable —————开启telnet服务
[H3C]ip http enable—————开启http服务
[H3C]stp mode rstp—————stp模式设置为rstp
[H3C]stp enable—————开启stp功能
[H3C]user-interface vty 0 14
[H3C-line-vty0-14]
[H3C-line-vty0-14]protocol inbound telnet
[H3C-line-vty0-14]authentication-mode password
[H3C-line-vty0-14]set authentication password simple admintelnet
[H3C-line-vty0-14]user-role level-15
[H3C-line-vty0-14]idle-timeout 6 0
[H3C-line-vty0-14]screen-length 100
[H3C-line-vty0-14]history-command max-size 256
建立一个用户admin,用于web登录(用浏览器登录)
[H3C]local-user admin
New local user added.
[H3C-luser-manage-admin]authorization-attribute user-role level-15
[H3C-luser-manage-admin]service-type http
[H3C-luser-manage-admin]password simple administrator
建立一个vlan interface,并设置IP地址,用于网页登录和telnet管理,不建议使用vlan1
[H3C]vlan 255
[H3C-vlan255]quit
[H3C]interface Vlan-interface 255
[H3C-Vlan-interface255]ip address 192.168.255.1 255.255.255.0
根据需要设置stp模式
[H3C]stp mode ?
mstp Multiple spanning tree protocol mode
pvst Per-Vlan spanning tree mode
rstp Rapid spanning tree protocol mode
stp Spanning tree protocol mode
开启DHCP服务,建立不同的IP地址池,对应不同的Vlan,建立相应的vlan-interface,设置IP地址,做为网关
[H3C]dhcp enable———-全局开启dhcp功能
[H3C]dhcp server ip-pool 192.168.100.0————-定义一个地址池名字
gateway-list 192.168.100.254—————设置网关地址
network 192.168.100.0 mask 255.255.255.0——————-设置网段
address range 192.168.100.1 192.168.100.240——————-设置地址池的IP地址集合
dns-list 114.114.114.114 8.8.8.8——————设置dns服务器地址
expired day 0 hour 0 minute 40——————设置租期时长
[H3C]dhcp server ip-pool 172.16.1.0
gateway-list 172.16.1.254
network 172.16.1.0 mask 255.255.255.0
address range 172.16.1.1 172.16.1.240
dns-list 114.114.114.114 8.8.8.8
expired day 0 hour 0 minute 30
[H3C]vlan 100———–建立vlan
[H3C-vlan100]quit
[H3C]interface Vlan-interface 100————–建立vlan interface
[H3C-Vlan-interface100]
ip address 192.168.100.254 255.255.255.0—————-设置vlan-interface的IP地址
dhcp select server——————设置dhcp为服务端,会自动匹配地址池
[H3C]vlan 601
[H3C-vlan601]quit
[H3C]interface Vlan-interface 601
[H3C-Vlan-interface601]
ip address 172.16.1.254 255.255.255.0
dhcp select server
设置qos策略,使访客网段与办公网段不能互通,在全局应用
[H3C]acl advanced 3001
rule 1000 deny ip source 172.16.0.0 0.0.255.255 destination 192.168.0.0 0.0.255.255
————–创建一个高级ACL,设置规则1000号(号码不是特别重要)。拒绝源地址172开头的,访问目标地址192开头的。
[H3C]traffic classifier noguest operator and
if-match acl 3001—————–定义一个类
[H3C]traffic behavior noguest
filter deny——————-定义一个流行为
[H3C]qos policy noguest
classifier noguest behavior noguest—————–定义一个策略,为类指定流行为,将类和流行为二者组合起来
[H3C]qos apply policy noguest global inbound ——————–在全局上应用qos策略,方向为入方向
设置链路聚合
[H3C]interface Bridge-Aggregation 1—————-创建一个聚合端口
[H3C-Bridge-Aggregation1]port link-type trunk—————-设置这个端口的属性,如link-type,vlan等
[H3C-GigabitEthernet1/0/23]port link-aggregation group 1 force—————-将这个端口加入聚合组,最后的force 参数可将聚合组的属性同步到此端口,省去手动配置的步骤
[H3C-GigabitEthernet1/0/24]port link-aggregation group 1 force
创建vlan,将端口加入vlan,更改端口模式
[H3C]vlan 100—————–创建vlan100
[H3C-vlan100]port GigabitEthernet 1/0/1 to g 1/0/10—————–将1 to10口都划入vlan100(华三交换机的端口,默认类型是access,可以直接加入vlan
[H3C-GigabitEthernet1/0/11]port link-type trunk—————–进入G1/0/11端口,更改link-type为trunk
[H3C-GigabitEthernet1/0/11]port trunk pvid vlan 100—————–设置trunk端口的pvid
[H3C-GigabitEthernet1/0/11]port trunk permit vlan 2 to 4000—————–设置trunk端口允许通过的vlan ID
[H3C-GigabitEthernet1/0/11]undo port trunk permit vlan 1—————–禁止trunk端口允许vlan1通过(在比较大的企业局域网里,不要使用vlan1)