Shunze 學園 >電腦資訊學系 >硬底子 > 《分享》語音資料分流之VLAN切割架構 哈囉,還沒有註冊或者登入。請你[註冊|登入]
« 上一篇主題 下一篇主題 » 顯示成列印模式 | 增加到我的最愛
發表新主題 發表回覆
作者
主題
shunze
工友伯伯


註冊日期: 2002 04
來自: 潮汐終止之地
文章: 2370

shunze 離線
《分享》語音資料分流之VLAN切割架構引用回覆 編輯/刪除文章 搜尋由  發表的其他文章 回報給版主 IP 位置 回此頁最上方

公司是做客服的,隨著客服人員增加,內部網路最大的問題,
就是所有網路設備均在相同網段,造成封包擁塞,干擾到IP話機的VoIP封包傳遞。

其實公司的IP話機是可以設定VLAN的。
它本身有兩個網路孔,LAN port用來接到Switch,另一個網路孔則可用來串接電腦。

在啟用VLAN後,IP話機本身LAN Port的VLAN是2,
而透過IP話機串接出去的Port則為VLAN 3。

只要IP話機的LAN port串接到能設定VLAN的Switch後,
基本上就能做到VoIP與data分流的VLAN架構。



以下我們就以Cisco的L2+L3 Switch來實作VoIP與data分流。

  1. VLAN網段規劃
    本例共切了3個vlan,預設的vlan 1給server farm使用,
    IP話機使用vlan 2,IP話機串接之PC則使用vlan 3。



    Vlan 1為預設vlan無法修改名稱,但vlan 2及3則可修改名稱。
    # configure terminal
    (config)# vlan 2
    (config-vlan)# name VoIP
    (config)# vlan 3
    (config-vlan)# name Data




    套用VTP協定傳播Vlan設定
    L3 Switch做為VTP Server
    # configure terminal
    (config)# vtp domain CISCO
    (config)# vtp mode server
    (config)# vtp password cisco


    L2 Switch做為VTP Client
    # configure terminal
    (config)# vtp domain CISCO
    (config)# vtp mode client
    (config)# vtp password cisco


  2. Switch VLAN IP規劃設定
    L3 Switch (VLAN 1) 172.29.16.253/255.255.252.0
    L3 Switch (VLAN 2) 172.29.20.254/255.255.254.0
    L3 Switch (VLAN 3) 172.29.22.254/255.255.254.0
    L2 Switch (VLAN 1) 172.29.16.252/255.255.252.0 GW 172.29.16.254

    L3 Switch IP設定
    L3 Switch欲啟用routing,故沒有default gateway。
    (config)# interface vlan 1
    (config-if)# ip address 172.29.16.253 255.255.252.0
    (config)# interface vlan 2
    (config-if)# ip address 172.29.20.254 255.255.254.0
    (config)# interface vlan 3
    (config-if)# ip address 172.29.22.254 255.255.254.0


    L2 Switch IP設定
    L2 Switch沒有routing功能,所以要設定default gateway。
    (config)# interface vlan 1
    (config-if)# ip address 172.29.16.252 255.255.252.0
    (config)# ip default-gateway 172.29.16.254


  3. L2 Switch Trunk/Access設定
    介面fa 0/1-20 Trunk Allow Vlan 2,3,用來接IP話機。
    # configure terminal
    (config)# interface range fa 0/1-20
    (config-if-range)# switchport mode trunk
    (config-if-range)# switchport trunk allow vlan 2,3


    介面fa 0/21-24 Access Vlan 3,用來接一般電腦。
    # configure terminal
    (config)# interface range fa 0/21-24
    (config-if-range)# switchport mode access
    (config-if-range)# switchport access vlan 3


    介面gi 0/1-2 Channel-Group LACP, Trunk Allow Vlan 1,2,3,用來與L3 Switch串接。
    # configure terminal
    (config)# interface range gi 0/1-2
    (config-if-range)# channel-group 1 mode active
    (config-if-range)# channel-protocol lacp
    (config)# interface port-channel 1
    (config-if)# switchport mode trunk
    (config-if)# switchport trunk allow vlan 1,2,3



  4. L3 Switch Trunk/Access設定
    介面fa 0/1-24 Access Vlan 1,用來接server farm的主機。
    # configure terminal
    (config)# interface range fa 0/1-24
    (config-if-range)# switchport mode access
    (config-if-range)# switchport access vlan 1


    介面gi 0/1-2 Channel-Group LACP, Trunk Allow Vlan 1,2,3,用來串接L2 Switch。
    # configure terminal
    (config)# interface range gi 0/1-2
    (config-if-range)# channel-group 1 mode active
    (config-if-range)# channel-protocol lacp
    (config)# interface port-channel 1
    (config-if)# switchport trunk allow vlan 1,2,3



  5. L3 Switch Multi DHCP Pool設定
    設定兩個DHCP Pool
    (config)# ip dhcp pool DHCP-VLAN2
    (dhcp-config)# network 172.29.20.0 255.255.254.0
    (dhcp-config)# default-router 172.29.20.254
    (dhcp-config)# dns-server 172.29.16.1
    (config)# ip dhcp pool DHCP-VLAN3
    (dhcp-config)# network 172.29.22.0 255.255.254.0
    (dhcp-config)# default-router 172.29.22.254
    (dhcp-config)# dns-server 172.29.16.1


    套用vlan對應DHCP Pool,讓兩個vlan可透過各自的DHCP Pool配發IP
    (config)# interface vlan 2
    (config-if)# ip helper-address 172.29.20.254
    (config)# interface vlan 3
    (config-if)# ip helper-address 172.29.22.254


    排除某些IP的配發
    (config)# ip dhcp excluded-address 172.29.20.254
    (config)# ip dhcp excluded-address 172.29.22.254


    排除某區段IP的配發
    (config)# ip dhcp excluded-address 172.29.20.1 172.29.20.20
    (config)# ip dhcp excluded-address 172.29.22.1 172.29.22.20


    檢視DHCP配發狀態
    # show ip dhcp binding
    # show ip dhcp server statistics


  6. L3 Switch Routing設定
    啟用L3 Switch路由功能,並加一筆預設路由導向router 172.29.16.254。
    # configure terminal
    (config)# ip routing
    (config)# ip route 0.0.0.0 0.0.0.0 172.29.16.254


    檢視路由
    # show ip route
    172.29.0.0/16 is variably subnetted, 3 subnets, 2 masks
    C 172.29.16.0/22 is directly connected, Vlan4
    C 172.29.20.0/23 is directly connected, Vlan2
    C 172.29.22.0/23 is directly connected, Vlan3
    S* 0.0.0.0/0 [1/0] via 172.29.16.254



  7. 防火牆設定
    Server區所在的vlan 1 default gateway是172.29.16.254,
    需於172.29.16.254上增加一筆導向vlan 2,3的路由,
    這樣vlan 1與2,3網段才能互通。
    (config)# ip route 172.29.20.0 255.255.252.0 172.29.16.253


    但也因為如此,vlan 1到vlan 2,3的路由有2個節點,而vlan 2,3到vlan 1有只有1個節點,
    造成了vlan 1與vlan 2,3間有不對稱路由的情況發生。

    若防火牆本身比較嚴謹,會阻擋不對稱路由的封包,
    則需要在防火牆上設定不對稱路由bypass,這樣各vlan間才能正常傳導!


