实验内容

1.在cisco交换机上划分vlan

2.配置中继端口

3.配置vtp及vtp透明

4.单臂路由的具体配置

实验拓扑:


cisco:vlan-vtp-单臂路由-trunk_trunk

1.pc0:192.168.1.1           

  pc1:192.168.2.1     pc0,pc2 网关:192.168.1.100

  pc2:192.168.1.2       pc1,pc3 网关:192.168.2.100 

  pc3:192.168.2.2

2.sw0:f0/1属于vlan1  f0/2属于vlan2  f0/3设为中继端口

  sw1:f0/1与f0/2开启中继

  sw2:f0/1属于vlan1  f/2属于vlan2  f0/3与f0/4设为中继端口

3.R0:f0/0.1 192.168.1.100

     f0/0.2 192.168.2.100

实验目的:

1.vlan1与vlan2可以互通 如pc0 ping通pc3

2.vtp的配置及服务端与客户端的配置

3.中继端口配置

实验配置:

1.sw0:

enable

vlan database

vtp server         (服务端)

vlan 2 name 2

vlan 3 name 3

vtp domain abc.com (这里域名自定义)

conf t
interface FastEthernet0/1

switchport access vlan 1 (现在cisco交换机默认所有端口都属于vlan1 这个命令可以省略)

switchport mode access

interface FastEthernet0/2
switchport access vlan 2
switchport mode access

interface FastEthernet0/3
switchport mode trunk

2.sw1:

enable

vlan database

vtp mode transparent

conf t

interface FastEthernet0/1

switchport mode trunk

interface FastEthernet0/2

switchport mode trunk

3.sw2:

enable

vlan database

vtp client               (客户端)

vtp domain abc.com

conf t

interface FastEthernet0/1
switchport mode access

interface FastEthernet0/2
switchport access vlan 2
switchport mode access

interface FastEthernet0/3
switchport mode trunk

interface FastEthernet0/4
switchport mode trunk

4.R0:

enable

conf t

interface FastEthernet0/0
no ip address

no shutdown
duplex auto
speed auto

interface FastEthernet0/0.1
encapsulation dot1Q 1 native
ip address 192.168.1.100 255.255.255.0

interface FastEthernet0/0.2
encapsulation dot1Q 2
ip address 192.168.2.100 255.255.255.0

实验测试:

1.pc0 ping pc3

PC>ping 192.168.2.2

Pinging 192.168.2.2 with 32 bytes of data:

Reply from 192.168.2.2: bytes=32 time=188ms TTL=127
Reply from 192.168.2.2: bytes=32 time=187ms TTL=127
Reply from 192.168.2.2: bytes=32 time=140ms TTL=127
Reply from 192.168.2.2: bytes=32 time=187ms TTL=127

2.sw2:vtp客户端没有配置vlan 但通过从服务端可以学习到全部vlan

show vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/5, 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, Gig1/1, Gig1/2
2    2                                active    Fa0/2
3    3                                active   

1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active 

从这个表中也可以看出思科交换默认端口都是属于vlan1的

3.R0:

show ip route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/0.1
C    192.168.2.0/24 is directly connected, FastEthernet0/0.2

R0有了2条直连路由条目,这使得vlan1与vlan2可以互通

注意:

本实验使用的是思科2900系列的交换机 默认支持802.1q

如果3层交换设备在设置端口中继模式的时候命令不同

switchport trunk encapsulation  {isl/dot1q/nonegotiate}

isl这是早期思科专有协议 现在基本废除

dot1q 就是802.1q 在交换上的输入命令

negotiate 自动匹配模式 必须有一个直连端口已经配置了中继协议802.1q或者isl