一定会有光的!
一定~
--孙策
实验拓扑图如下:
先放置八台个人电脑,两台交换机
PC1~4的接口F0按顺序依次用直通线连接交换机1的Fa0/1~4接口
交换机1的Fa0/5接口和2的Fa0/5接口用双绞线相连接
PC5~8的接口F0按顺序依次用直通线连接交换机2的Fa0/1~4接口
(小技巧:将重要信息简短标注可以大大提高正确率,节省宝贵时间)
PC1:
IP Address:192.168.1.1
Subnet Mask:255.255.255.0
Default Gateway:192.168.1.254
PC2:
IP Address:192.168.1.2
Subnet Mask:255.255.255.0
Default Gateway:192.168.1.254
PC3:
IP Address:192.168.2.1
Subnet Mask:255.255.255.0
Default Gateway:192.168.2.254
PC4:
IP Address:192.168.2.2
Subnet Mask:255.255.255.0
Default Gateway:192.168.2.254
PC5:
IP Address:192.168.3.1
Subnet Mask:255.255.255.0
Default Gateway:192.168.3.254
PC6:
IP Address:192.168.3.2
Subnet Mask:255.255.255.0
Default Gateway:192.168.3.254
PC7:
IP Address:192.168.4.1
Subnet Mask:255.255.255.0
Default Gateway:192.168.4.254
PC8:
IP Address:192.168.4.2
Subnet Mask:255.255.255.0
Default Gateway:192.168.4.254
现在我们PC1 ping PC8,不通过
输入:en
进入特权模式
输入:conf t
进入全局配置模式
输入:ho Liu_anxia
将交换机改名为Liu_anxia
输入:vl 2
创建vl 2
输入:vl 3
创建vl 3
输入:vl 6
创建vl 6
输入:exit
退出vlan配置模式
输入:in r f0/1-2
进入f0/1-2系列的接口配置模式
输入:sw mo ac(switchport mode access简写)
将这部分管理的设备设置为接入模式
输入:sw ac vl 2
将f0/1-2的接口划分到vl 2中
输入:exit
退出f0/1-2的配置模式
输入:in r f0/3-4
进入f0/3-4系列接口的配置模式
输入:sw mo ac
将这管理这部分接口的交换机设置为接入模式
输入:sw ac vl 3
将这部分接口划分到vl 3中
输入:exit
退出该系列接口的配置模式
输入:in f0/5
进入f0/5配置模式
输入:sw mo ac
将管理f0/5的交换机设置为接入模式
输入:sw ac vl 6
将f0/5接口划分到vl 6中
输入:end
退回到特权模式
输入:sh vl
查看端口的分配情况
输入:in vl 2
进入vl 2配置模式
输入:ip ad 192.168.1.254 255.255.255.0
配置vl 2的IP地址为:192.168.1.254
输入:exit
退出vl 2的配置模式
输入:in vl 3
进入:vl 3的配置模式
输入: ip ad 192.168.2.254 255.255.255.0
设置vl 3的IP地址为:192.168.2.254
输入:in vl 6
进入vl 6的配置模式
输入:ip ad 192.168.5.1 255.255.255.0
配置交换机1中的vl 6的IP地址为:192.168.5.1
输入:exit
退出vl 6的配置模式
输入:ip routing
启动三层路由功能
输入:router rip
启用rip协议
输入:network 192.168.1.0
输入:network 192.168.2.0
输入:network 192.168.5.0
将这几个地址添加到rip协议中
输入:end
退回到特权模式
输入:sh ip ro
查看该设备全部的路由信息
输入:wr
保存刚刚配置
实战如下:
network 中:192.168.5.0配置错误了,所以又重新写入覆盖掉了错误的:network 192.168.3.0
- Switch>
- Switch>en
- Switch#conf t
- Enter configuration commands, one per line. End with CNTL/Z.
- Switch(config)#ho Liu_anxia
- Liu_anxia(config)#vl 2
- Liu_anxia(config-vlan)#vl 3
- Liu_anxia(config-vlan)#vl 6
- Liu_anxia(config-vlan)#exit
- Liu_anxia(config)#in r f0/1-2
- Liu_anxia(config-if-range)#sw mo ac
- Liu_anxia(config-if-range)#sw ac vl 2
- Liu_anxia(config-if-range)#exit
- Liu_anxia(config)#in r f0/3-4
- Liu_anxia(config-if-range)#sw mo ac
- Liu_anxia(config-if-range)#sw ac vl 3
- Liu_anxia(config-if-range)#exit
- Liu_anxia(config)#in f0/5
- Liu_anxia(config-if)#sw mo ac
- Liu_anxia(config-if)#sw ac vl 6
- Liu_anxia(config-if)#end
- Liu_anxia#
- %SYS-5-CONFIG_I: Configured from console by console
-
- Liu_anxia#sh vl
-
- VLAN Name Status Ports
- ---- -------------------------------- --------- -------------------------------
- 1 default active Fa0/6, Fa0/7, Fa0/8, Fa0/9
- Fa0/10, Fa0/11, Fa0/12, Fa0/13
- Fa0/14, Fa0/15, Fa0/16, Fa0/17
- Fa0/18, Fa0/19, Fa0/20, Fa0/21
- Fa0/22, Fa0/23, Fa0/24, Gig0/1
- Gig0/2
- 2 VLAN0002 active Fa0/1, Fa0/2
- 3 VLAN0003 active Fa0/3, Fa0/4
- 6 VLAN0006 active Fa0/5
- 1002 fddi-default act/unsup
- 1003 token-ring-default act/unsup
- 1004 fddinet-default act/unsup
- 1005 trnet-default act/unsup
-
- VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
- ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
- 1 enet 100001 1500 - - - - - 0 0
- 2 enet 100002 1500 - - - - - 0 0
- 3 enet 100003 1500 - - - - - 0 0
- 6 enet 100006 1500 - - - - - 0 0
- 1002 fddi 101002 1500 - - - - - 0 0
- 1003 tr 101003 1500 - - - - - 0 0
- 1004 fdnet 101004 1500 - - - ieee - 0 0
- 1005 trnet 101005 1500 - - - ibm - 0 0
-
- Remote SPAN VLANs
- ------------------------------------------------------------------------------
-
-
- Primary Secondary Type Ports
- ------- --------- ----------------- ------------------------------------------
- Liu_anxia#
- Liu_anxia#
- Liu_anxia#conf t
- Enter configuration commands, one per line. End with CNTL/Z.
- Liu_anxia(config)#in vl 2
- Liu_anxia(config-if)#
- %LINK-5-CHANGED: Interface Vlan2, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up
-
- Liu_anxia(config-if)#ip ad 192.168.1.254 255.255.255.0
- Liu_anxia(config-if)#exit
- Liu_anxia(config)#in vl 3
- Liu_anxia(config-if)#
- %LINK-5-CHANGED: Interface Vlan3, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up
-
- Liu_anxia(config-if)#ip ad 192.168.2.254 255.255.255.0
- Liu_anxia(config-if)#exit
- Liu_anxia(config)#in vl 6
- Liu_anxia(config-if)#
- %LINK-5-CHANGED: Interface Vlan6, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan6, changed state to up
-
- Liu_anxia(config-if)#ip ad 192.168.5.1 255.255.255.0
- Liu_anxia(config-if)#exit
- Liu_anxia(config)#ip routing
- Liu_anxia(config)#router rip
- Liu_anxia(config-router)#network 192.168.1.0
- Liu_anxia(config-router)#network 192.168.2.0
- Liu_anxia(config-router)#network 192.168.3.0
- Liu_anxia(config-router)#end
- Liu_anxia#
- %SYS-5-CONFIG_I: Configured from console by console
-
- Liu_anxia#sh ip ro
- Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
- D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
- N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
- E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
- i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
- * - candidate default, U - per-user static route, o - ODR
- P - periodic downloaded static route
-
- Gateway of last resort is not set
-
- C 192.168.1.0/24 is directly connected, Vlan2
- C 192.168.2.0/24 is directly connected, Vlan3
- C 192.168.5.0/24 is directly connected, Vlan6
- Liu_anxia#sh ip ro
- Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
- D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
- N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
- E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
- i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
- * - candidate default, U - per-user static route, o - ODR
- P - periodic downloaded static route
-
- Gateway of last resort is not set
-
- C 192.168.1.0/24 is directly connected, Vlan2
- C 192.168.2.0/24 is directly connected, Vlan3
- C 192.168.5.0/24 is directly connected, Vlan6
- Liu_anxia#wr
- Building configuration...
- [OK]
- Liu_anxia#sh ip ro
- Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
- D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
- N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
- E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
- i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
- * - candidate default, U - per-user static route, o - ODR
- P - periodic downloaded static route
-
- Gateway of last resort is not set
-
- C 192.168.1.0/24 is directly connected, Vlan2
- C 192.168.2.0/24 is directly connected, Vlan3
- C 192.168.5.0/24 is directly connected, Vlan6
- Liu_anxia#ip routing
- ^
- % Invalid input detected at '^' marker.
-
- Liu_anxia#conf t
- Enter configuration commands, one per line. End with CNTL/Z.
- Liu_anxia(config)#ip routing
- Liu_anxia(config)#router rip
- Liu_anxia(config-router)#network 192.168.1.0
- Liu_anxia(config-router)#network 192.168.2.0
- Liu_anxia(config-router)#network 192.168.5.0
- Liu_anxia(config-router)#end
- Liu_anxia#
- %SYS-5-CONFIG_I: Configured from console by console
-
- Liu_anxia#sh ip ro
- Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
- D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
- N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
- E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
- i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
- * - candidate default, U - per-user static route, o - ODR
- P - periodic downloaded static route
-
- Gateway of last resort is not set
-
- C 192.168.1.0/24 is directly connected, Vlan2
- C 192.168.2.0/24 is directly connected, Vlan3
- R 192.168.3.0/24 [120/1] via 192.168.5.2, 00:00:01, Vlan6
- R 192.168.4.0/24 [120/1] via 192.168.5.2, 00:00:01, Vlan6
- C 192.168.5.0/24 is directly connected, Vlan6
- Liu_anxia#
-
-
-
-
-
-
-
-
- Liu_anxia con0 is now available
-
-
-
-
-
-
- Press RETURN to get started.
-
-
-
-
-
-
-
-
-
-
-
输入:en
进入特权模式
输入:conf t
进入全局配置模式
输入:vl 4
创建vl 4
输入:vl 5
创建vl 5
输入:vl 6
创建vl 6
输入:exit
退出vlan配置模式
输入:in r f0/1-2
进入f0/1-2系列的接口配置模式
输入:sw mo ac(switchport mode access简写)
将这部分管理的设备设置为接入模式
输入:sw ac vl 4
将f0/1-2的接口划分到vl 4中
输入:exit
退出f0/1-2的配置模式
输入:in r f0/3-4
进入f0/3-4系列接口的配置模式
输入:sw mo ac
将这管理这部分接口的交换机设置为接入模式
输入:sw ac vl 5
将这部分接口划分到vl 5中
输入:exit
退出该系列接口的配置模式
输入:in f0/5
进入f0/5配置模式
输入:sw mo ac
将管理f0/5的交换机设置为接入模式
输入:sw ac vl 6
将f0/5接口划分到vl 6中
输入:end
退回到特权模式
输入:sh vl
查看端口的分配情况
输入:in vl 4
进入vl 4配置模式
输入:ip ad 192.168.3.254 255.255.255.0
配置vl 2的IP地址为:192.168.3.254
输入:exit
退出vl 4的配置模式
输入:in vl 5
进入:vl 5的配置模式
输入: ip ad 192.168.4.254 255.255.255.0
设置vl 3的IP地址为:192.168.4.254
输入:in vl 6
进入vl 6的配置模式
输入:ip ad 192.168.5.2 255.255.255.0
配置交换机2中的vl 6的IP地址为:192.168.5.2
输入:exit
退出vl 6的配置模式
输入:ip routing
启动三层路由功能
输入:router rip
启用rip协议
输入:network 192.168.3.0
输入:network 192.168.4.0
输入:network 192.168.5.0
将这几个地址添加到rip协议中
输入:end
退回到特权模式
输入:sh ip ro
查看该设备全部的路由信息
输入:wr
保存刚刚配置
实战如下:
- POST: PortASIC Port Loopback Tests : Begin
- POST: PortASIC Port Loopback Tests : End, Status Passed
-
- Waiting for Port download...Complete
- --More--
- This product contains cryptographic features and is subject to United
- States and local country laws governing import, export, transfer and
- use. Delivery of Cisco cryptographic products does not imply
- third-party authority to import, export, distribute or use encryption.
- Importers, exporters, distributors and users are responsible for
- compliance with U.S. and local country laws. By using this product you
- agree to comply with applicable laws and regulations. If you are unable
- to comply with U.S. and local laws, return this product immediately.
-
- A summary of U.S. laws governing Cisco cryptographic products may be found at:
- http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
-
- If you require further assistance please contact us by sending email to
- export@cisco.com.
-
-
- cisco WS-C3560-24PS (PowerPC405) processor (revision P0) with 122880K/8184K bytes of memory.
- Processor board ID CAT1037RJF7
- 24 FastEthernet/IEEE 802.3 interface(s)
- 2 Gigabit Ethernet/IEEE 802.3 interface(s)
-
- 63488K bytes of flash-simulated non-volatile configuration memory.
- Base ethernet MAC Address : 00D0.FF97.70BB
- Motherboard assembly number : 73-9673-09
- Power supply part number : 341-0029-05
- Motherboard serial number : CAT103758VY
- Power supply serial number : DTH1036C7UB
- Model revision number : P0
- Motherboard revision number : A0
- Model number : WS-C3560-24PS-E
- System serial number : CAT1037RJF7
- Top Assembly Part Number : 800-26380-04
- Top Assembly Revision Number : B0
- Version ID : V06
- CLEI Code Number : COM1100ARC
- Hardware Board Revision Number : 0x01
-
-
- Switch Ports Model SW Version SW Image
- ------ ----- ----- ---------- ----------
- * 1 26 WS-C3560-24PS 12.2(37)SE1 C3560-ADVIPSERVICESK
-
- Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(37)SE1, RELEASE SOFTWARE (fc1)
- Copyright (c) 1986-2007 by Cisco Systems, Inc.
- Compiled Thu 05-Jul-07 22:22 by pt_team
-
- Press RETURN to get started!
-
-
- %LINK-5-CHANGED: Interface FastEthernet0/5, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
-
- %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
-
- %LINK-5-CHANGED: Interface FastEthernet0/2, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
-
- %LINK-5-CHANGED: Interface FastEthernet0/3, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
-
- %LINK-5-CHANGED: Interface FastEthernet0/4, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up
-
- Switch>en
- Switch#conf t
- Enter configuration commands, one per line. End with CNTL/Z.
- Switch(config)#vl 4
- Switch(config-vlan)#vl 5
- Switch(config-vlan)#vl 6
- Switch(config-vlan)#exit
- Switch(config)#in r f0/1-2
- Switch(config-if-range)#sw mo ac
- Switch(config-if-range)#sw ac vl 4
- Switch(config-if-range)#exit
- Switch(config)#in r f0/3-4
- Switch(config-if-range)#sw mo ac
- Switch(config-if-range)#sw ac vl 5
- Switch(config-if-range)#exit
- Switch(config)#in f0/5
- Switch(config-if)#sw mo ac
- Switch(config-if)#sw ac vl 6
- Switch(config-if)#end
- Switch#
- %SYS-5-CONFIG_I: Configured from console by console
-
- Switch#sh vl
-
- VLAN Name Status Ports
- ---- -------------------------------- --------- -------------------------------
- 1 default active Fa0/6, Fa0/7, Fa0/8, Fa0/9
- Fa0/10, Fa0/11, Fa0/12, Fa0/13
- Fa0/14, Fa0/15, Fa0/16, Fa0/17
- Fa0/18, Fa0/19, Fa0/20, Fa0/21
- Fa0/22, Fa0/23, Fa0/24, Gig0/1
- Gig0/2
- 4 VLAN0004 active Fa0/1, Fa0/2
- 5 VLAN0005 active Fa0/3, Fa0/4
- 6 VLAN0006 active Fa0/5
- 1002 fddi-default act/unsup
- 1003 token-ring-default act/unsup
- 1004 fddinet-default act/unsup
- 1005 trnet-default act/unsup
-
- VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
- ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
- 1 enet 100001 1500 - - - - - 0 0
- 4 enet 100004 1500 - - - - - 0 0
- 5 enet 100005 1500 - - - - - 0 0
- 6 enet 100006 1500 - - - - - 0 0
- 1002 fddi 101002 1500 - - - - - 0 0
- 1003 tr 101003 1500 - - - - - 0 0
- 1004 fdnet 101004 1500 - - - ieee - 0 0
- 1005 trnet 101005 1500 - - - ibm - 0 0
-
- Remote SPAN VLANs
- ------------------------------------------------------------------------------
-
-
- Primary Secondary Type Ports
- ------- --------- ----------------- ------------------------------------------
- Switch#conf t
- Enter configuration commands, one per line. End with CNTL/Z.
- Switch(config)#in vl 4
- Switch(config-if)#
- %LINK-5-CHANGED: Interface Vlan4, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan4, changed state to up
-
- Switch(config-if)#ip ad 192.168.3.254 255.255.255.0
- Switch(config-if)#exit
- Switch(config)#in vl 5
- Switch(config-if)#
- %LINK-5-CHANGED: Interface Vlan5, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan5, changed state to up
-
- Switch(config-if)#ip ad 192.168.4.254 255.255.255.0
- Switch(config-if)#exit
- Switch(config)#in vl 6
- Switch(config-if)#
- %LINK-5-CHANGED: Interface Vlan6, changed state to up
-
- %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan6, changed state to up
-
- Switch(config-if)#ip ad 192.168.5.2 255.255.255.0
- Switch(config-if)#exit
- Switch(config)#ip routing
- Switch(config)#router rip
- Switch(config-router)#network 192.168.3.0
- Switch(config-router)#network 192.168.4.0
- Switch(config-router)#network 192.168.5.0
- Switch(config-router)#end
- Switch#
- %SYS-5-CONFIG_I: Configured from console by console
-
- Switch#sh ip ro
- Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
- D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
- N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
- E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
- i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
- * - candidate default, U - per-user static route, o - ODR
- P - periodic downloaded static route
-
- Gateway of last resort is not set
-
- C 192.168.3.0/24 is directly connected, Vlan4
- C 192.168.4.0/24 is directly connected, Vlan5
- C 192.168.5.0/24 is directly connected, Vlan6
- Switch#wr
- Building configuration...
- [OK]
- Switch#sh ip ro
- Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
- D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
- N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
- E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
- i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
- * - candidate default, U - per-user static route, o - ODR
- P - periodic downloaded static route
-
- Gateway of last resort is not set
-
- R 192.168.1.0/24 [120/1] via 192.168.5.1, 00:00:05, Vlan6
- R 192.168.2.0/24 [120/1] via 192.168.5.1, 00:00:05, Vlan6
- C 192.168.3.0/24 is directly connected, Vlan4
- C 192.168.4.0/24 is directly connected, Vlan5
- C 192.168.5.0/24 is directly connected, Vlan6
- Switch#
-
-
-
-
-
-
-
-
- Switch con0 is now available
-
-
-
-
-
-
- Press RETURN to get started.
-
-
-
-
-
-
-
-
-
-
-
PC1 ping PC8胜利!