附件為本例之PacketTracer 6.0 sample,login及enable密碼均為cisco。

shunze 上傳的檔案
VoIP_Data_Vlan.zip (43 KB, 已經被下載 1350 次)


♥順子老婆的網拍,請多關照∼

If you don't like something, change it.
If you can't change it, change your attitude.
Don't complain!




2013-10-24, 21:17 shunze 的個人資料 把 shunze 加入好友列表 發送Email給 shunze 瀏覽 shunze 的網站 MSN : shunze@gmail.com
shunze
工友伯伯


註冊日期: 2002 04
來自: 潮汐終止之地
文章: 2370

shunze 離線
《分享》L3 Switch VLAN的ACL設定引用回覆 編輯/刪除文章 搜尋由  發表的其他文章 回報給版主 IP 位置 回此頁最上方

在設定好了vlan間的routing後,
各vlan間算是已完全分離,彼此網段不再互相干擾。

但如果我們想更進一步,讓vlan 2與3完全區隔,不能夠互相連通,
只留下必要的vlan 1能與vlan 2, 3進行溝通,
那我們可以在負責routing的L3 Switch上設定vlan的Access Control List。

Cisco的Access Control List (ACL)有兩種型式-Standard / Extented,
及Numbered / Named的兩種模式。


Standard ACL 只能使用1∼99與1300∼1999間的號碼;
且只能指定source IP,無法指定destination IP,設定時需思考方向性的對應以滿足合需求。

Extented ACL 只能使用100∼199與2000∼2699間的號碼;
可指定source與destination IP,且能對應IP,Port,Protocol來分別處理。

在Cisco的ACL中,每一個介面(vlan),每一個方向(in / out)只能對應一條ACL。
若設定了多條ACL,則最新的ACL將會取代舊的ACL。
而這 in / out 的方向性,則是從 routing 物件的角度來看。




以下我們就以 Standard ACL 來示範如何設定vlan 2拒絕vlan 3的連入。

Standard ACL指令如下

access-list NO. permit/deny source-IP wildcard-mask


Vlan 2要拒絕vlan 3 172.29.22.0/23網段的連入,
就 in 的方向而言,source為172.29.20.0/23,而destination為172.29.22.0/23;
就 out 的方向而言,source為172.29.22.0/23,而destination為172.29.20.0/23。
而standard ACL僅能指定source IP,所以只有 out 方向的規則適合需求。

設定指令如下
(config)# access-list 2 deny 172.29.22.0 0.0.1.255
(config)# access-list 2 permit 0.0.0.0 255.255.255.255
(config)# interface vlan 2
(config-if)# ip access-group 2 out


