VLAN的配置模式
?? ? ? ? ? VLAN
? ?VLAN端口模式-Access/trunk/dynamic
? ?trunk:該類型鏈路,可以同時承載多個VLAN流量。
? ? ? ? ? ? ? ? 每個VLAN流量,都會打上相應的VLAN標簽(VLAN號)。
? ? ? ? ? ? ? ? 通常是用trunk端口連接的是交換機。
? ? trunk的配置命令:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sw1(config)#interface ?fastethernet 0/2
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sw1(config-if)#SwitchPort mode ?trunk
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 查看:sw1#show ?interface trunk
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ?trunk的VLAN控制:默認情況下,trunk上允許所有VLAN通過,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?如果想控制trunk上的VLAN通信,可以如下
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 命令:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sw1:(config)#interface fastethernet 0/1
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sw1:(config-if)#switchport mode ?trunk
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sw1:(config-if)#switchport trunk allowed ?vlan ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? word ? ? 表示的是VLAN號
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? add ? ? ? ?添加特定的VLAN在現有的允許列表中
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?remove ? 將特定的VLAN在現有的允許列表中移除掉
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? all ? ? ? ? ? 表示的是該VLAN鏈路允許都有的VLAN,這是默認下的指令
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 例:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sw1(config)#interface ?fastethernet ?0/5 ?此時默認允許所有的VLAN
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sw(config-if)#switchport ? trunk ? allowed ?vlan ?20?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 表示該trunk僅允許一個VLAN 20
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sw1(config-if)#switchport ?trunk ? allowed ?vlan ?add ?12
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?表示將vlan 12 ?添加到現有的允許的vlan列表即此刻trunk鏈路同時
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?允許vlan 1/vlan 12/valn 20
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sw1(config-if)#switchport ?trunk ? allowed ?vlan ?remove ?12
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?表示將vlan 12在以上的允許列表中刪除掉,即此刻trunk鏈路有vlan 1/valn 20
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? Access
?????????????????????????
???????????????? Access:該類鏈路,同時只能屬于一個valn,
?????????????????? 通過使用access端口連接的是“非交換機”
???????????????????
????????????????? 注:VLAN的成員中最終端口模式:access? trunk?
????????????????????? 交換機的每個端口連接的都是dynamic(動態模式)
???????????
???????????????????? access鏈路發送出去的數據是不帶任何標簽的。
??????????????
????????? Native VLAN:?
??????????????????????????
???????????????????? trunk鏈路中存在一個特殊的VLAN,叫native vlan (本地/本征VLAN)
???????????????????? 該VLAN中的流量是沒有標簽的,默認值為vlan 1
???????????
?????????????????? native vlan 的修改:
??????????????????????????????????? 默認情況下,trunk 的native vlan 為1
??????????????????????????????????? 該vlan的數據包,經過trunk時,不需要標簽。
??????????????????????????????????? 該vlan中的傳輸的數據包一半是交換機之間的管理協議
??????????????????????????????????? 所以這類數據極為重要,出于安全考慮,我們更改trunk上的native vlan。
??????????????????????????????? 配置:
??????????????????????????????????? SW1:(config)# interface fastethernet 0/23?
??????????????????????????????????? SW1:(config-if)# switchport trunk native vlan 150?
??????????????????????????????????? 查看:SW1# show interface trunk? 查看trunk鏈路
??????????????????????
?????????????????????????????????? 同時必須保證該native vlan 中不能有任何的成員端口。
?????????????????????????????????? 必須使用一個不常用的vla作為native vlan。(范圍0--4095)
?????????????????????????????????? 端口兩邊的native vlan必須相同。
?????????????????????????????????? trunk鏈路建議均手動配置,不能自動配置。
?????????????????????????????????? 同時一定要關閉trunk鏈路上的自動協商功能,即關閉DTP。
? ? ?本文轉自夜流璃雨 51CTO博客,原文鏈接:http://blog.51cto.com/13399294/1974430,如需轉載請自行聯系原作者
總結
- 上一篇: Curl操作es实践
- 下一篇: Intellij导入子项目时,maven