電訊茶室's Archiver

gfx86674 發表於 2018-2-9 06:56

利用兩台Mikrotik Router的switch晶片橋接IPTV與網路

[i=s] 本帖最後由 gfx86674 於 2019-8-5 13:57 編輯 [/i]

在家中橋接網通設備,若中間置入台MOD(IPTV,透過Modem multicast發送)是個很頭痛的問題.
但若是分享器或交換器支援vlan,就容易的多.

以下是用RB450G+RB750GL建置:
[img]https://i.imgur.com/lkXfLef.png[/img]
因這兩台Router的內部交換機晶片可處理vlan標記,
所以就不再使用軟體的bridge ,而是用switch chip.
[attach]4394[/attach][code]#RB450G
/interface bridge add name=bridge

/interface bridge port
add bridge=bridge interface=ether1 hw=yes
add bridge=bridge interface=ether2 hw=yes
add bridge=bridge interface=ether3 hw=yes
add bridge=bridge interface=ether4 hw=yes
add bridge=bridge interface=ether5 hw=yes

/interface ethernet switch port
set ether5 vlan-header=add-if-missing vlan-mode=fallback
set ether1 default-vlan-id=100 vlan-header=always-strip vlan-mode=fallback
set ether2 default-vlan-id=200 vlan-header=always-strip vlan-mode=fallback
set ether3 default-vlan-id=200 vlan-header=always-strip vlan-mode=fallback
set ether4 default-vlan-id=100 vlan-header=always-strip vlan-mode=fallback
set switch1-cpu vlan-header=add-if-missing vlan-mode=fallback

/interface ethernet switch vlan
add ports=ether5,ether1,ether4,switch1-cpu switch=switch1 vlan-id=100
add ports=ether5,ether2,ether3,switch1-cpu switch=switch1 vlan-id=200

/interface vlan
add name=wan vlan-id=100 interface=bridge
add name=lan vlan-id=200 interface=bridge

/ip address
add address=192.168.88.1/24 interface=lan network=192.168.88.0

/ip dhcp-server
add address-pool=dhcp-pool authoritative=after-2sec-delay interface=lan name=DHCP

/interface pppoe-client
add allow=pap interface=wan keepalive-timeout=60 profile=default name=pppoe-out1 password=xxxx user=xxxx[/code][code]#RB750GL
/interface bridge add name=bridge

/interface bridge port
add bridge=bridge interface=ether1 hw=yes
add bridge=bridge interface=ether2 hw=yes
add bridge=bridge interface=ether3 hw=yes
add bridge=bridge interface=ether4 hw=yes
add bridge=bridge interface=ether5 hw=yes

/interface ethernet switch port
set ether5 vlan-header=add-if-missing vlan-mode=fallback
set ether1 default-vlan-id=200 vlan-header=always-strip vlan-mode=fallback
set ether2 default-vlan-id=200 vlan-header=always-strip vlan-mode=fallback
set ether3 default-vlan-id=200 vlan-header=always-strip vlan-mode=fallback
set ether4 default-vlan-id=100 vlan-header=always-strip vlan-mode=fallback
set switch1_cpu vlan-header=add-if-missing vlan-mode=fallback

/interface ethernet switch vlan
add ports=ether5,ether4,switch1-cpu switch=switch1 vlan-id=100
add ports=ether5,ether1,ether2,ether3,switch1-cpu switch=switch1 vlan-id=200

/interface vlan
add name=lan vlan-id=200 interface=bridge

/ip address
add address=192.168.88.2/24 interface=lan network=192.168.88.0[/code]

角色 發表於 2018-2-10 16:03

CHing,因为我们不太熟悉MOD的要求,所以不太明白有什么难度(不是没有难度,而不知道有什么难度),我的理解MOD是一个IP播放器,它们之间对modem又有什么要求呢?

(看你的scripts就像看小说一样!!!哈哈!)

gfx86674 發表於 2018-2-10 20:50

[i=s] 本帖最後由 gfx86674 於 2018-2-10 21:08 編輯 [/i]

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=44184&ptid=7086]2#[/url] [i]角色[/i] [/b]
MOD是中華電信提供的IPTV服務. 透過Modem發送mutilcast(組播封包)
將封包"廣播"到Modem所有的port ,讓Modem上所有port都能串接IPTV主機(MOD)

所以只要接到Modem的任何機器都會收到10.0.0.0/24格式的封包.
因這些封包是加密且是組播限定對象 ,所以只有特定的裝置(MOD主機)才能解譯內容.

