VLANtrunking技术简单整理
基于IOS,根据《cisco现场手册》整理
 
VLANtrunking技术:
两种配置方式:1.vlan database进入vlan模式
2.全局配置模式(较新)
VTP
注意:1.必须要么先用域名配置vtp,要么在交换机上禁用vtp
2.只管理vlan2-1002
#先配置vtp域名:
vtp domain cisco
#可以设置vtp口令:8~32个字符
vtp password cisco
vtp模式:server client transparent
vtp mode server(默认)
#禁用vtp同步:
vlanvtp transparent
globalvtp mode transparent
#创建vlan
vlanvlan 100 name VLAN100
globalvlan 100
#vtp pruning vtp修剪,无需手动删除或添加trunk干道中的vlan流量,会自动删除或增加vlan信息(指用户信息,不会阻止stp之类的管理信息),在server上做,然后传播到其他。支持VTPv2的才能启用裁剪。<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

vlanvtp pruning
#指定符合裁剪资格的vlan:可选,默认所有vlan都可以被裁剪。
int f0/1
switchport trunk pruning vlan [add | remove] vlan-list
#静态--划分端口:默认都属于vlan1

int f 0/1
switchport access vlan 100
#动态---VMPS,根据MAC地址划分vlan(客户机、服务器、vlan数据库文件、动态端口)
不常用,略。
查看:
show f 0/1 switchport

 

TRUNK

int f 0/1

switchport mode dynamic desirable  与对端模式on,auto,desirable形成干道

switchport mode dynamic auto      与对端模式on,desirable形成干道

switchport mode trunk             最常用。on模式,与对端各种模式(除了nonegotiate)形成干道

switchport nonegotiate          启用干道但是不发送DTP,对端是onnonegotiate时形成干道

no switchport mode trunk        关闭trunkoff模式

注意:常用switchport mode trunkon模式,因为29503550不支持DTP协商(只有onnon模式)

switchport trunk encapsulation [dot1q | isl]  封装类型有dot1qisl两种,islcisco私有。

switchport trunk native vlan 100     可选,指定native vlan,对于dot1q,每个端口上的native vlan必须匹配。

switchport trunk allowed vlan [add|remove] vlanlist 手动指定干道允许通过的vlan流量
eg. switchport trunk allowed vlan add 5,8,10

switchport trunk allowed vlan remove 2-1000         

查看
show f0/1 switchport

 

私用VLAN1.提供了控制子网内哪些设备可以通讯的机制。在单台交换机上配置。
                       2.被隔离端口只能和混杂端口通信,群体端口可以与相同群体内端口和混杂的通信。
#先配置:vtp transparent
#创建主vlanvlan 100
            private-vlan primary
#创建次vlan:(被隔离vlan和群体vlan
vlan 200
privat-vlan [isolated | community]
#绑定主次vlanvlan 100(主vlannumber
               private-vlan association 200,300(次vlannumber
#将端口加入次vlan
      int f0/1
            switchport
            switchport mode private-vlan host
            switchport mode private-vlan host-association primary_number secondary_number

#定义混杂端口并映射被隔离和群体vlan
            int f0/2
            switchport
            switchport mode private-vlan promiscuous
            switchport mode private-vlan mapping primary_number secondary_number

#查看:show vlan private-vlan
       show int private-vlan mapping
       show int f0/1 swithport