思科Catalyst1900交換機上速配VLAN

一、VLAN的特點

VLAN具有如下特點:

分段性,可根據部門,功能和項目來劃分成不同的網段;


靈活性,組成VLAN的用戶不用考慮物物理位置,同一個VLAN也可以跨越多個交換機;

安全性,通過廣播域的分隔,使每個邏輯的VLAN就象一個獨立的物理橋,提高了網絡的性能和安全,但不同的VLAN間的通訊需要經過路由器來連接。 

二、基本的VLAN配置

1、單個交換機VLAN配置

當不使用VTP協議時,交換機應該配置成VTP transparent(透明模式),此時交換機VLAN的配置主要包括如下內容:

·
使用全局命令,啓用VTPtransparent 模式;

·
使用全局命令定義每個VLAN的編號(必須的)和相應的名稱(可選的);

·
使用接口子命令,將每個端口分配到相應的VLAN

 

假定有如圖1所示的交換機劃分的三個VLAN,其配置如下:

switch(config)#vtp transparent domani dummy

switch(config)#vlan 2 name VLAN2

switch(config)#vlan 3 name VLAN3

switch(config)#interface e 0/5

switch(config-if)#vlan-membership static 2

switch(config)#interface e 0/6

switch(config-if)#vlan-membership static 2

switch(config)#interface e 0/7

switch(config-if)#vlan-membership static 2

switch(config)#interface e 0/8

switch(config-if)#vlan-membership static 2

switch(config)#interface e 0/9

switch(config-if)#vlan-membership static3

switch(config)#interface e 0/10

switch(config-if)#vlan-membership static3

switch(config)#interface e 0/11

switch(config-if)#vlan-membership static3

switch(config)#interface e 0/12

switch(config-if)#vlan-membership static3
 

在以上的配置中,讓大家覺得奇怪的是沒有配置VLAN1,這沒有關係,因爲它是自動配置的,而且任何沒有指定靜態VLAN配置的端口都被認爲是在VLAN1中的,同樣交換機的地址也被認爲是在VLAN1的廣播域中。

在配置完成後,可以使用”show vlan vlan#”命令來顯示一個特定的VLAN信息,驗證VLAN的參數,例如:

switch#show vlan 3
 

2、多個交換機的配置

爲了允許VLAN跨越多個交換機,這就必須配置主幹(trunk)來連接這些交換機。Cisco要求在這種主幹鏈路上使用諸如ISL的主幹協議,於是啓用主幹協議的命令就是trunk


使用trunk接口配置命令將一個快速以太網接口設置成主幹模式,在Cisco Catalyst 1900交換機上有兩個快速以太網接口fa0/26fb0/27。在使用動態交換鏈路協議(DISL)ISL時,啓用和定義主幹協議類型可以靜態和動態地進行。trunk接口配置命令的語法如下:

switch(config)#trunk [on/off/desirable/auto/nonnegotiate]

·on--
將端口配置成永久的ISL主幹模式,並與連接設備協商將鏈路轉換成主幹模式;

·off--
禁止端口的主幹模式,並與連接設備協商將路轉換成非主幹模式;

·desirable--
觸發端口進行協商,將鏈路從非主幹模式轉換成主幹模式;如連接設備在 on,desirableauto狀態下,此端口將和主幹進行協商,否則該端口爲非主幹端口;

·auto--
只有在連接設備是ondesirable狀態下才使端口變爲主幹;

·nonnegotiate--
將端口配置成永久的主幹模式,並且不和對方協商。

在實際工作中,可根據配置參數的選項,設置成相應的模式。

 

2

2是有兩個交換機組成三個VLAN的配置示例,其配置如下:


switch1(config)#interface e fa 0/26

switch1(config-if)#trunk on

switch1(config-if)#vlan-membership static 1

switch1(config-if)#vlan-membership static 2

switch1(config-if)#vlan-membership static 3

switch1(config)#interface e fb 0/27

switch1(config-if)#trunk on

switch1(config-if)#vlan-membership static 1

switch1(config-if)#vlan-membership static 2

switch1(config-if)#vlan-membership static 3

注意:兩個快速以太網端口上不但被配置爲主幹有效,而且3VLAN都被靜態地配置到這些端口上,通過同時配置這些VLAN,交換機將主幹端口當成這些VLAN的一部分,當然網絡中的路由器也必須配置成支持ISL


爲驗證主幹配置和VLAN端口分配情況,可使用“show trunk a/b“”show vlan-membership”。其中a /b分別代表快速以太網端口0/260/27。 

三、使用VTP配置VLAN

1
VTP作用


交換機通過VTP定時(每5分鐘)或實時(當交換機的參數有改變時),向同一管理域進行多點傳送公共管理域消息,並通過同一管理域同步所配置VLAN的識別信息(在網絡較大時作用明顯),支持混合介質(FDDIATM),精確跟蹤VLAN的增、減、更名等實時情況。VTP爲第二層信息協議,主要是維護配置的一致性。缺省情況下交換機處於non-management-domain狀態,其VLAN信息不會宣告出去。通過設置VTP Pruning (缺省爲關狀態),增加可用帶寬。

2
VTP三種模式:Server(缺省)ClientTransparent

·Server
:創建、更改和刪除VLAN以及用於整個VTP域的其它配置參數,這些消息被依次傳到相同域中的VTP客戶,VLAN配置信息存於
NVRAM

