cisco Switching-配置trunk中继链路

问题

在两台交换机上分别创建vlan2、vlan3,参照如下网络拓扑图将端口加入到指定的vlan并配置IP址,实现跨交换机的同vlan主机的通信。

方案

分别在sw1和sw2上创建vlan2和vlan3并把相应的接口划分到对应的vlan并为客户端配置IP地址,IP地址具有唯一性所以同一局域网络中不能存在相同的IP,另所有的接口默认为vlan1,所以不配置trunk中继链路vlan1也是可以跨交换机通信的。

拓扑图

步骤

1.参照拓扑图为客户端分别配置相对应网段的IP

按从左到右顺序:192.168.1.1 192.168.1.2 192.168.2.1 192.168.2.2 192.168.3.1 192.168.3.2

192.168.1.3 192.168.1.4 192.168.2.3 192.168.2.4 192.168.3.3 192.168.3.4

2.为客户端配置IP,分别为交换机sw1和sw2创建vlan并把相应的接口划到相对应的vlan

SW1交换机

Switch >enable

Switch#configure terminal

Switch(config)#hostname SW1

SW1 (config)#vlan2

Switch(config-vlan)#exit

SW1 (config)#vlan 3

SW1 (config-vlan)#exit

SW1 (config)#interface fastEthernet 0/3

SW1 (config-if)#switchport access vlan 2

SW1 (config-if)#exit

SW1 (config)#interface fastEthernet 0/4

SW1 (config-if)#switchport access vlan 2

SW1 (config-if)#exit

SW1 (config)#interface fastEthernet 0/5

SW1 (config-if)#switchport access vlan 3

SW1 (config-if)#exit

SW1 (config)#interface fastEthernet 0/6

SW1 (config-if)#switchportaccess vlan 3

SW2交换机

Switch >enable

Switch#configure terminal

Switch(config)#hostname SW2

SW2 (config)#Switch(config-vlan)#exit

SW2 (config)#vlan 3

SW2 (config-vlan)#exit

SW2 (config)#interface fastEthernet 0/3

SW2(config-if)#switchport access vlan 2

SW2 (config-if)#exit

SW2 (config)#interface fastEthernet 0/4

SW2 (config-if)#switchport access vlan 2

SW2 (config-if)#exit

SW2 (config)#interface fastEthernet 0/5

SW2 (config-if)#switchport access vlan 3

SW2 (config-if)#exit

SW2 (config)#interface fastEthernet 0/6

SW2 (config-if)#switchport access vlan 3

3.分别查看SW1和SW2交换机上的vlan信息

SW1#show vlan

VLAN Name Status Ports

---- -------------------------------- --------- -------------------------------

1 default active Fa0/1, Fa0/2, 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

2 VLAN0002 active Fa0/3, Fa0/4

3 VLAN0003 active Fa0/5, Fa0/6

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

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

------- --------- ----------------- ------------------------------------------

SW2#show vlan

VLAN Name Status Ports

---- -------------------------------- --------- -------------------------------

1 default active Fa0/1, Fa0/2, 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

2 VLAN0002 active Fa0/3, Fa0/4

3 VLAN0003 active Fa0/5, Fa0/6

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

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

------- --------- ----------------- ------------------------------------------

4.为交换机配置trunk中继链接路

SW1>enable

SW1#configure terminal

SW1(config)#interface fastEthernet 0/7

SW1(config-if)#switchport mode trunk

SW2#enable

SW2#configure terminal

SW2(config)#interface fastEthernet 0/7

SW2(config-if)#switchport mode trunk

SW2(config-if)#

5.测试2.0网段和3.0网段跨交换机通信

PC>ping 192.168.2.3

Pinging 192.168.2.3 with 32 bytes of data:

Reply from 192.168.2.3: bytes=32 time=1ms TTL=128

Reply from 192.168.2.3: bytes=32 time=0ms TTL=128

Reply from 192.168.2.3: bytes=32 time=0ms TTL=128

Reply from 192.168.2.3: bytes=32 time=0ms TTL=128

Ping statistics for 192.168.2.3:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

PC>ping 192.168.3.3

Pinging 192.168.3.3 with 32 bytes of data:

Reply from 192.168.3.3: bytes=32 time=1ms TTL=128

Reply from 192.168.3.3: bytes=32 time=0ms TTL=128

Reply from 192.168.3.3: bytes=32 time=0ms TTL=128

Reply from 192.168.3.3: bytes=32 time=0ms TTL=128

Ping statistics for 192.168.3.3:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

你可能感兴趣的:(cisco Switching-配置trunk中继链路)