一、交换机堆叠配置信息
上架连线前预配置:
第一台
*********(config)# host name C3750-1
C3750-1(config)#switch 1 renumber 1 (前1是默认堆叠后的编号,后1是更改为1,此命令是更改member编号,默认为1)
C3750-1(config)#switch 1 priority 8 (交换机member编号1的设备优先级改为8 ,最高15,越大成为master主设备)
C3750-1(config)#end
C3750-1#reload slot 1 (重启交换机堆叠端口 1 ,此1代表上方命名的1)
C3750-1#wr copy run star(保存配置)
第二台
*********(config)# host name C3750-2
C3750-2#conf t
C3750-2(config)#switch 1 renumber 2 (默认为1,更改为2,依次增加)
C3750-2(config)#switch 2 priority 7 (堆叠设备2的优先级为7,依次减少)
C3750-2(config)#end
C3750-2#reload slot 2 (重启交换机堆叠端口 2 ,此2代表上方命名的2)
C3750-2#wr copy run star(保存配置)
其余交换机依次进行预配置,保存后上架在交换机背部用专用的堆叠线进行环形连接。
增:
按上方预配好命令,断电设备接入堆叠线,再开机。
删:
先断电再拔线,然后删配置
Switch (config)#no switch 2 provision (删除交换机2,即上方switch3750-2)
改:
Switch#reload slot 2 (重启堆叠组中的交换机2,即上方switc3750-2)
查:
Switch#show switch detail (查看堆叠交换机组信息以及是否正常,ok代表正常)
二、交换机ssh、telnet、time、log开局配置
clock timezone UTC 8 0
logging buffered 200000 日志缓存数量
login on-success log 用户登陆日志
ip dhcp snooping 开启dhcp snooping
ip dhcp snooping vlan 10, 20 vlan开启dhcp snooping
spanning-tree mode rapid-pvst 开启生成树
spanning-tree extend system-id
ip http server 开启http登陆服务
spanning-tree portfast 快速端口,不参与生成树,上联口不可用,hub不能用,谨慎使用小心成 环。配合下面这条命令使用。
spanning-tree bpduguard enable 接口上启用BPDB Guard功能 ,端口收到环路会shutdown。
errdisable recovery cause ? 如果上面两条命令出现环路shutdown了,首先解决环路的线路, 然后使用该命令?后的对应提示选择命令恢复端口
console登录配置:
Switch(config)#line console 0
Switch(config-line)#exec-timeout 0 0 超时时间0 (即不超时)
Switch(config-line)#privilege level 15 权限等级
Switch(config-line)#password ***** console口登录密码
Switch(config-line)#logging synchronous 日志同步
Switch(config-line)#login 激活登录动作
Switch(config-line)#exit
Telnet远程登陆一:
Switch(config)#password encryption aes 配置加密方式
Switch(config)#username *** secret ****** 用户名及密码
Switch(config)#username *** privilege 15 用户权限级别
Switch(config)#line vty 0 4 进入vty视图
Switch(config-line)#login local 调用本地登陆信息
Switch(config-line)#exit
Telnet远程登陆二:
Switch(config)#enable password ***** enable密码
Switch(config)#line vty 0 4
Switch(config-line)#password ****** 密码
Switch(config-line)#login
Switch(config-line)#exit
SSH远程登陆配置:
Switch(config)#ip domain-name cisco 配置域名
Switch(config)#crypto key generate rsa 生成RSA密钥对
The name for the keys will be: Switch.cisco
Choose the size of the key modulus in the range of 360 to 4096 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]:
% Generating 512 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 0 seconds)
Switch(config)#aaa new-model 启用3A认证
Switch(config)#line vty 04 进入vty试图
Switch(config-line)#username *** secret *****
Switch(config)#line vty 0 4
Switch(config-line)#transport input ssh telnet
Switch(config-line)#exec-timeout 15 0
Switch(config-line)#exit
Switch(config)#ip ssh time-out 120 超时时间
Switch(config)#ip ssh authentication-retries 3 重认证次数
Switch(config)#ip ssh version 2 协议版本
最后保存配置:
Switch#wr
Switch#copy running-config startup-config
Switch#
删除配置:
Switch#erase startup-config 方法1
Switch#delete nvram:startup-config 方法2
开局完成!
三、PBR策略路由配置
Switch(config)#access-list 100 permit ip 172.21.251.0 0.0.0.255 any ACL名单抓取ip地址段
Switch(config)#route-map name permit 10 创建策略路由名字为 name
Switch(config-route-map)#match ip address 100 抓取access list名单100的 IP段
Switch(config-route-map)#set ip next-hop 172.16.1.1 下一条出口地址
Switch(config)#interface vlan 251 将策略路由挂接到vlan或者端口下
Switch(config-if)#ip policy route-map name
interface Vlan251
ip address 172.18.232.254 255.255.255.0
ip helper-address 172.18.14.205
ip policy route-map name
本文详细介绍了如何配置思科交换机,包括堆叠配置,如交换机命名、优先级设置、重启与保存;SSH、telnet、时间设置和日志配置;以及PBR策略路由配置,包括ACL、路由映射和接口应用。通过这些步骤,可以有效管理和保护网络设备。
4262

被折叠的 条评论
为什么被折叠?