·Client
VLAN配置信息不存於NVRAM,當在VTP的客戶也不能創建、更改和刪除VLAN,只能同步收到的VLAN信息


·Transparent
:當交換機不需要或不想加入VTP時,主要是用作本地管理,不與其它交換機共享VLAN信息,但仍可以將VTP通告轉送到其它交換機。

3
VTP裁剪

由於ISL主幹線路承載了所有VLAN的流量,因此,有些流量可能不必廣播到在無需運載它們的鏈路上,VTP裁剪使用VLAN通告來決定什麼時候該主幹連接不需要泛洪式的傳輸,缺省的情況下,主幹連接運載此VTP管理域中的所有VLAN流量,而在實際工作中,有些交換機交不必將本地端口配置到每個VLAN中,這樣啓用VTP配置就成爲必要。


4
、使用VTP配置VLAN

Catalyst 1900交換機,默認的VTP配置參數如下:

·VTP
域名:None(無)

·VTP
模式:Server(服務器)

·VTP
口令:None(無)

·VTP
裁剪:Disabled(禁止)

·VTP
陷阱:Enabled(啓用)

VTP
域名可以指定或學習到,缺省的情況下是不設置的。如果缺省配置收到一個有域名的VTP通告,它就會使用該域名;如果交換機已配置了域名,又收到一個域名通告,則會忽略。

VTP
和管理域可以設置口令,但在域中的所有交換機必須輸入相的口令,否則VTP將不能正常工作。

VTP
服務器上的VTP裁剪的啓用和禁止將會傳播到整個管理域中,如果VTP裁剪啓用,除VLAN1上的所有VLAN將被裁剪。

假定有如圖3VLAN連接,具體配置如下:

·
作爲VTP服務器交換機1的配置

switch1#configure terminal

switch1(cofig)#ip address 10.5.5.11 255.255.255.0



3

switch1(cofig)#ip defaul-gateway 10.5.5.3

switch1(cofig)#vtp server domain Hartsfield purning enable

switch1(cofig)#vlan 2 name vlan2

switch1(cofig)#vlan 3 name vlan3

switch1(cofig)#interface e 0/5

switch1(cofig-if)#valn-membership static 2

switch1(cofig)#interface e 0/6

switch1(cofig-if)#valn-membership static 2

......

switch1(cofig)#interface e 0/9

switch1(cofig-if)#valn-membership static 3

switch1(config)#interface e fa 0/26

switch1(config-if)#trunk on

switch1(config-if)#vlan-membershi static 1

......

switch1(config)#interface e fb 0/27

switch1(config-if)#trunk on

switch1(config-if)#vlan-membershi static 1

......

·
作爲VTP客戶交換機2的配置


switch2#configure terminal

switch2(cofig)#ip address 10.5.5.12 255.255.255.0

switch2(cofig)#ip defaul-gateway 10.5.5.3

switch2(cofig)#vtp client

switch2(cofig)#interface e 0/5

switch2(cofig-if)#valn-membership static 3

switch2(cofig)#interface e 0/6

switch2(cofig-if)#valn-membership static 3

switch2(cofig)#interface e 0/7

switch2(cofig-if)#valn-membership static 3

switch2(cofig)#interface e 0/8

switch2(cofig-if)#valn-membership static 3

switch2(cofig)#interface e 0/9

switch2(cofig-if)#valn-membership static 3

......

switch2(config)#interface e fa 0/27

switch2(config-if)#trunk on

switch2(config-if)#vlan-membershi static 1

switch2(config-if)#vlan-membershi static 3

注意:在交換機2配置中沒有域名,這可能通過第一個通告學習到;


在交換機2配置中無須對VLAN進行定義,而且在VTP客戶模式下是不能定義的。

在交換機1中裁剪被啓用,VTP從交換機2中裁剪VLAN2,因交換機2中沒有VLAN2端口。

爲了驗證新的配置或瞭解VTP的配置信息可以使用命令:

switch1#show vtp

五、VLAN配置概要

由於篇幅的限制,有關術語和概念以及VLAN配置的其它具體情況就不作介紹了,下面就VLAN配置概括如下:

1
、配置原則

最大VLAN數、預置VLANCDPVTPIP地址對VLAN1有效


2
、配置步驟

Enable VTP(
可選
)=>Enable Trunking=>Create VLANs=>Assign Vlan to ports

3
VTP配置內容和原則


·Passwod
:域管理密碼在同一域所有交換機上設置相同,否則VTP不會正常工作;


·
Server上配置pruning功能會影響整個VTP(VTP宣告時所涉及的參數)

·trap
:缺省開啓,每個新的VTP信息發出時會產生一個SNMP信息;

·vtp
有兩個版本:V1僅支持EthernetV2同時也支持Token Ring

4
VTP配置命令

·Show vtp
:確認最新的配置改變


·Trunk on/off/disirable/auto/nonegotiate (
只能在百、千兆口)

·Show trunk

·Vlan #
:編號範圍,可以不命名


·Show vlan…

·Vlan
更名

·Vlan-membership static vlan#
dynamic 缺省地所有端口都屬VLAN1

·Show vlan-membership

·Show spantree vlan#
確認某VLAN是否運行了STP

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章