Cisco交换机基本配置

Lear 2024-08-30 14:00:00
Categories: Tags:

Cisco交换机基本配置

enable
configure terminal
interface vlan 1
ip address 192.168.1.1 255.255.255.0
no shutdown

enable
configure terminal
ip default-gateway 192.168.1.254

enable
configure terminal
ip route 0.0.0.0 0.0.0.0 192.168.1.253

enable
configure terminal
line console 0
password cisco
login

enable
configure terminal
line vty 0 4
exec-timeout 5 0 #空闲超时时间设置为5分钟0秒
login
password cisco

enable
configure terminal
enable secret cisco

SC-2950(config)#int range f0/2 - 15
SC-2950(config-if-range)#sw mode access
SC-2950(config-if-range)#sw access vlan 20
SC-2950(config-if-range)#no sh
SC-2950(config-if-range)#exit

enable
configure terminal
int f0/13
switch mode trunk
switchport trunk encapsulation dot1q
switchport trunk allowed vlan all #switchport trunk allowed vlan 10,20

enable
configure terminal
int f0/14
switch mode access
switchport access vlan 10

interface Port-channel1 #三层逻辑接口配置
description port(1/0/5-6)
ip address 192.168.1.254 255.255.255.0
!
interface GigabitEthernet1/0/5 #interface range gigabitEthernet 1/0/5 - 6 #同时配置多个端口
description Port-channel-1
no switchport
no ip address
channel-group 1 mode desirable

interface Port-channel1
description port(1/0/5-6)
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 10
!
interface GigabitEthernet1/0/5 #interface range gigabitEthernet 1/0/5-6 #同时配置多个端口
description Port-channel-1
switchport mode trunk
switchport trunk encapsulation dot1q
channel-group 1 mode on
!
interface GigabitEthernet1/0/6
description Port-channel-1
switchport mode trunk
switchport trunk encapsulation dot1q
channel-group 1 mode on

router#copy running-config startup-config ;保存配置
router#copy running-config tftp ;保存配置到tftp

router#copy startup-config tftp ;开机配置存到tftp
router#copy tftp flash: ;下传文件到flash
router#copy tftp startup-config ;下载配置文件
ROM 状态:
Ctrl+Break ;进入ROM 监控状态
rommon>confreg 0x2142 ;跳过配置文件
rommon>confreg 0x2102 ;恢复配置文件
rommon>reset ;重新引导
rommon>copy xmodem: flash: ;从console 传输文件

show version 查看交换机版本信息
show ip interfaces 查看交换机的ip 地址
show interface vlan 1 验证管理ip 地址已经配置并开启
show ip redirect 查看交换机的网关
show running-configure 查看交换机当前的配置信息
show configure 查看交换机保存的配置信息
switch#write ; 保存配置信息
switch#show vtp ; 查看vtp 配置信息
switch#show run ; 查看当前配置信息
switch#show vlan ; 查看vlan 配置信息
switch#show interface ; 查看端口信息
switch#show int f0/0 ; 查看指定端口信息
Switch#show run ;显示所有配置命令
Switch#show ip int brief ;显示所有接口状态
Switch#show vlan brief ;显示所有VLAN 的信息
Switch#show vlan

确认Po1状态正常 
#sh etherchannel summary
Flags: D - down P - bundled in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
M - not in use, minimum links not met
u - unsuitable for bundling
w - waiting to be aggregated
d - default port

Number of channel-groups in use: 2
Number of aggregators: 2
Group Port-channel Protocol Ports
——+————-+———–+———————————————–
1 Po1(SU) LACP Gi0/22(P) Gi0/23(P) ←显示状态正常

port-channel有几种负载模式
port-channel load-balance ?
dst-ip Dst IP Addr
dst-mac Dst Mac Addr
dst-port Dst TCP/UDP Port
src-dst-ip Src XOR Dst IP Addr
src-dst-mac Src XOR Dst Mac Addr
src-dst-port Src XOR Dst TCP/UDP Port
src-ip Src IP Addr
src-mac Src Mac Addr
src-port Src TCP/UDP Port