修改 trunk 的 native vlan

interface GigabitEthernet0/1
switchport access vlan 2
switchport mode access
interface GigabitEthernet0/2
switchport access vlan 2
switchport mode access
無線網路發一個 SSID Employee,然後AP01和控制器透過Vlan2溝通,由於是access port,因此 SSID Employee 也只能在 Vlan 2網段。

連上 Emlopyee 確實拿到一個 172.16.100.0/24 的網段。
interface GigabitEthernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
由於SSID Emlopyee 要改成帶tag Vlan3,並新增一個SSID Guest 要帶tag Vlan4,能讓多個Vlan通過只可能是trunk port,所以我們把G0/2改成trunk。



這時候AP和控制器失聯變成獨立運作模式,而且我們連上SSID之後居然拿到vlan1的網段,原來是因為trunk預設是native vlan1,所以只要收到不帶tag的封包都會往vlan1丟。
interface GigabitEthernet0/2
switchport trunk encapsulation dot1q
switchport trunk native vlan 2
switchport mode trunk

我們把native vlan改成vlan2 ,這樣trunk收到不帶tag的封包才會往vlan2丟。

這樣AP就連回來了,有些AP支援修改管理vlan,就是管理IP也可以帶tag出去,但我們這款AP不支援,所以只能用這種方式。
或許你會想說為什麼一定要同網段,你可能看過不同網段也可以透過Routing的方式讓AP找到控制器,但是我們的例子是不想修改原本AP的設定,或是他一定需要同網段才可以溝通。


我們修改SSID,並使它帶對應的tag出去。


連到相對應的SSID,因為帶了不同的vlan tag,所以我們拿到不同的IP網段。
結論:
一般電腦的封包都不會帶tag,所以都是untag封包,會成為哪個vlan都是由port決定的,如果是access vlan 多少,它就會成為多少的vlan,電腦沒有控制權,無線基地台如果流量不回控制器的話,他除了需要管理IP與控制器溝通以外,還可能會發很多SSID帶不同的tag,所以這port勢必是trunk,但是管理IP可能基於某種情況下不能自己帶tag,這時候就可以控制native vlan,使trunk port 收到沒有帶tag的封包把他丟到和控制器同個vlan去。
獲益良多
回覆刪除