cisco交换机配置syslog

cisco交换机配置syslog,第1张

en

conf t

clock timezone GMT +8        #设置正8区北京时间

exit

clock set HH:MM:SS DAY MOTH YEAR  #设置当前时间 小时:分钟:秒 日 月 年

service timestamps debug uptime #开启debug调试信息增加时间戳

service timestamps log datetime localtime #开启log日志增加时间戳

logging on                  #启动log机制

logging 10.1.1.23  #配置日志发送服务器,将日志发送到10.1.1.23上

logging facility local2    #将记录时间类型记录为local2

logging trap warning    #将记录事件严重级别定义为从warningl开始,一直到最紧急级别的事件全部记录到前边指定的syslog server.

logging source-interface loopback0 #指定记录事件的发送源地址为loopback0的IP地址,根据自己的实际情况

service timestamps log datetime localtime    #发送记录事件的时候包含时间标记

end        #退出

wr         #保存

1 , 设置交换机名称

(config)#hostname hostname

2,设置log存放路径

(config)#logging 10.7.68.68 //将log档文件存在10.7.68.68

(config)#spanning-tree mode rapid-pvst // 设定 spanning-tree 的模式是 rapid-pvst

3,设置errdisable

(config)#errdisable recovery cause all //开启errdiable 恢复的原因

(config)#errdisable recovery interval 300 //errdisable后300秒恢复

4,设置snmp-server

(config)#snmp-server community askeymis RO //设置简单网络管理协议字符串为只读

5, 设置vtp

(config)#vtp domain askey // 设定VTP domain 名称

(config)vtp mode transparent // 设定 VTP 模式为透明模式

Vlan

1,创建Vlan

(config)#vlan 180 //创建Vlan ID号为180

(config-vlan)#name askey //Vlan 名称为askey

2,删除Vlan

(config)#no vlan 180

#show vlan brief //查看交换机当前Vlan 号及Vlan 下有哪些端口

3,配置管理IP

(config)#int vlan 180

(config-if)#ip address 192.168.1.251 255.255.255.0 //设置管理IP地址

(config)#ip default-gateway 192.168.1.254 //设置默认路由,供其他网段访问

4,将端口划至Vlan 180

4.1单一端口划分

(config)#int f0/1 //进入端口f0/1

(config-if)#sw mode access //设置访问模式

(cofnig-if)#sw ac vlan 180 //将其端口划入Vlan 180

4.2多端口划分

(config)#int range f0/1 _ 24 //端口范围为1-24

(config-if-range)#sw mode access

(config-if-range)#sw ac vlan 180

端口配置

1,端口配置

(cofnig)#interface FastEthernet0/1

(config-if)#switchport access vlan 33 // 划分VLAN

(config-if)# switchport mode access

(config-if)# switchport port-security maximum 2 //设定端口只允许接入2个PC

(config-if)# switchport port-security // 启用端口安全

(config-if)# switchport port-security violation restrict // 发生违例 端口进errdisable,并记录

(config-if)# storm-control broadcast level 0.80 //控制广播包的突发百分比

(config-if)# storm-control action shutdown //暴风控制的违例时端口进入errdisable

(config-if)# storm-control action trap //产生snmp trap(抑制)消息来通告发生过量流量的情况

(config-if)# spanning-tree portfast // 配置接口为portfast模式

(config-if)# spanning-tree bpduguard enable // 启用bpuguard 防护

(config-if)# spanning-tree guard root // 启用根桥防护

设置时间与同步

1 , 开启debug与log记录时间的服务

(config)#Service timestamps debug datetime localtime //开启debug记录时显示的时间

(config)#Service timestamps log datetime localtime //开启log记录时显示的时间

2,设置时间与时区

(config)# Clock timezone TAIWAN 8 //设置时区

(config)# Clock set 12:16:50 nov 27 2008 //设置时间(月,日,年)

#Show clock //查看交换机当前的时间

3,设置ntp server 实现时间同步

(config)# ntp server 10.1.71.249 //设置交换机与ntp server 实现时间同步

#show ntp stauts //查看交换机是否同步

Clock is synchronized, stratum 3, reference is 10.1.71.249(同步)

nominal freq is 119.2092 Hz, actual freq is 119.2093 Hz, precision is 2**17

reference time is CCD89F21.ECA0C247 (12:22:57.924 TAIWAN Thu Nov 27 2008)

clock offset is 8.4785 msec, root delay is 399.51 msec

root dispersion is 937.29 msec, peer dispersion is 885.30 msec

Password

1,开启明文密码加密服务

(config)#service password-encryption //将明文密码加密

2,设置控制台密码

(config)#line consloe 0 //进入控制台

(config-line)#login //登录

(config-line)#password cisco //设置密码

3,设置enable密码

(config)#enable password cisco

(config)#enable secret password cisco //给密码加密码 ,优先级高于enable password

4,设置Telnet 密码

(config)#line vty 0 4 //进入vty模式

(config-line)#login

(config-line)#password cisco //设置密码

(config-line)#exec-timeout 5 0 //telnet 5分钟超时。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11959567.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存