配置SNMP
(config)#snmp-server community public ro 设置只读字符串,public为字符串值,ro为只读
(config)#snmp-server enable traps 启用snmp陷井,允许路由器将所有类型SNMP Trap发送出去
(config)#snmp-server enable traps snmp authentication snmp trap 验证
(config)#snmp-server host 172.24.138.15 version 2c public SNMP采用版本2,public作为字串
(config)#snmp-server host 172.24.138.15 traps public 指定路由器SNMP Trap的接收者为192.68.98.166,发送Trap时采用public作为字串
(config)#snmp-server trap-source vlan 6 设置vlan6口IP地址做为为snmp trap信息的发布地址
(config)#end
配置基本管理ip 地址,配置网关以及
Switch#conf t 进入配置模式(conf和 t之间有一个空格)
Enter configuration commands, one per line. End with CNTL/Z.
% Incomplete command.
Switch(config)#hos SW 给交换机命名
SW(config)#enable password Cisco 给交换机配置管理口令
SW(config)#line vty 0 4 给交换机开启远程管理
SW(config-line)#pass Cisco! 设置远程管理口令
SW(config-line)#login 允许远程登陆
SW(config-line)#exit 退出到上级目录
SW(config)#int vlan 1 进入vlan 1接口
SW(config-if)#no shut 开启此接口
SW(config-if)#ip add 192.168.40.81 255.255.255.0 设置此接口地址和子网掩码(地址和掩码中间有一个空格)
00:05:34: %LINK-3-UPDOWN: Interface Vlan1, changed state to up
00:05:35: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
SW(config-if)#exit
SW(config)#ip default-gateway 192.168.40.254 将交换机的网关指向上联交换机(设置网关)
SW#wr 保存配置
! 配置权限(可建立VLAN ,可进行基于端口的VLAN 划分)
我们可以先建立一个用户比如(全局模式下)
Username AAA privilege 12 password/ secret XXX (12代表权限级别0-15,0最低15最高 password表示明文,secret表示非明文)
在特权模式下进行
privilege EXEC level 11 vlan database 限制VLAN 权限
privilege EXEC level 11 configure terminal 限制全局模式进入权限
privilege configure level 11 interface 限制端口进去权限
privilege interface level 11 switchport mode access 限制模式权限
privilege interface level 11 switchport access vlan 限制vlan 模式权限
privilege interface level 11 no shutdown 限制no shut 的命令权限
设置控制台及vty 端口的会话超时:
SW(config)# line console 0
SW(config-line)# exec-timeout 5 10 表示非操作5 分10 秒自动断开
SW(config)# line vty 0 4
SW(config-line)# exec-timeout 5 2
配置QOS 控制流量
1、在交换机上启动QOS
Switch (config)#mls qos //在交换机上启动QOS
2、定义访问控制列表
Switch (config)#access-list 1 permit 192.168.1.0 0.0.0.255 //控制上行流量
Switch (config)#access-list 101 permit any 192.168.1.0 0.0.0.255 //控制下行流量
3、定义类,并和上面定义的访问控制列表绑定
Switch(config)#> Switch(config-cmap)# match access-group 1
Switch(config-cmap)# exit
Switch(config)#> Switch(config-cmap)# match access-group 2 //定义PC2上行的类,并绑定访问列表2
Switch(config-cmap)# exit
Switch(config)#> Switch(config-cmap)# match access-group 101 //定义PC1下行的类,并绑定访问列表101
Switch(config-cmap)# exit
Switch(config)#> Switch(config-cmap)# match access-group 102 //定义PC2下行的类,并绑定访问列表102
Switch(config-cmap)# exit
4、定义策略,把上面定义的类绑定到该策略
Switch(config)# policy-map user1-up //定义PC1上行的速率为1M,超过的丢弃
Switch(config-pmap)#> Switch(config-pmap-c)# trust dscp
Switch(config-pmap-c)# police 1000000 1000000 exceed-action drop
Switch(config)# policy-map user2-up //定义PC2上行的速率为2M ,超过丢弃
Switch(config-pmap)#> Switch(config-pmap-c)# trust dscp
Switch(config-pmap-c)# police 2000000 2000000 exceed-action drop
Switch(config)# policy-map user-down
Switch(config-pmap)#> Switch(config-pmap-c)# trust dscp
Switch(config-pmap-c)# police 1000000 1000000 exceed-action drop
Switch(config-pmap-c)# exit
Switch(config-pmap)#> Switch(config-pmap-c)# trust dscp
Switch(config-pmap-c)# police 2000000 2000000 exceed-action drop
Switch(config-pmap-c)# exit
5、在接口上运用策略
Switch(config)# interface f0/1
Switch(config-if)# service-policy input user1-up
Switch(config)# interface f0/2
Switch(config-if)# service-policy input user2-up
Switch(config)# interface g0/1
Switch(config-if)# service-policy input user-down
S132_BJ_L01(config)#interface gigabitEthernet 0/13
S132_BJ_L01(config-if)#switchport port-security maximum 5 最大的连接数
S132_BJ_L01(config-if)#switchport port-security mac-address 0022.a105.bbd7 Mac地址绑定
简单的cisco 交换机telnet 地址限制
(config)#ip access-list extended telnet
(config-ext-nacl)#10 permit ip host X.X.X.X any
(config-ext-nacl)#20 permit ip host X.X.X.X any
(config-ext-nacl)#exit
(config)#line vty 0 15
(config-line)#access-class telnet in
(config-line)#exit
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com