因mutilcast不受路由表管理 ,所以router無法轉發路徑.
所以mutilcast只要一進入router的wan ,會被當無效的封包直接丟棄.

過去曾有人嘗試透過線 ,從Modem直連router的Lan ,躲避封包在wan被丟棄.
但結果更糟 ,mutilcast竟在router所有Lan port廣播起來,
造成所有使用router網路的電腦都同時收到mutilcast封包.
mutilcast封包會佔據每個網卡通道寬, 造成網路瀏覽延遲(Broadcast Storm廣播風暴)

但這樣IPTV(MOD)能觀看嗎? 還是不行...
因為router送出的dhcp要求也是mutilcast封包,只是性質不同.

結果IPTV(MOD)收到兩組mutilcast影響解碼 ,TV上看到的都是類似方格綠綠的馬賽克.
淒慘啊~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
所以在台灣 ,MOD傳輸幾乎都是靠專線從Modem拉進客廳或臥室.
若是牆壁沒管線可塞專線 ,那線可能拉的像室外影響了美觀.

所以透過vlan ,
將mutilcast送入專門的隧道,
這樣就不會在router的wan端被丟棄 ,也不會廣播到Lan上其它的電腦.
MOD主機也不會收到dhcp廣播.

而且不管MOD有多少台 ,透過vlan只要一條網路線路就好. 解決配線與居家裝潢的問題.
一條網路線可切5000多個vlan ,對家庭來已很足夠了.

角色 發表於 2018-2-10 21:55

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=44198&ptid=7086]3#[/url] [i]gfx86674[/i] [/b]

谢谢CHing的详细讲解关于MOD机的特性的网络需求。如果按照你这样settings,第二台MOD可以放到别的地方,例如大陆。怎样实现?我估计可以把两个RouterOS通过layer2+vlan连接(是否可行?) 因为本人对vlan是初级认识阶段(通过CCNA),而在RouterOS没有用过, 请Ching指教。

gfx86674 發表於 2018-2-10 22:57

[i=s] 本帖最後由 gfx86674 於 2019-6-27 00:57 編輯 [/i]

[quote]回復  gfx86674

谢谢CHing的详细讲解关于MOD机的特性的网络需求。如果按照你这样settings,第二台MOD可以 ...
[size=2][color=#999999]角色 發表於 2018-2-10 21:55[/color] [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=44200&ptid=7086][img]http://www.telecom-cafe.com/forum/images/common/back.gif[/img][/url][/size][/quote]您有CCNA認證...我大概只有鍵盤等級,翻Google搜尋的宅男.

gfx86674 發表於 2019-6-27 01:17

[i=s] 本帖最後由 gfx86674 於 2019-6-27 01:22 編輯 [/i]

06/27/2019更新switch chip vlan。

真心覺得諸位求便宜也不能收RB750Gr3,
CPU不能扛,連switch chip也是個半吊子(MT7621),買了肯定後悔。

角色 發表於 2019-6-27 16:58

谢谢CHing信息,如果不用RB750Gr3,那么用哪个model比较适合呢?是否都要用RB450呢?

gfx86674 發表於 2019-6-27 19:44

[i=s] 本帖最後由 gfx86674 於 2019-6-27 20:15 編輯 [/i]

[quote]谢谢CHing信息,如果不用RB750Gr3,那么用哪个model比较适合呢?是否都要用RB450呢? ...
[size=2][color=#999999]角色 發表於 2019-6-27 16:58[/color] [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=47295&ptid=7086][img]http://www.telecom-cafe.com/forum/images/common/back.gif[/img][/url][/size][/quote]
[url=https://wiki.mikrotik.com/wiki/Manual:Switch_Chip_Features]Manual:Switch Chip Features[/url]
低階的Router使用vlan盡量選擇有switch chip能力的。
高階的話有switch chip最好,但CPU強大到能用運算硬扛其實也沒問題。

RB450G已經夠老了,若只是想作為vlan用途,
還不如直接購買台vlan switch(如:Mikrotik RB260GS)還較便宜又實際。

gfx86674 發表於 2019-7-9 11:57

[i=s] 本帖最後由 gfx86674 於 2019-7-9 12:03 編輯 [/i]

若橋接的不是RB750GL,而是RB260GS(SwOS)呢?
只要懂得vlan-heard與vlan-mode作用,其實是不會有困難的:
[attach]4398[/attach]

[attach]4399[/attach]

[attach]4400[/attach]

sssss2sssss 發表於 2019-7-17 10:34

[i=s] 本帖最後由 sssss2sssss 於 2019-7-17 10:36 編輯 [/i]

现有中国电信4k iptv。物理布局看起来相同。

想要达成一样的效果可以看4k iptv,换哪两种路由适合?

第一台路由需要能翻(v2ray)。

第二台路由客厅电视柜下,需要讯号比较强的。谢谢!

gfx86674 發表於 2019-7-17 13:05

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=47340&ptid=7086]10#[/url] [i]sssss2sssss[/i] [/b]
我的建議是RB450Gx4 + hap ac^2(俱IEEE802.11n與ac雙頻wifi )。
這兩組合switch chip皆為Atheros8327,
除vlan為主要需求可橋接外,還有PoE供電。

RB450Gx4 eth5有PoE output的功能,hap ac^2 eth2則支援PoE input。
所以只要將RB450Gx4的eth5,接上hap ac^2的eth2,
hap ac^2不需供電(不裝變壓器)就能從eth2取得電力工作。這很棒吧,不是嗎?{:4_163:}

sssss2sssss 發表於 2019-7-17 15:03

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=47341&ptid=7086]11#[/url] [i]gfx86674[/i] [/b]


    PoE能稳定hap ac2的双频wifi ?
    也许我可以把PoE用到房间的面板wifi上。
    准备购买!

asd82242002 發表於 2019-7-17 23:17

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=47294&ptid=7086]6#[/url] [i]gfx86674[/i] [/b]


