交换机A上1-2端口对应交换机B上3-4端口

PC1链接交换机A上23端口

PC2链接交换机B上24端口

命令如下:

DCS-3950-28C>en
DCS-3950-28C#con
DCS-3950-28C(config)#hostname switchA
switchA(config)#%Jan 01 00:01:39 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet1/2, changed state to DOWN
%Jan 01 00:01:41 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet1/2, changed state to UP
%Jan 01 00:01:42 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet1/1, changed state to DOWN
%Jan 01 00:01:44 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet1/1, changed state to UP

switchA(config)#
switchA(config)#interface vlan 1
switchA(config-if-vlan1)#ip address 192.168.1.11 255.255.255.0
switchA(config-if-vlan1)#no shutdown
switchA(config-if-vlan1)#q
switchA(config)#spanning-tree

MSTP is starting now, please wait............
MSTP is enabled successfully.
switchA(config)#%Jan 01 00:02:17 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1,changed state to DOWN
8
DCS-3950-28C>
DCS-3950-28C>
DCS-3950-28C>en
DCS-3950-28C#config
DCS-3950-28C(config)#hostname switchB
switchB(config)#interface vlan 1
switchB(config-if-vlan1)#ip
ip                         ipv6                      
switchB(config-if-vlan1)#ip address 192.168.1.12 255.255.255.0
switchB(config-if-vlan1)#no shutdown
switchB(config-if-vlan1)#q
switchB(config)#spanning-tree

MSTP is starting now, please wait............
MSTP is enabled successfully.
switchB(config)#%Jan 01 00:03:42 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1,changed state to DOWN
%Jan 01 00:03:44 2006 MSTP set port = 4, mst = 0 to LEARNING!
%Jan 01 00:03:44 2006 MSTP set port = 4, mst = 0 to FORWARDING!
%Jan 01 00:03:44 2006 Root bridge has been changed. PRS is triggered: INSTANCE=0
%Jan 01 00:03:44 2006 CistRoot = 32768.00:03:0f:61:74:b5, CistRegRoot = 32768.00:03:0f:61:74:b5
%Jan 01 00:03:45 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1,changed state to UP

switchA(config)#
switchA(config)#
switchA(config)#port-group 1
switchA(config)#%Jan 01 00:03:21 2006 %LINK-3-UPDOWN: Interface Port-Channel1, changed state to administratively DOWN
%Jan 01 00:03:21 2006 MSTP set port = 29, mst = 0 to DISCARDING!
%Jan 01 00:03:25 2006 MSTP set port = 2, mst = 0 to LEARNING!

switchB(config)#
switchB(config)#port-group 2
switchB(config)#%Jan 01 00:04:13 2006 MSTP set port = 24, mst = 0 to FORWARDING!
%Jan 01 00:04:13 2006 %LINK-3-UPDOWN: Interface Port-Channel2, changed state to administratively DOWN
%Jan 01 00:04:13 2006 MSTP set port = 30, mst = 0 to DISCARDING!

switchB(config)#
switchB(config)#
switchB(config)#%Jan 01 00:03:42 2006 MSTP set port = 2, mst = 0 to FORWARDING!
         
switchA(config)#
switchA(config)#interface ethernet 1/1-2
switchA(config-if-port-range)#port-group 1 mode
active                     on                         passive                   
switchA(config-if-port-range)#port-group 1 mode on
switchA(config-if-port-range)#%Jan 01 00:05:32 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-Channel1, changed state to UP
%Jan 01 00:05:32 2006 MSTP set port = 29, mst = 0 to DISCARDING!

switchA(config-if-port-range)#q
switchA(config)#interface %Jan 01 00:05:39 2006 MSTP set port = 29, mst = 0 to LEARNING!
%Jan 01 00:05:39 2006 MSTP set port = 29, mst = 0 to FORWARDING!
interface port-channel 1
switchA(config-if-port-channel1)#show vlan
vlan                       vlan-translation          
switchA(config-if-port-channel1)#show vlan
VLAN Name         Type       Media     Ports
---- ------------ ---------- --------- ----------------------------------------
1    default      Static     ENET      Ethernet1/3         Ethernet1/4       
                                       Ethernet1/5         Ethernet1/6       
                                       Ethernet1/7         Ethernet1/8       
                                       Ethernet1/9         Ethernet1/10      
                                       Ethernet1/11        Ethernet1/12      
                                       Ethernet1/13        Ethernet1/14      
                                       Ethernet1/15        Ethernet1/16      
                                       Ethernet1/17        Ethernet1/18      
                                       Ethernet1/19        Ethernet1/20      
                                       Ethernet1/21        Ethernet1/22      
                                       Ethernet1/23        Ethernet1/24      
                                       Ethernet1/25        Ethernet1/26      
                                       Ethernet1/27        Ethernet1/28      
                                       Port-Channel1     
switchA(config-if-port-channel1)#int e 1/3-4
switchB(config-if-port-range)#int e 1/3-4
switchB(config-if-port-range)#q
switchB(config)#int e 1/3-4
switchB(config-if-port-range)#port-group 2 mode on
switchB(config-if-port-range)#%Jan 01 00:07:22 2006 Root bridge has been changed. PRS is triggered: INSTANCE=0
%Jan 01 00:07:22 2006 CistRoot = 32768.00:03:0f:61:75:03, CistRegRoot = 32768.00:03:0f:61:75:03
%Jan 01 00:07:24 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-Channel2, changed state to UP
%Jan 01 00:07:24 2006 MSTP set port = 30, mst = 0 to DISCARDING!

