How to Connect 2 Cisco Switches Together
This article describes how to connect 2 Cisco switches(L3 Switch C3560X and L2 Switch 2960) together.
VLAN Structure
Cisco Command
L3 Switch(C3560X)
L2 Switch(2960)
Hardware Connection
Dual Ethernet PC Configuration
VLAN Structure
L3 Switch
- Vlan10 - 192.168.10.254 255.255.255.0
- Vlan20 - 192.168.20.254 255.255.255.0
L2 Switch
- Vlan20
Note: L2 Switch only creates Vlan, Not assigning IP Address, L3 Switch will configure and assign IP address.
Cisco Command
L3 Switch(C3560X)
run command and then input telnet 192.168.10.254
password: admin
Switch> enable
admin
Switch#> configure terminal
Switch(config)# ip routing # Enable ip routing
# Create VLAN
Switch(config)# interface vlan 10 # Create vlan 10
Switch(config-if)# ip address 192.168.10.254 255.255.255.0 # Assign IP, SVI(Switch Virtual Interface) Routing
Switch(config-if)# exit
Switch(config)# interface vlan 20 # Create vlan 20
Switch(config-if)# ip address 192.168.20.254 255.255.255.0
Switch(config-if)# exit
# Assign Ethernet Ports
Switch(config)# interface range GigabitEthernet0/1 - 10 # Batch config Ethernet ports
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# exit
Switch(config)# interface range GigabitEthernet0/14 - 20
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 20
Switch(config-if-range)# exit
Switch(config)# exit
Switch# copy running-config startup-config
Destination filename start-config? Enter
Switch# show run
NOTE: Reset Port to Default, e.g. reset port 3:
switch(config)#default interface FastEthernet0/3
L2 Switch(2960)
L2 Switch configuration is similar to L3 Switch. The difference is DO NOT assigning IP address when creating VLAN interface.
Connect your PC or laptop to the 2960 switch Ethernet port 48, configure the static IP address, mask and gateway, e.g.192.168.1.2, 255.255.255.0, 192.168.1.1
run command and then input telnet 192.168.1.1
password: admin
Switch> enable
admin
Switch#> configure terminal
# Create VLAN
Switch(config)# interface vlan 20
Switch(config-if)# exit
# Assign Ethernet Ports
Switch(config)# interface range FastEthernet0/1 - 46 # Batch config Ethernet ports. Port 47 is reserved, Port 48 is for telnet.
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 20
Switch(config-if-range)# exit
Switch(config)# exit
Switch# copy running-config startup-config
Destination filename start-config? Enter
Switch# show run
Hardware Connection
Connect L3 switch C3560X port 14 with L2 switch 2960 port 33.
NOTE: You can connect ANY 2 ports together within the VLAN 20 range of the 2 switches(GigabitEthernet0/14 - 20 and FastEthernet0/1 - 46)
Dual Ethernet PC Configuration
Please skip below command if you only have 1 Ethernet adapter.
NOTE: Execute below commands in Windows Command line as Administrator
Clear Default Route Table
route delete 0.0.0.0
Add Default Route Table, pointing to external gateway
route -p add 0.0.0.0 mask 0.0.0.0 172.21.0.254
Add Internal Route Table, pointing to internal gateway
route -p add 192.168.10.0 mask 255.255.255.0 192.168.20.254
Print route table information
route print
版权声明: 本文为 InfoQ 作者【心在飞】的原创文章。
原文链接:【http://xie.infoq.cn/article/3b2ce25e46ce43f29ab0c28cd】。未经作者许可,禁止转载。
评论