GFX大大您好
因為在還沒看到這篇文章前已購入了兩台RB750Gr3,若將本文的設置方式從switch vlan改為bridge vlan,是可行的嗎?

gfx86674 發表於 2019-7-18 15:09

[i=s] 本帖最後由 gfx86674 於 2019-7-24 13:02 編輯 [/i]

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=47352&ptid=7086]13#[/url] [i]asd82242002[/i] [/b]
設定方式不一樣,bridge vlan有專屬的作法。
若把#1樓範例的兩台Router都換成RB750Gr3需要這樣做:[code]#RB750Gr3(A)
/interface bridge add name=bridge

/interface bridge port
add bridge=bridge interface=ether1 hw=no pvid=100
add bridge=bridge interface=ether2 hw=no pvid=200
add bridge=bridge interface=ether3 hw=no pvid=200
add bridge=bridge interface=ether4 hw=no pvid=100
add bridge=bridge interface=ether5 hw=no

/interface bridge vlan
add bridge=bridge tagged=bridge,ether5 untagged=ether1,ether4 vlan-ids=100
add bridge=bridge tagged=bridge,ether5 untagged=ether2,ether3 vlan-ids=200

/interface vlan
add name=wan vlan-id=100 interface=bridge
add name=lan vlan-id=200 interface=bridge

/ip address
add address=192.168.88.1/24 interface=lan network=192.168.88.0

/interface bridge
set bridge vlan-filtering=yes

/ip dhcp-server
add address-pool=dhcp-pool authoritative=after-2sec-delay interface=lan name=DHCP

/interface pppoe-client
add allow=pap interface=wan keepalive-timeout=60 profile=default name=pppoe-out1 password=xxxx user=xxxx[/code][code]#RB750Gr3(B)
/interface bridge add name=bridge

/interface bridge port
add bridge=bridge interface=ether1 hw=no pvid=200
add bridge=bridge interface=ether2 hw=no pvid=200
add bridge=bridge interface=ether3 hw=no pvid=200
add bridge=bridge interface=ether4 hw=no pvid=100
add bridge=bridge interface=ether5 hw=no

/interface bridge vlan
add bridge=bridge tagged=bridge,ether5 untagged=ether4 vlan-ids=100
add bridge=bridge tagged=bridge,ether5 untagged=ether1,ether2,ether3 vlan-ids=200

/interface vlan
add name=lan vlan-id=200 interface=bridge

/ip address
add address=192.168.88.2/24 interface=lan network=192.168.88.0

/interface bridge
set bridge vlan-filtering=yes[/code]問題在於,當IPTV影像超過FHD(1080P),甚至達4K時...
RB750Gr3 CPU能否扛得住大廣播封包的轟炸,
扛不住可能會有影像破圖,聲音趕不上畫面,這類不悅的事件發生。

假如真的發生不幸怎麼辦,那也不倒是不能解決。
只不過需換個方式,不使用vlan,改使eoip tunnel即可。

gfx86674 發表於 2019-7-18 15:40