設定時要注意,ACL跟一般防火牆規則一樣,採逐條比對方式,最後不符的全部擋掉,
所以設定時,除了deny vlan 3 172.29.22.0/23網段的連入外,
還要加上一條其餘放行 permit any 的規則,
否則不僅vlan 3 172.29.22.0/23網段擋掉了,其它網段也無法通行。

另外,ACL的網段採wildcard mask,與一般的子網路遮罩不同,
順子不知道要怎麼解釋,但它剛好就是與一般子網路遮罩相反。

例如,子網路遮罩255.255.255.255,wildcard mask就會是0.0.0.0;
子網路遮罩255.255.255.0,wildcard mask就會是0.0.0.255.
而本例中的172.29.20.0/23網段,其wildcard mask會是0.0.1.255。

設定完後,分別在vlan 2與vlan 3互ping對方,
會有如下結果。
vlan 2 ping vlan 3
Request timed out.

vlan 3 ping vlan 2
Reply from 172.29.22.254: Destination host unreachable.

之所以會有這樣的結果差異,在於vlan 2是可以連到vlan 3的,
但vlan 3無法回傳,所以出現Request timed out.目的地主機沒有回應。
而vlan 3因ACL規則阻擋,所以到不了vlan 2,
因此出現Reply from 172.29.22.254: Destination host unreachable.目的地主機無法到達。
兩者意義不同,回應的訊息自然也不同。


接下來我們再以 Extented ACL 來示範如何設定vlan 3拒絕vlan 2的連入。

Extented ACL指令如下
access-list NO. permit/deny ipx/ip/icmp/tcp/udp source-IP wildcard-mask destination-IP wildcard-mask {eq portocol}


套用在本例vlan 3拒絕vlan 2的連入,out 方向指令為
(config)# access-list 103 deny ip 172.29.20.0 0.0.1.255 172.29.22.0 0.0.1.255
(config)# access-list 103 permit ip 0.0.0.0 255.255.255.255 172.29.22.0 0.0.1.255
(config)# interface vlan 3
(config-if)# ip access-group 103 out


若以 in 方向來設計,讓vlan 3拒絕vlan 2的連入,則需下在vlan 2介面上,其指令為
(config)# access-list 102 deny ip 172.29.20.0 0.0.1.255 172.29.22.0 0.0.1.255
(config)# access-list 102 permit ip 172.29.20.0 0.0.1.255 0.0.0.0 255.255.255.255
(config)# interface vlan 2
(config-if)# ip access-group 102 in


雖然透過Extented ACL在 in / out 兩個方向都可成功達成目的,
但在 in 是 vlan 2 在進入 routing 物件時,就被拒絕;
而 out 則是進入 routing 物件後,再轉到到 vlan 3 時,才被拒絕,
因此 in 方向的過濾效率會比 out 方向還高。




PS.
所有網段主機在子網路遮罩的表示方式為 0.0.0.0 0.0.0.0;
以wildcard mask表示方式為0.0.0.0 255.255.255.255。
在ACL中,也可以用 any 來表示。
例如 access-list 2 permit 0.0.0.0 255.255.255.255,就可用 access-list 2 permit any 來設定。



♥順子老婆的網拍,請多關照∼

If you don't like something, change it.
If you can't change it, change your attitude.
Don't complain!




2013-10-28, 21:47 shunze 的個人資料 把 shunze 加入好友列表 發送Email給 shunze 瀏覽 shunze 的網站 MSN : shunze@gmail.com
shunze
工友伯伯


註冊日期: 2002 04
來自: 潮汐終止之地
文章: 2370

shunze 離線
《分享》語音資料分流的架構二引用回覆 編輯/刪除文章 搜尋由  發表的其他文章 回報給版主 IP 位置 回此頁最上方

上文語音資料分流之VLAN切割是基於公司既有環境下所做的調整,
尤其是位於172.29.16.XX的server區不能隨意變更配置網段,
所以才會造成防火牆與L3 Switch間不對稱路由的形成。

若整個環境為新建置環境,
在建置初期,我們可以將server放在防火牆的DMZ區段,
與使用者PC與IP話機網段進行完整區段。

然後防火牆與L3 Switch間以另一個獨立網段連接,
並在防火牆與L3 Switch上設定好路由導向,
那麼就可以避免不對稱路由的情形發生,
語音資料分流的架構就更理想了∼




附件為本例之PacketTracer 6.0 sample,login及enable密碼均為cisco。

shunze 上傳的檔案
VoIP_Data_Vlan_1.zip (45 KB, 已經被下載 1194 次)


♥順子老婆的網拍,請多關照∼

If you don't like something, change it.
If you can't change it, change your attitude.
Don't complain!




2013-11-23, 21:47 shunze 的個人資料 把 shunze 加入好友列表 發送Email給 shunze 瀏覽 shunze 的網站 MSN : shunze@gmail.com
  « 上一篇主題 下一篇主題 »
發表新主題 發表回覆
跳到:

Powered by: Burning Board 1.1.1 2001 WoltLab GbR