> For the complete documentation index, see [llms.txt](https://anida-huang.gitbook.io/computer-network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anida-huang.gitbook.io/computer-network/qi-mo/20201216-cisco-vlan.md).

# 20201216 cisco VLAN

## 課堂資料

{% embed url="<https://www.cnblogs.com/michael9/p/13360084.html>" %}

{% embed url="<https://www.jannet.hk/zh-Hant/post/vlan-trunking-protocol-vtp/>" %}

### VLAN 的介绍

| Switch      |              |
| ----------- | ------------ |
| broadcast   | 採用"**廣播方式"** |
| multicast   | 採用"**廣播方式"** |
| Fwarding DB | 採用"**廣播方式"** |

{% hint style="info" %}
VLAN TAG 包的 VLAN ID 號，有效範圍是`1-4094`，0 和 4095 都為協議保留值，VLAN ID 0 表示不屬於任何 VLAN。

`1`为系统默认 VLAN，即 Native VLAN。默认情况下，所有的接口都属于 VLAN1. 当交换机收到未带有 VLAN TAG 包的数据帧时，会将数据包转发至 Native VLAN 端口。

`2-1001`是普通的 VLAN，`1006-1024`保留仅系统使用，用户不能查看和使用，`1002-1005`是支持 fddi 和令牌环的 VLAN，`1025-4095`是扩展的 VLAN。
{% endhint %}

### VLAN 802.1q

![802.1q VLAN](/files/-MOd92kGl9wgMdi_iT-f)

### VLAN VTP ( VLAN Trunking Protocol )

> #### VTP mode

| VTP         |                       |
| ----------- | --------------------- |
| Server      | 能創建、刪除、修改 VLAN        |
| Client      | 不能創建、刪除、修改 VLAN，能學習轉發 |
| Transparent | 能創建、刪除、修改 VLAN，不能學習轉發 |

## 課堂練習

### VLAN 802.1q

#### Part 01.&#x20;

![](/files/-MOdhGRrkUlrefc_ukWQ)

{% tabs %}
{% tab title="VPC 2" %}

```
ip 192.168.1.1 255.255.255.0
```

```
ping 192.168.1.2
```

```
ping 192.168.1.3
```

```
ping 192.168.1.4
```

![](/files/-MPMfmuKyclB126E78zL)
{% endtab %}

{% tab title="VPC 3" %}

```
ip 192.168.1.2 255.255.255.0
```

```
ping 192.168.1.1
```

```
ping 192.168.1.3
```

```
ping 192.168.1.4
```

![](/files/-MPMg7znx5kRihZiOVFG)
{% endtab %}

{% tab title="VPC 4" %}

```
ip 192.168.1.3 255.255.255.0
```

```
ping 192.168.1.1
```

```
ping 192.168.1.2
```

```
ping 192.168.1.4
```

![](/files/-MPMhxLOuQ8d3s8C_25v)
{% endtab %}

{% tab title="VPC 5" %}

```
ip 192.168.1.4 255.255.255.0
```

```
ping 192.168.1.1
```

```
ping 192.168.1.2
```

```
ping 192.168.1.3
```

![](/files/-MPMiJj_eB9pJRnJnlaN)
{% endtab %}

{% tab title="SW" %}

```
vlan 10
```

```
name Vlan10
```

```
exit
```

```
vlan 20
```

```
name Vlan20
```

```
do sh vlan brief
```

```
int e0/0
```

```
switchport mode access
```

```
switchport access vlan 10
```

```
int e0/1
```

```
switchport mode access
```

```
switchport access vlan 10
```

```
int e0/2
```

```
switchport mode access
```

```
switchport access vlan 20
```

```
int e0/3
```

```
switchport mode access
```

```
switchport access vlan 20
```

```
do sh vlan brief
```

![](/files/-MPMpFqfluGNw73Lyuzg)
{% endtab %}
{% endtabs %}

#### Part 02.&#x20;

![](/files/-MPMuDuQ-CUlcgTy_FpO)

{% tabs %}
{% tab title="VPC 2" %}

```
ip 192.168.1.1 255.255.255.0
```

```
ping 192.168.1.2
```

```
ping 192.168.1.3
```

```
ping 192.168.1.4
```

![](/files/-MPMssuvwcX38c7Mi_bd)
{% endtab %}

{% tab title="VPC 3" %}

```
ip 192.168.1.2 255.255.255.0
```

```
ping 192.168.1.1
```

```
ping 192.168.1.3
```

```
ping 192.168.1.4
```

![](/files/-MPMt5U3e6C_GLN9-bFW)
{% endtab %}

{% tab title="SW 1" %}

```
vlan 10
```

```
name Vlan10
```

```
exit
```

```
vlan 20
```

```
name Vlan20
```

```
do sh vlan brief
```

```
int e0/0
```

```
switchport mode access
```

```
switchport access vlan 10
```

```
int e0/1
```

```
switchport mode access
```

```
switchport access vlan 20
```

```
int e0/2
```

```
switchport mode access
```

```
switchport access vlan 10
```

```
int e0/3
```

```
switchport mode access
```

```
switchport access vlan 20
```

```
do sh vlan brief
```

![](/files/-MPMs8Z74GTeLludtPcA)
{% endtab %}

{% tab title="VPC 4" %}

```
ip 192.168.1.3 255.255.255.0
```

```
ping 192.168.1.1
```

```
ping 192.168.1.2
```

```
ping 192.168.1.4
```

![](/files/-MPMtJIKVbPB75VqVJxx)
{% endtab %}

{% tab title="VPC 5" %}

```
ip 192.168.1.4 255.255.255.0
```

```
ping 192.168.1.1
```

```
ping 192.168.1.2
```

```
ping 192.168.1.3
```

![](/files/-MPMtZXbUD0ySvvC8VHi)
{% endtab %}

{% tab title="SW 2" %}

```
vlan 10
```

```
name Vlan10
```

```
exit
```

```
vlan 20
```

```
name Vlan20
```

```
do sh vlan brief
```

```
int range e0/0,e0/2
```

```
switchport mode access
```

```
switchport access vlan 10
```

```
int range e0/1,e0/3
```

```
switchport mode access
```

```
switchport access vlan 20
```

```
do sh vlan brief
```

![](/files/-MPMsaBhMcw4G02ChLih)
{% endtab %}
{% endtabs %}

### VLAN VTP

#### Part 01.

![](/files/-MPN6Xdn79eu-_JgX6xK)

{% tabs %}
{% tab title="sw1" %}

> #### VTP Server 設定

```
vtp domain mynet
```

```
vtp password cisco
```

```
do sh vtp status
```

```
do sh vtp password
```

```
vlan 11-15,1006
```

```
do sh vlan brief
```

```
int e0/0
```

```
switchport trunk encapsulation dot1q
```

```
switchport mode trunk
```

```
do sh vlan brief
```

![](/files/-MPN70fRcuYUqlNbWcRz)

![](/files/-MPN8vkS5WHiL04o6eEs)
{% endtab %}

{% tab title="sw2" %}

> #### VTP Client 設定

```
vtp mode client
```

```
vtp domain mynet
```

```
vtp password cisco
```

```
do sh vtp status
```

```
do sh vlan brief
```

```
int e0/0
```

```
switchport trunk encapsulation dot1q
```

```
switchport mode trunk
```

```
do sh vlan brief
```

![](/files/-MPN7UmAp8vNC415t9WH)
{% endtab %}
{% endtabs %}

#### Part 02.

![](/files/-MPNCR2PKUVzUH0cjMxy)

{% tabs %}
{% tab title="sw1" %}

```
no vlan 13
```

```
do sh vlan brief
```

```
no vlan 11
```

```
do sh vlan brief
```

![](/files/-MPNCl87A_9qRYhTEhU2)

```
vlan 20,21,22
```

```
do sh vlan brief
```

![](/files/-MPNCwBiHCIt3sHq1m3S)
{% endtab %}

{% tab title="sw2" %}

```
do sh vlan brief
```

```
no vlan 12
```

```
vlan 16
```

```
int e0/1
```

```
switchport trunk encapsulation dot1q
```

```
switchport mode trunk
```

```
do sh vlan brief
```

```
exit
```

```
vtp mode transparent
```

```
do sh vtp status
```

![](/files/-MPNDxMtrvHvxk9sekW7)

```
do sh vlan brief
```

```
vlan 30
```

```
do sh vlan brief
```

![](/files/-MPNEOoD5dl3dgCb8DD5)
{% endtab %}

{% tab title="sw3" %}

```
vtp mode client
```

```
vtp domain mynet
```

```
do sh vtp status
```

```
do sh vlan brief
```

```
int e0/0
```

```
switchport trunk encapsulation dot1q
```

```
switchport mode trunk
```

```
do sh vlan brief
```

![](/files/-MPNDXP3IVkxmgQgGfQ6)
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://anida-huang.gitbook.io/computer-network/qi-mo/20201216-cisco-vlan.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