[i=s] 本帖最後由 gfx86674 於 2019-7-18 16:23 編輯 [/i]

EOIP的做法:[code]#RB750Gr3(A)
/interface bridge
add name=bridge-wan protocol-mode=none
add name=bridge-lan

/ip address
add address=192.168.255.254/31 interface=bridge-wan network=192.168.255.254
add address=192.168.88.1/24 interface=bridge-lan network=192.168.88.0

/interface eoip
add local-address=192.168.255.254 name=eoip remote-address=192.168.255.255 tunnel-id=75

/interface bridge port
add bridge=bridge-wan interface=ether1 hw=yes
add bridge=bridge-wan interface=ether4 hw=yes
add bridge=bridge-wan interface=ether5 hw=yes
add bridge=bridge-lan interface=ether2 hw=no
add bridge=bridge-lan interface=ether3 hw=no
add bridge=bridge-lan interface=eoip

/ip dhcp-server
add address-pool=dhcp-pool authoritative=after-2sec-delay interface=bridge-lan name=DHCP

/interface pppoe-client
add allow=pap interface=bridge-wan keepalive-timeout=60 profile=default name=pppoe-out1 password=xxxx user=xxxx[/code][code]#RB750Gr3(B)
/interface bridge
add name=bridge-wan protocol-mode=none
add name=bridge-lan

/ip address
add address=192.168.255.255/31 interface=bridge-wan network=192.168.255.254
add address=192.168.88.2/24 interface=bridge-lan network=192.168.88.0

/interface eoip
add local-address=192.168.255.255 name=eoip remote-address=192.168.255.254 tunnel-id=75

/interface bridge port
add bridge=bridge-wan interface=ether5 hw=yes
add bridge=bridge-wan interface=ether4 hw=yes
add bridge=bridge-wan interface=ether1 hw=no
add bridge=bridge-lan interface=ether2 hw=no
add bridge=bridge-lan interface=ether3 hw=no
add bridge=bridge-lan interface=eoip[/code]EOIP 與#14樓vlan運作上有何差異呢?
RB750Gr3的switch chip(MT7621)雖無vlan table,但仍俱port switch功能。
所以EOIP的目的即IPTV廣播交由MT7621處理;CPU則只要負責處理Lan的封包就好。

而#13樓CPU則全全負責IPTV與Lan,不只是CPU處理IPTV封包有疑慮,
CPU滿載時IPTV與Lan也會互有誰的封包優先進出,造成干擾...

Lan的封包排後頂多是延遲,但IPTV封包一延遲則所有不利媒體的問題則會通通跑出來。
這也是我不信任bridge vlan的原因。

asd82242002 發表於 2019-7-18 23:41

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=47354&ptid=7086]14#[/url] [i]gfx86674[/i] [/b]

感謝大大熱心回覆
今天下午撥空小試了一下,結果發現PPPOE部份似乎沒有設定好,導致不能正常上網。DHCP部份有分配到區IP,所以沒問題。
另外想請教一下,interface bridge port 有需要各別設置pvid嗎?
還是只要interface bridge vlan設定好就可以呢?

gfx86674 發表於 2019-7-19 02:37

[i=s] 本帖最後由 gfx86674 於 2019-7-19 02:51 編輯 [/i]

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=47358&ptid=7086]16#[/url] [i]asd82242002[/i] [/b]
謝謝您的指教,錯誤的確在pvid沒加。
已修正內文,請您再嘗試設置。

另外若遇到/interface bridge vlan新增後不允許儲存,
有可能是[color=Red]預設啟用的fast forward[/color]正在運作不允許變更port,
只要在bridge關閉它(取消勾選)即可。
[attach]4401[/attach]

asd82242002 發表於 2019-7-22 21:33

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=47359&ptid=7086]17#[/url] [i]gfx86674[/i] [/b]


感謝大大的幫忙,非常順利的設定完成(使用bridge方式)
有稍微測試一下,發現MOD開機的時候,讀取頻道速度稍微變慢,Router CPU使用率還OK。
之後再撥空使用大大另外推薦的EOIP方式看看,感謝

gfx86674 發表於 2019-7-23 22:07

[i=s] 本帖最後由 gfx86674 於 2019-7-25 11:46 編輯 [/i]

若橋接的不是RB750GL,而是Netgear GS105E呢?
[attach]4411[/attach]
[attach]4409[/attach]
[attach]4412[/attach]
[attach]4405[/attach]
[attach]4406[/attach]
[attach]4410[/attach]

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.