VLAN (Virtual Local Area Network)çä¸æå为âèæå±åç½âï¼æ¯ç¸å¯¹ç©çå±åç½èè¨çï¼ä½¿ç¨è¯¥ææ¯å¯ä»¥å°ç°æçç±äº¤æ¢æºäºè¿çå±åç½ååæå 个é»è¾çèæå±åç½ï¼èæå±åç½ä¹é´ç¸äºé离ï¼å±äºä¸åç广æåãè¿æ ·ä¸æ¥å¯ä»¥å°å¤§çå±åç½ææç广æåååæå¤ä¸ªå°ç广æåï¼ç¸å¯¹ç广ææµéä¼åå°ï¼ç¼è§£äºå¹¿æé£æ´ãåæ¶VLANææ¯è¿å¯¹å个èæå±åç½èµ·å°äºå®å ¨é离çææã
æ¹æ³/æ¥éª¤
1ãVLANææ¯çé ç½®
é ç½®VLANçæ¹æ³æå¾å¤ï¼win7ç³»ç»ä¸è½½å¯ä»¥éè¿æå®äº¤æ¢æºæ¥å£ã客æ·æºMACå°åæIPå°åçå¤ç§æ¹æ³ååVLANï¼å ¶ä¸ç¨å¾æå¤çæ¯åå交æ¢æºç©çæ¥å£ãå¦å¾1æ示ï¼å°äº¤æ¢æºF0/2æ¥å£åé ç»VLAN2ã
VLANçæä½å 容主è¦æå建ãå½åãæ¥å£ææ´¾çï¼å ·ä½å½ä»¤é ç½®å¦ä¸ã
(1)å建 VLANã
Switch-A#VLAN database //è¿å ¥ VLAN é ç½®æ°æ®åº
% Warning: It is recommended to configure VLAN from config mode, as VLAN database mode is being deprecated. Please consult user documentation for configuring VTP/VLAN in config mode.
Sw.tch-A(VLAN)#VLAN 2 //å建 VLAN2
VLAN 2 added:
Name: VLAN0002 //ç认 VLAN2 å称
(2)为VLANå½åã
Switch-A(VLAN)#VLAN 2 name office ã为 VLAN2 å½å为 âofficeâ
(3)æ¥å£ææ´¾ã
2ãVLANä¸ç»§
å¨æ²¡æé ç½®VLANä¹åï¼ç±äº¤æ¢æºäºè¿çç½ç»é»è®¤åå±äºVLAN1ãVLAN1ä¹æ¯é»è®¤çæ¬å¾ VLANæ¬å¾VLANæ¯æ交æ¢æºå 许é»è®¤ä¼ è¾ä¿¡æ¯çVLANãå¦å¾2æ示ï¼ä¸¤å°äº¤æ¢æºäºè¿ï¼ææ客æ·ç«¯é»è®¤é½å±äºVLAN1ã
对äºä¸æ¯æ¬å¾VLANçå ¶ä»VLANé»è®¤æ¯ä¸å 许å¨äº¤æ¢æºä¹é´ä¼ è¾ä¿¡æ¯çãå¦å¾3æ示ï¼ææé ç½®VLAN, PC2åPC4ååäºVLAN2,éè¦éè¿äº¤æ¢æºä¹é´çé¾è·¯è¿è¡éä¿¡ï¼ä½æ¯é»è®¤é¾è·¯ä¸å 许é¤æ¬å¾VLAN以å¤çå ¶ä»VLANéè¿ï¼é£ä¹æ¨ªè·¨ä¸¤ä¸ªäº¤æ¢æºåå±äºVLAN2ç客æ·æºå°±æ æ³äºéä¿¡æ¯ã
为äºè§£å³é¾è·¯éè¿å¤æ¡VLANçé®é¢ï¼äº¤æ¢æºç端å£è¢«å®ä¹ä¸ºå ç§æ¨¡å¼ï¼åå«æ¯access (访 é®æ¨¡å¼)ãtrunk (ä¸ç»§æ¨¡å¼)ãdynamic (èªåå模å¼)ã
(1)access (访é®æ¨¡å¼)ï¼è¿æ¥å®¢æ·ç«¯çæ¥å£ä¸è¬ä¸ºaccess模å¼ã
(2) trunk (ä¸ç»§æ¨¡å¼)ï¼å½é¾è·¯éè¦éè¿å¤ä¸ªVLANæ¶ï¼è¯¥é¾è·¯å¿ 须为trunké¾è·¯ã
(3) dynamic (èªåå模å¼)ï¼èªå¨ååï¼å½ä¸ç«¯ä¸ºtrunkæ¶ï¼å¦ä¸ç«¯èªå¨ä¸ºtrunkã
å°ç«¯å£é 置为trunk模å¼çæä½å½ä»¤å¦ä¸ã
Switch-1 (config)#interface fO/O
Switch-1 (config-if)#switchport mode trunk //å¼å¯ trunk 模å¼
Switch-1 (config-if)#switchport trunk native VLAN [VLANID) ãé ç½®æ¬å¾ VLAN,é»è®¤ä¸º VL.AN1 Switch-1 (config-if)#switchport trunk allowed VLAN [WORD/add/all/except/none/remove]
_ ãæå®trunké¾è·¯å 许éè¿çVL.AN.é»è®¤å 许éè¿ææVLAM,ãWORDãæå®VLANåï¼ãaddãæ·»å VLAN, ãallãå 许ææVLAN,ãexceptãé¤æ¤ä¹å¤çææVLAN, [none]ç¦æ¢ææVLANéè¿.ãremoveã移é¤æ VL.AN
3ãVTP
å¨å¤§åçå±åç½ä¸ï¼æ¶åçVLANæ°éå¯è½ä¼å¾å¤ï¼æ¥å¸¸ç管çç»´æ¤å·¥ä½ç¸å¯¹ä¹æ¯è¾ç¹éï¼ åé 人工æä½é¾å ä¼å½±åå·¥ä½æçã为æ¤Ciscoæåºäº VTP (VLANä¸ç»§åè®®)ï¼å©ç¨è¯¥åè®®å¯ä»¥ å®ç°å¿«éçå°åé ç½®ã
VTPçå·¥ä½åçæ¯ï¼å°å°æ°è®¾å¤å®ä¹ä¸ºæå¡å¨ï¼ç³»ç»ä¸è½½å ¶ä»è®¾å¤å®ä¹ä¸ºå®¢æ·ç«¯ï¼å¨æå¡å¨ä¸é ç½®æ æVLAN,并èªå¨åææä¿¡æ¯å¹é ç客æ·ç«¯ååVLANé ç½®åæ¯ã对VLANè¿è¡é ç½®è°æ´æ¶åªé è¦å¨æå¡å¨è®¾å¤è¿è¡æä½å³å¯ã
VTPé ç½®æ¶å¯ä»¥å°è®¾å¤å®ä¹ä¸º3ç§å·¥ä½æ¨¡å¼ï¼åå«æ¯æå¡å¨æ¨¡å¼ã客æ·ç«¯æ¨¡å¼ãéæ模å¼ã
(1)æå¡å¨æ¨¡å¼ï¼å¯ä»¥æ·»å ãå é¤ãä¿®æ¹VLANä¿¡æ¯ï¼å¹¶ä¸å¯ä»¥åå ¶ä»æå¡å¨æ¨¡å¼ç设å¤å¦ ä¹ VLANé 置信æ¯ã
(2)客æ·ç«¯æ¨¡å¼ï¼åªè½åæå¡å¨æ¨¡å¼ç设å¤å¦ä¹ VLANé 置信æ¯ã
(3)éæ模å¼ï¼å¯ä»¥æ·»å ãå é¤ãä¿®æ¹VLANä¿¡æ¯ï¼ä½æ¯ä¸å¦ä¹ æå¡å¨è®¾å¤çVLANé 置信æ¯ãå¯ä»¥è½¬åæå¡å¨è®¾å¤çVLANé 置信æ¯ã