switchB(config-if-port-range)#
switchB(config-if-port-range)#q
switchB(config)#%Jan 01 00:07:25 2006 Root bridge has been changed. PRS is triggered: INSTANCE=0
%Jan 01 00:07:25 2006 CistRoot = 32768.00:03:0f:61:74:b5, CistRegRoot = 32768.00:03:0f:61:74:b5
%Jan 01 00:07:25 2006 MSTP set port = 30, mst = 0 to LEARNING!
%Jan 01 00:07:25 2006 MSTP set port = 30, mst = 0 to FORWARDING!

switchB(config)#
switchB(config)#po
policy-map                 port-group                 port-rate-statistics      
port-scan-mode             port-status               
switchB(config)#interface port-channel 2
switchB(config-if-port-channel2)#show vlan
vlan                       vlan-translation          
switchB(config-if-port-channel2)#show vlan
VLAN Name         Type       Media     Ports
---- ------------ ---------- --------- ----------------------------------------
1    default      Static     ENET      Ethernet1/1         Ethernet1/2       
                                       Ethernet1/5         Ethernet1/6       
                                       Ethernet1/7         Ethernet1/8       
                                       Ethernet1/9         Ethernet1/10      
                                       Ethernet1/11        Ethernet1/12      
                                       Ethernet1/13        Ethernet1/14      
                                       Ethernet1/15        Ethernet1/16      
                                       Ethernet1/17        Ethernet1/18      
                                       Ethernet1/19        Ethernet1/20      
                                       Ethernet1/21        Ethernet1/22      
                                       Ethernet1/23        Ethernet1/24      
                                       Ethernet1/25        Ethernet1/26      
                                       Ethernet1/27        Ethernet1/28      
                                       Port-Channel2     
switchB(config-if-port-channel2)#show running-config
!
no service password-encryption
!
hostname switchB
sysLocation China
sysContact 800-810-9119
!
username admin privilege 15 password 0 admin
!
!
!
!
!
!
spanning-tree
!
!
!
!
!
vlan 1
!
port-group 2
!        
Interface Ethernet1/1
!
Interface Ethernet1/2
!
Interface Ethernet1/3
 port-group 2 mode on
!
Interface Ethernet1/4
 port-group 2 mode on
!
Interface Ethernet1/5
!
Interface Ethernet1/6
!
Interface Ethernet1/7
!
Interface Ethernet1/8
!
Interface Ethernet1/9
!
Interface Ethernet1/10
!
Interface Ethernet1/11
!        
Interface Ethernet1/12
!
Interface Ethernet1/13
!
Interface Ethernet1/14
!
Interface Ethernet1/15
!
Interface Ethernet1/16
!
Interface Ethernet1/17
!
Interface Ethernet1/18
!
Interface Ethernet1/19
!
Interface Ethernet1/20
!
Interface Ethernet1/21
!
Interface Ethernet1/22
!
Interface Ethernet1/23
!        
Interface Ethernet1/24
!
Interface Ethernet1/25
!
Interface Ethernet1/26
!
Interface Ethernet1/27
!
Interface Ethernet1/28
!
Interface Port-Channel2
!
interface Vlan1
 ip address 192.168.1.12 255.255.255.0
!
no login
!
end

switchB(config-if-port-channel2)#?
switchA(config-if-port-channel1)#
switchA(config-if-port-channel1)#
switchA(config-if-port-channel1)#show running-config
!
no service password-encryption
!
hostname switchA
sysLocation China
sysContact 800-810-9119
!
username admin privilege 15 password 0 admin
!
!
!
!
!
!
spanning-tree
!
!
!
!
!
vlan 1
!
port-group 1
!        
Interface Ethernet1/1
 port-group 1 mode on
!
Interface Ethernet1/2
 port-group 1 mode on
!
Interface Ethernet1/3
!
Interface Ethernet1/4
!
Interface Ethernet1/5
!
Interface Ethernet1/6
!
Interface Ethernet1/7
!
Interface Ethernet1/8
!
Interface Ethernet1/9
!
Interface Ethernet1/10
!
Interface Ethernet1/11
!        
Interface Ethernet1/12
!
Interface Ethernet1/13
!
Interface Ethernet1/14
!
Interface Ethernet1/15
!
Interface Ethernet1/16
!
Interface Ethernet1/17
!
Interface Ethernet1/18
!
Interface Ethernet1/19
!
Interface Ethernet1/20
!
Interface Ethernet1/21
!
Interface Ethernet1/22
!
Interface Ethernet1/23
!        
Interface Ethernet1/24
!
Interface Ethernet1/25
!
Interface Ethernet1/26
!
Interface Ethernet1/27
!
Interface Ethernet1/28
!
Interface Port-Channel1
!
interface Vlan1
 ip address 192.168.1.11 255.255.255.0
!
no login
!
end

switchA(config-if-port-channel1)#q 
switchA(config)#

附图:

交换机A:1-2端口  交换机B:3-4端口ping测试

wKioL1k1V-fToosnAAD0snw-SmI202.png-wh_50

交换机A:1-2端口 交换机B:去掉4端口ping测试

wKioL1k1V-fSD89eAADR7jtl1fo671.png-wh_50

交换机A:1-2端口 交换机B:5-6端口ping测试(虽然等了一小会但是还是ping通了)

wKiom1k1V-jBW-PBAADvYb0RcwU502.png-wh_50