1 基础配置 1.1 建立到控制台的连接
在进行配置和将交换机接入网络前必须通过控制台来进入交换机的CLI,对交换机进行配置。在进入CLI后,通过命令enable 进入到 privileged 模式。
通过以下步骤将终端连接到交换机的控制口
<... output truncated ...>
Cisco Systems Console
Enter password:
Console> enable
Enter password:
Console> (enable) 1.2 配置交换机的地址
在远程登录交换机前你必须为交换机配置地址,掩码和网关等信息
在你第一次配置交换机时,将sc0口配置到default VLAN,即VLAN 1中,在你配置了其他VLAN以后,你可以将sc0口配置到其他VLAN中,但是sc0口的地址和网关必须与所在的VLAN的网段对应.
配置IP地址和网关的步骤如下
例如:
Console> (enable) set interface sc0 10.1.1.50/255.0.0.0
Interface sc0 IP address and netmask set.
Console> (enable) set interface sc0 100
Interface sc0 vlan set.
Console> (enable) set ip route default 10.1.1.1
Route added.
Console> (enable) show interface
sl0: flags=51<UP,POINTOPOINT,RUNNING>
slip 0.0.0.0 dest 0.0.0.0
sc0: flags=63<UP,BROADCAST,RUNNING>
vlan 100 inet 10.1.1.50 netmask 255.0.0.0 broadcast 10.255.255.255
Console> (enable) show ip route
Fragmentation Redirect Unreachable
------------- -------- -----------
enabled enabled enabled
Destination Gateway Flags Use Interface
----------------------- ----------------------- ------ ---------- ---------
default 10.1.1.1 UG 0 sc0
10.0.0.0 10.1.1.50 U 0 sc0
default default UH 0 sl0
Console> (enable) ping 10.1.1.100
10.1.1.100 is alive
Console> (enable) 1.3 配置 Ethernet 口
在一条连路两端的Ethernet, Fast Ethernet和 Gigabit Ethernet 口的端口速率了工作方式必须相同。Ethernet 和Fast Ethernet 会自动配置工作方式,10/100-Mbps Fast Ethernet 口可以自动检测连路速率。. Gigabit Ethernet总是在 full duplex方式下工作。
配置步骤如下
例如:
Console> (enable) set port speed 2/12 auto
Port 2/12 speed set to auto detect.
Console> (enable) set port name 2/12 NT Server 12
Port 2/12 name set.
Console> (enable) show port 2/12
Port Name Status Vlan Level Duplex Speed Type
----- ------------------ ---------- ---------- ------ ------ ----- ------------
2/12 NT Server 12 connect 1 normal a-half a-100 10/100BaseTX
<... output truncated ...>
Console> (enable) 1.4 配置交换机的全局参数
配置步骤和命令如下:
例如:
Console> (enable) set system name Catalyst 6000
System name set.
Catalyst 6000> (enable) set time 08/18/98 10:08:00
Sat Apr 18 1998, 10:08:00
Catalyst 6000> (enable) set password
Enter old password:
Enter new password:
Retype new password:
Password changed.
Catalyst 6000> (enable) set enablepass
Enter old password:
Enter new password:
Retype new password:
Password changed.
Catalyst 6000> (enable) 1.5 测试网络的连通性
在你配置了交换机的地址和网关以后,你就可以与网络上的其它节点连通了。
测试方法如下:
Ping和traceroute 的例子如下
Console> (enable) ping -s 172.20.52.20 1200 4
PING 172.20.52.20: 1200 data bytes
1208 bytes from 172.20.52.20: icmp_seq=0. time=6 ms
1208 bytes from 172.20.52.20: icmp_seq=1. time=6 ms
1208 bytes from 172.20.52.20: icmp_seq=2. time=6 ms
1208 bytes from 172.20.52.20: icmp_seq=3. time=5 ms
----172.20.52.20 PING Statistics----
4 packets transmitted, 4 packets received, 0% packet loss
round-trip (ms) min/avg/max = 5/5/6
Console> (enable) traceroute 172.20.52.20 1400
traceroute to 172.20.52.20 (172.20.52.20), 30 hops max, 1440 byte packets
1 172.20.52.33 (172.20.52.33) 2 ms 3 ms 1 ms
2 172.20.52.20 (172.20.52.20) 4 ms * 4 ms
Console> (enable) 2 其它参数的配置 2.1 配置 Login Banner
login banner或 message of the day是在你登陆到交换机时出现在屏幕上的提示信息,最多可以配置255 个字符。
配置步骤:
例如: (通过控制口):
Console> (enable) set banner motd *Catalyst 6000
Software Release 5.4(1)
IP address 10.1.1.20
*
MOTD banner set
Console> (enable) exit
Cisco Systems Console
Catalyst 6000
Software Release 5.4(1)
IP address 10.1.1.20
Enter password: 2.2 配置 DNS
步骤:
例如:
Console> (enable) set ip dns server 10.1.1.100 primary
10.1.1.100 added to DNS server table as primary server.
Console> (enable) set ip dns server 10.1.1.122
10.1.1.122 added to DNS server table as backup server.
Console> (enable) set ip dns domain bigcorp.com
Default DNS domain name set to bigcorp.com
Console> (enable) set ip dns enable
DNS is enabled
Console> (enable) show ip dns
DNS is currently enabled.
The default DNS domain name is: bigcorp.com
DNS name server status
---------------------------------------- -------
10.1.1.100 primary
10.1.1.122
Console> (enable) 2.3 配置 CDP协议
Cisco Discovery Protocol (CDP) 是一种协议和介质无关的协议。它可以运行与所有CISCO设备上,它可以发现网络上相邻的其他CISCO设备的信息。
为了配置CDP,在特权模式下执行下面的步骤:
例如:
Console> (enable) set cdp enable
CDP enabled for all ports.
Console> (enable) set cdp interval 100
CDP message interval set to 100 seconds for all ports.
Console> (enable) show cdp port
Port CDP Status Message-Interval
-------- ---------- ----------------
1/1 enabled 100
1/2 enabled 100
2/1 enabled 100
Console> (enable) show cdp neighbors
* - indicates vlan mismatch.
# - indicates duplex mismatch.
Port Device-ID Port-ID Platform
-------- ------------------------------- ------------------------- ------------
3/5 002267619(cat1.cisco.com) 3/6 * WS-C5000
3/6 002267619(cat1.cisco.com) 3/5 WS-C5000
4/1 002267619(cat1.cisco.com) 4/2 WS-C5000
4/2 002267619(cat1.cisco.com) 4/1 # WS-C5000
4/20 069000057(cat2.cisco.com) 8/5 WS-C5500
5/1 005763872(cat3.cisco.com) 2/1 WS-C5000
5/1 066506245(cat4.cisco.com) 2/1 WS-C5505
5/1 066508595(cat5.cisco.com) 5/12 *# WS-C5505
5/1 066508596(cat6.cisco.com) 5/1 WS-C5505
Console> (enable) 3 VLAN的配置
在 Catalyst 6500 系列交换机上配置VLAN要经过如下步骤:
Step 2 配置 VLANs—在VTP域中创建VLAN将交换机的端口配置到VLAN中.
Step 3 配置 VLAN Trunks---配置在多个VLAN间进行流量交换的的端口。 3.1 配置VTP协议(VLAN Trunk Protocol)
在你配置一台交换机为VTP server时,你必须先定义一个 VTP域,才能建立VLAN.
步骤:
例如:
Console> (enable) set vtp domain BigCorp
VTP domain BigCorp modified
Console> (enable) set vtp mode server
VTP domain BigCorp modified
Console> (enable) show vtp domain
Domain Name Domain Index VTP Version Local Mode Password
-------------------------------- ------------ ----------- ----------- ----------
BigCorp 1 2 server -
Vlan-count Max-vlan-storage Config Revision Notifications
---------- ---------------- --------------- -------------
9 1023 0 enabled
Last Updater V2 Mode Pruning PruneEligible on Vlans
--------------- -------- -------- -------------------------
172.20.52.40 disabled disabled 2-1000
Console> (enable)
3.2 配置 VLAN
3.2.1 创建 VLAN
例如:
Console> (enable) set vlan 100 name Pubs
Vlan 100 configuration successful
Console> (enable) show vlan 100
VLAN Name Status Mod/Ports, Vlans
---- -------------------------------- --------- ----------------------------
100 Pubs active
VLAN Type SAID MTU Parent RingNo BrdgNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ ------ ---- -------- ------ ------
100 enet 100100 1500 - - - - - 0 0
VLAN AREHops STEHops Backup CRF
---- ------- ------- ----------
Console> (enable) 3.3 将交换端口配置到VLAN中
配置方法:
例如:
Console> (enable) set vlan 100 2/1-4
VLAN 100 modified.
VLAN 1 modified.
VLAN Mod/Ports
---- -----------------------
100 2/1-4
Console> (enable) show vlan 100
VLAN Name Status Mod/Ports, Vlans
---- -------------------------------- --------- ----------------------------
100 Pubs active 2/1-4
VLAN Type SAID MTU Parent RingNo BrdgNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ ------ ---- -------- ------ ------
100 enet 100100 1500 - - - - - 0 0
VLAN AREHops STEHops Backup CRF
---- ------- ------- ----------
Console> (enable) show port 2
Port Name Status Vlan Level Duplex Speed Type
----- ------------------ ---------- ---------- ------ ------ ----- ------------
2/1 notconnect 100 normal half 100 100BaseTX
2/2 notconnect 100 normal half 100 100BaseTX
2/3 notconnect 100 normal half 100 100BaseTX
2/4 notconnect 100 normal half 100 100BaseTX
2/5 notconnect 1 normal half 100 100BaseTX
<... output truncated ...>
Console> (enable) 3.4 配置 VLAN Trunks
VLAN trunks 是一个点到点的连接,它可以使不同VLAN之间进行通信。所有的Ethernet 口可以使用Inter-Switch Link (ISL) 或 IEEE 802.1Q 的TRUNK封装。缺省的,如果一个端口设置成negotiate就会试图采用ISL封装。.
如果两个相连的端口,一端设置为desirable 或 on,另一端配置为 auto ,那么它就会自动成为TRUNK.
配置步骤:
例如: (假设连路的另外一端配置为auto):
Console> (enable) set trunk 1/2 desirable
Port(s) 1/2 trunk mode set to desirable.
Console> (enable) 07/22/1998,10:16:58:DTP-5:Port 1/2 has become isl trunk
07/22/1998,10:16:58:PAGP-5:Port 1/2 left bridge port 1/2.
07/22/1998,10:17:09:PAGP-5:Port 1/2 joined bridge port 1/2.
Console> (enable) show trunk 1/2
Port Mode Encapsulation Status Native vlan
-------- ----------- ------------- ------------ -----------
1/2 desirable isl trunking 523
Port Vlans allowed on trunk
-------- ---------------------------------------------------------------------
1/2 1-1005
Port Vlans allowed and active in management domain
-------- ---------------------------------------------------------------------
1/2 1,10,105,152,521-524
Port Vlans in spanning tree forwarding state and not pruned
-------- ---------------------------------------------------------------------
1/2 1,10,105,152,521-524
Console> (enable) 3.5 在MSFC上配置IP InterVLAN路由 3.5.1 从Console口进入MSFC
我们可以通过switch console直接从supervisor engine的控制口进入MSFC 模块的CLI,离开MSFC时键入^C^C^C 。
命令格式:
注: 要进入备用的MSFC,将CONSOLE线连到备用的交换处理模块上.
例如:
Console> (enable) switch console 15
Trying Router-15...
Connected to Router-15.
Type ^C^C^C to switch back...
Router>^C^C^C
Console> (enable) 3.5.2 通过Telnet Session 进入MSFC 模块
我们可以通过 session mod_num 命令进入到MSFC 的CLI界面。离开CLI使用 exit 命令。
例如:
Console> (enable) session 15
Router> exit
Console> (enable) 3.5.3 在MSFC上配置IP InterVLAN路由
为了使VLAN之间能够相互通讯,我们必须为每个我们需要与外界通讯的VLAN配置 IP InterVLAN 路由。配置步骤如下(假设已经在交换几上进行了前面的配置):
例如:
Router# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)# ip routing
Router(config)# interface vlan 100
Router(config-if)# ip address 10.1.1.1 255.0.0.0
Router(config-if)# ^Z
Router# 3.6 配置HSRP协议
我们可以通过在MSFC VLAN端口上上配置一个或多个HSRP 组来提供自动路由备份。同一组中的所有VLAN 端口在公用一个虚拟的MAC和IP地址。我们将节点的网关配置为HSRP地址,这样当这个组中的任何一端口DOWN掉时,都不会影响这些节点的正常使用。同一组中,端口的HSRP的优先级高的端口是活动端口。
配置步骤:
例如:单个交换机上配有双Supervisor Engines 和 MSFC。
Console> (enable) switch console 15
Trying Router-15...
Connected to Router-15.
Type ^C^C^C to switch back...
Router# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)# interface vlan10
Router(config-if)# standby 10 ip 172.20.100.10
Router(config-if)# standby 10 priority 110
Router(config-if)# standby 10 preempt
Router(config-if)# standby 10 timers 5 15
Router(config-if)# standby 10 authentication Secret
Router(config-if)# interface vlan21
Router(config-if)# standby 21 ip 192.20.100.21
Router(config-if)# standby 21 priority 109
Router(config-if)# standby 21 preempt
Router(config-if)# standby 21 timers 5 15
Router(config-if)# standby 21 authentication Secret
Router(config-if)# ^Z
Router# ^C^C^C
Console> (enable) switch console 16
Trying Router-16...
Connected to Router-16.
Type ^C^C^C to switch back...
Router# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)# interface vlan10
Router(config-if)# standby 10 ip 172.20.100.10
Router(config-if)# standby 10 priority 109
Router(config-if)# standby 10 preempt
Router(config-if)# standby 10 timers 5 15
Router(config-if)# standby 10 authentication Secret
Router(config-if)# interface vlan21
Router(config-if)# standby 21 ip 172.20.100.21
Router(config-if)# standby 21 priority 110
Router(config-if)# standby 21 preempt
Router(config-if)# standby 21 timers 5 15
Router(config-if)# standby 21 authentication Secret
Router(config-if)# ^Z
Router# ^C^C^C 3.7 配置以太通道
以太通道将多个单独的以太链路绑定成一个逻辑的链路,以此在6000系列交换机和另外一台交换机或主机之间提供1600Mbps(全双工快速以太通道)或16Gbps(千兆以太通道)的速率。
一台6000系列的交换机最多支持128个通道。你可以在一台6000系列的交换机的任何一个模块上最多将8个兼容的以太口绑定成一个以太通道。每个通道中的所有端口速率必须是一样的。
如果配置不当,一些以太通道端口为了避免网络循环或其它一些问题将自动disable。为了避免错误,请按下面的提示进行配置:
l 将一个以太通道中的所有端口分配到同一个VLAN中,或将它们配置成干道端口。
l 如果你将以太端口配置成干道,则在以太通道的所有端口上配置相同的干道模式。
l 在干道以太通道中,以太通道在所有的端口上支持相同的VLAN范围。如果每个端口所允许的VLAN范围不一样,即使用命令set port channel的参数是auto或 desirable,这些端口也不会形成以太通道。
l 不要将以太通道中的端口配置成动态VLAN端口。
l 将一个以太通道中的所有端口配置成相同的速率和双工模式。
l 如果端口的安全特性打开,以太通道则不会形成。
l 如果一个端口是SPAN的destination端口,则以太通道不会形成。
l 如果端口上设置了不同的协议过滤,则以太通道不会形成。
l 激活以太通道中的所有端口。如果你“disable”了以太通道中的一个端口,将被认为是这条链路失败了,流量将通过通道中的其它端口进行传输。
配置以太通道
在特权模式下,执行:
set port channel mod/ports... [admin_group]
set port channel mod_num/port_num mode {on | off | desirable | auto} [silent | non-silent] 下面的例子演示了如何将将一个7端口的以太通道配置在一个新的管理组里:
Console> (enable) set port channel 2/2-8 desirable
Ports 2/2-8 left admin_group 1.
Ports 2/2-8 joined admin_group 2.
Console> (enable)
要设置一个端口的以太通道模式,在特权命令下执行下面的步骤:
set port channel mod/ports... [admin_group]
set port channel mod_num/port_num mode {on | off | desirable | auto} [silent | non-silent] 下面的例子演示了如何将端口2/1设置成auto模式:
Console> (enable) set port channel 2/1 mode auto
Ports 2/1 channel mode set to auto.
Console> (enable)
设置以太通道端口路径开销
为了设置以太通道端口路径开销,请在特权模式下执行下面的步骤:
下面的例子演示了如何为通道ID 768设置以太通道端口开销: Console> (enable) show channel group 20 Admin Port Status Channel Channel group Mode id ----- ----- ---------- --------- -------- 20 1/1 notconnect on 768 20 1/2 connected on 768 Admin Port Device-ID Port-ID Platform group ----- ----- ------------------------------- ------------------------- ---------- 20 1/1 20 1/2 066510644(cat26-lnf(NET25)) 2/1 WS-C6009 Console> (enable) Console> (enable) set channel cost 768 12 Port(s) 1/1,1/2 port path cost are updated to 31. Channel 768 cost is set to 12. Warning:channel cost may not be applicable if channel is broken. Console> (enable)
设置以太通道VLAN开销
在特权模式下执行:
下面的例子演示了如何为通道ID768设置以太通道VLAN开销 Console> (enable) show channel group 20 Admin Port Status Channel Channel group Mode id ----- ----- ---------- --------- -------- 20 1/1 notconnect on 768 20 1/2 connected on 768 Admin Port Device-ID Port-ID Platform group ----- ----- ------------------------------- ------------------------- ---------- 20 1/1 20 1/2 066510644(cat26-lnf(NET25)) 2/1 WS-C6009 Console> (enable) Console> (enable) set channel vlancost 768 12 Channel 768 vlancost set to 12. Console> (enable)
要配置以太通道帧分布,在特权模式下执行:
set port channel all distribution {ip | mac} [source | destination | both]
下面的例子演示了如何利用MAC源地址配置以太通道: Console> (enable) set port channel all distribution mac source Channel distribution is set to mac source. Console> (enable)
要禁止以太通道,在特权模式下执行:
set port channel mod_num/port_num mode off
下面的例子演示了如何禁止以太通道: Console> (enable) set port channel 2/2-8 mode off Ports 2/2-8 channel mode set to off. Console> (enable) |
|