spicahan 发表于 2011-10-8 19:08:18

G300NH 用交换机硬件处理 FTTH IPTV VLAN的方法

作为 FTTH IPTV VLAN 系列的最后一篇帖子,留给需要的人。

相关的内容请见之前发过的帖子:

H618C 刷 OpenWrt 并支持 IPTV VLAN 硬件处理的方法

关于用软件VLAN处理IPTV的方法

"软件处理"这篇帖子最后还介绍了用华硕 RT-N16 的硬件VLAN处理的方法。不过 RT-N16 价格比较高,相比之下 G300NH 要便宜一些。

大概的过程:刷 OpenWrt trunk, 然后改 /etc/config/network 的设置,见下面:config interface loopback
      option ifname   lo
      option proto    static
      option ipaddr   127.0.0.1
      option netmask255.0.0.0

config interface lan
      option ifname   eth0.1
      option type   bridge
      option proto    static
      option ipaddr   192.168.2.1
      option netmask255.255.255.0

config interface wan
      option ifname   eth0.81
      option proto    pppoe
      option username 'username'
      option password 'password'

config switch
      option name   switch0
      option reset    1
      option enable_vlan 1
      option enable_vlan4k 1

config switch_vlan vlan_lan
      option device   switch0
      option vlan   1
      option ports    "1 5t"

config switch_vlan vlan_iptvm
      option device   switch0
      option vlan   51
      option ports    "0t 2 3"

config switch_vlan vlan_iptvu
      option device   switch0
      option vlan   85
      option ports    "0t 2 3"

config switch_vlan vlan_wan
      option device   switch0
      option vlan   81
      option ports    "0 5t"用的时候,WAN口不接,紧靠WAN口的那个LAN口接光猫,旁边一个可以上网,剩下两个口接IPTV机顶盒。

tangsoft 发表于 2013-4-2 11:34:41

chmjiong 发表于 2012-8-2 12:31 static/image/common/back.gif
指定了PVID后,仍然无法避免0t 1被改为0t 1t
现在基本可以肯定是这个原因导致wan罢工,另外,vlan51如何 ...

和你的MR4530类似,最近掉到WNDR4300的ar8327和nand flash的坑里了,所以翻出来这个账号,重新开始折腾。因为openwrt还不支持这个型号上的nand,所以刷了dd-wrt。
看过ar8327的data sheet,vlan支持是很全面的:
The AR8327 switch supports many VLAN options including IEEE 802.1Q and port-based VLANs. The
AR8327 supports 4096 IEEE 802.1Q VLAN groups and 4K VLAN table entries, and the AR8327 device
checks VLAN port membership from the VLAN ID, extracted from the tag header of the frame. Table
2-18 shows the AR8327-supported 802.1Q modes. The port-based VLAN is enabled according to the
user-defined PORT VID value. The AR8327 supports optional discards of tagged, untagged frames,
and priority tagged frames. The AR8327 also supports untagging of the VLAN ID for packets going
out on untagged ports on a per-port basis.

不过还在看3.8 trunk里的ar8216.c的switch source code,毕竟不太会编程,还没搞清楚。不过看到ar8xxx_sw_set_ports(struct switch_dev *dev, struct switch_val *val)有一个函数有个注释:
1379                                /* make sure that an untagged port does not
1380                               * appear in other vlans */
1381                                for (j = 0; j < AR8X16_MAX_VLANS; j++) {
1382                                        if (j == val->port_vlan)
1383                                              continue;
1384                                        priv->vlan_table &= ~(1 << p->id);

这句话大概可以解释为什么0t 1会被改成0t 1t。

spicahan 发表于 2011-11-8 07:06:11

argos 发表于 2011-11-6 22:18 static/image/common/back.gif
请教一下,用G300NH可以将WAN口利用起来吗?为什么RT-N16那个方案就不会浪费WAN口?虽然一个是AR一个是BRCM ...

这个是因为,RT-N16的WAN口和那四个LAN口其实是在一个交换机上的,只是出厂默认分配了不同的VLAN人为分出了WAN口和LAN口,换句话说那五个口就是一样的。
G300NH的WAN口是真正的WAN口,这个WAN口物理上就没和交换机连在一起。
要利用起来的话也是可以的,只是WAN和LAN之间的任何数据交换都必须经过CPU转发了,这样就变成了基于软件的方案了。具体到FTTH IPTV VLAN这个例子,可以把这个WAN口当成最不常用的一个LAN口来用,在OpenWrt/DDWRT里用 brctl 把WAN口桥接到LAN就行了。

argos 发表于 2011-11-6 22:18:28

请教一下,用G300NH可以将WAN口利用起来吗?为什么RT-N16那个方案就不会浪费WAN口?虽然一个是AR一个是BRCM,但结构应该是相似的吧?

argos 发表于 2011-11-8 23:51:31

多谢指教!最近研究了一下,貌似新出的G300NH2的WAN口和RT-N16一样是VLAN模拟出来的,价钱又比较便宜(减配了内置天线{:soso_e101:}),打算折腾一下它了。

spicahan 发表于 2011-11-9 07:45:28

argos 发表于 2011-11-8 23:51 static/image/common/back.gif
多谢指教!最近研究了一下,貌似新出的G300NH2的WAN口和RT-N16一样是VLAN模拟出来的,价钱又比较便宜(减配了 ...

NH2缩水很多,而且OpenWrt可能还不支持,要三思啊

fangyn 发表于 2011-12-23 14:22:24

spicahan 发表于 2011-12-24 11:45:49

fangyn 发表于 2011-12-23 14:22 static/image/common/back.gif
兄弟,IPTV能否上交换机,然后与我每个房间的机顶盒连接的?我用了VLAN的交换机,但机顶盒连接首页的时候就 ...

可以的。EPG没有内容,说明VLAN51没配正确。具体配置方法可以参见我最早发的用硬件VLAN配IPTV那篇帖子。

pour125 发表于 2012-1-3 18:27:59

spicahan 发表于 2012-1-4 12:18:57

pour125 发表于 2012-1-3 18:27 static/image/common/back.gif
麻烦问下我看了电信路由HG255D里面为什么没配置3个vlan,iptv只配置了一个85.
另外巴法络的WZR-AG300NH,他 ...

你好,Web 界面里确实只有 85, 当初就是因为这个原因我还走了很多弯路。。。不过如果你用TTL登录进去直接看那个 xml 配置文件,就能发到还有一个 mcast vlan 是 51.
另外,WZR-AG300NH 可能 OpenWrt 不支持。DDWRT似乎也不支持的样子。。所以我也不清楚它的WAN口到底是什么情况。。这个如果是用 Marvell 方案的话,可能就不容易刷第三方固件了。

jianyunet 发表于 2012-1-4 13:14:48

页: [1] 2 3 4 5 6 7 8 9
查看完整版本: G300NH 用交换机硬件处理 FTTH IPTV VLAN的方法