1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

ac86u - vlan creation writeup by u128393 (I found on a Chinese forum)

Discussion in 'Asuswrt-Merlin' started by ika, Apr 5, 2020.

  1. ika

    ika Regular Contributor

    Joined:
    Nov 29, 2014
    Messages:
    80
    This is a writeup I found on the internet about the ac86u on a Chinese forum: https://www.cnblogs.com/u128393/p/11629969.html

    This has nothing to do with me, all the credits belongs to the user called: u128393

    Below are the google translations of the three articles:
    -------------------------------------------------------------------

    Shanghai Telecom TL-EP110 + RT-AC86U to watch 4K IPTV without jam (2019-10)

    Foreword
    There are many examples of routers connected to IPTV on the Internet, which helped me a lot in the early stage. But the two devices I selected left me two big pits, and after a lot of tossing, I could finally watch it smoothly. In the process, I learned a lot of things that Baidu / Google can't find or are hard to find. Share them.

    Topology
    u128393_articles_pic1.png

    Two big pits
    • RT-AC86U does not support the robocfg command, and there are no examples of correctly configured VLANs on the Internet.
    • The examples that can be found so far are the use of telecommunications equipment to set up multicast (VLAN 51), which hides some details behind it. Improper configuration will cause stuttering / stuck.
    Several knowledge points
    • If the router is connected to IPTV, DHCP OPTION 125 (Shanghai Telecom is this) needs to be configured on the router. There are many examples on the Internet, which will not be repeated here.
    • Shanghai Telecom dial-up Internet access (PPPoE) uses Native VLAN (untagged), IPTV private network uses VLAN 85, and multicast uses VLAN 51.
    • Someone on the Internet mentioned that VLAN 51 is not needed for 4K IPTV now, but it is actually needed. This is related to the pit mentioned earlier.
    RT-AC86U VLAN configuration
    According to the example on the Internet, it is found that RT-AC86U does not have robocfg, and there is no alternative method. I am desperate. But I saw an example where someone mentioned vlanctl, but it was not configured correctly. Google only saw someone studying it, and there was no result. However, I found that this command was actually used in the source code of Merlin. After careful comparison of the context and the rapid operation of the brain [funny] (in fact, it took a whole day to figure out the parameters), I finally figured it out.
    Because the example is too long, I posted a separate blog: RT-AC86U VLAN Configuration-vlanctl
    In addition, the process also found that using vconfig can also configure VLAN, even simpler, see: RT-AC86U VLAN Configuration-vconfig

    It doesn't matter if you don't read it, there is a complete script at the end of this article.

    IGMP Snooping
    After configuring VLAN 85, the IPTV box can obtain the IP addresses of the public network and the private network at the same time. But things are not so smooth. At this time, you will find that you will be stuck after watching the live broadcast, and then you will be stuck directly after a while.

    Before talking about how to solve it, let me talk about my situation at that time. For some reason that I don't need to elaborate, I removed my optical cat (TL-EP110) and replaced it with a telecom optical cat. At this time, the packet capture will find that the multicast data is transmitted in VLAN 85.

    After performing packet capture analysis on each layer of interface, it is found that the multicast data is not transmitted to the vlan85 bridge. Fortunately, at the time, I spent time madly supplementing multicast knowledge, and I felt it should be related to IGMP Snooping. After a few searches, I saw the bcmmcastctl command in the Merlin source code.
    Code:
    bcmmcastctl mode -i vlan85 -p 1 -m 1  # 对 vlan85 启用 IGMP Snooping
    bcmmcastctl mode -i vlan85 -p 2 -m 1  # 对 vlan85 启用 MLD Snooping(这个是针对 IPv6 的,可以不管)
    Available after testing! [Tears burst into tears] However, I was still too happy ...

    VLAN 51
    Change back to his light cat, and found that the live broadcast is still a card, then a group of grass mud horses floated in my heart. Continue to capture packets and find that the multicast data is coming in from VLAN 51, but when using the telecommunications light cat, I don't see the shadow of VLAN 51 at all! At this time, I made a bold assumption that the telecommunications optical cat must forward the data of VLAN 51 to VLAN 85 on the LAN side, as shown in the following figure:
    u128393_articles_pic2.png
    When I said it was too fast (in fact, I was stupid), I immediately tried to make a similar configuration on the router. (Although it may not be seen in the future)!

    Final configuration:
    Choose one of the two versions. The vconfig version is recommended. In addition, remember to configure DHCP OPTION 125 (Baidu).
    Code:
    #!/bin/sh
    
    # 该脚本需要在 services-start 中运行
    
    ifconfig eth0 allmulti up
    
    #####################################################################
    vlanctl --mcast --if-create eth0 0                                  #
    vlanctl --if eth0 --rx --tags 0 --set-rxif eth0.v0 --rule-append    #
    ifconfig eth0.v0 up                                                 #
                                                                        #
    brctl addbr br1                                                     #
    brctl addif br1 eth0.v0                                             #
    ifconfig br1 up                                                     #
                                                                        #
    nvram set wan_ifnames=br1                                           #
    nvram set wan_ifname=br1                                            #
    nvram set wan0_ifname=br1                                           #
    #####################################################################
    
    #####################################################################
    brctl delif br0 eth1                                                #
                                                                        #
    vlanctl --mcast --if-create eth1 0                                  #
    vlanctl --if eth1 --rx --tags 0 --set-rxif eth1.v0 --rule-append    #
    ifconfig eth1.v0 up                                                 #
                                                                        #
    brctl addif br0 eth1.v0                                             #
    #####################################################################
    
    vlanctl --mcast --if-create eth0 85
    vlanctl --if eth0 --rx --tags 1 --filter-vid 85 0 --pop-tag --set-rxif eth0.v85 --rule-append
    vlanctl --if eth0 --rx --tags 1 --filter-vid 51 0 --pop-tag --set-rxif eth0.v85 --rule-append
    vlanctl --if eth0 --tx --tags 0 --filter-txif eth0.v85 --push-tag --set-vid 85 0 --rule-append
    ifconfig eth0.v85 up
    
    vlanctl --mcast --if-create eth1 85
    vlanctl --if eth1 --rx --tags 1 --filter-vid 85 0 --pop-tag --set-rxif eth1.v85 --rule-append
    vlanctl --if eth1 --tx --tags 0 --filter-txif eth1.v85 --push-tag --set-vid 85 0 --rule-append
    ifconfig eth1.v85 up
    
    brctl addbr vlan85
    brctl addif vlan85 eth0.v85
    brctl addif vlan85 eth1.v85
    ifconfig vlan85 up
    
    bcmmcastctl mode -i vlan85 -p 1 -m 1
    bcmmcastctl mode -i vlan85 -p 2 -m 1
    Code:
    #!/bin/sh
    
    # 该脚本可手动执行,或放入 wan-start 中开机自动运行
    
    vconfig set_name_type DEV_PLUS_VID_NO_PAD
    vconfig add eth0 85
    vconfig add br0 85
    
    brctl addbr vlan85
    brctl addif vlan85 eth0.85
    brctl addif vlan85 br0.85
    
    bcmmcastctl mode -i vlan85 -p 1 -m 1
    bcmmcastctl mode -i vlan85 -p 2 -m 1
    
    ifconfig eth0.85 up
    ifconfig br0.85 up
    ifconfig vlan85 up
    
    vconfig add eth0 51
    brctl addif vlan85 eth0.51
    ebtables -A FORWARD -i eth0.51 -o ! br0.85 -j DROP
    ebtables -A FORWARD -o eth0.51 -j DROP
    ifconfig eth0.51 up
    Author: u128393
     
    Last edited: Apr 5, 2020
    GHammer and L&LD like this.
  2. ika

    ika Regular Contributor

    Joined:
    Nov 29, 2014
    Messages:
    80
    RT-AC86U VLAN configuration-vlanctl articles

    There is no robocfg command for RT-AC86U, and there is no example of successful VLAN configuration online. After several explorations, I found that vlanctl or vconfig can be used to achieve. This article introduces the usage of vlanctl (portal: vconfig ).

    Example 1
    Code:
    vlanctl --mcast --if-create eth0 85
    vlanctl --if eth0 --rx --tags 1 --filter-vid 85 0 --pop-tag --set-rxif eth0.v85 --rule-append
    vlanctl --if eth0 --tx --tags 0 --filter-txif eth0.v85 --push-tag --set-vid 85 0 --rule-append
    ifconfig eth0.v85 up
    We break down one by one:
    Code:
    vlanctl --mcast --if-create eth0 85
    Create a virtual interface based on eth0 and name it eth0.v85. Note that 85 here is just a name and has nothing to do with VLAN tag. --mcast is not seen in the help documentation of vlanctl, but this parameter is added to Merlin's code. The name should be to enable multicast for the interface.
    Code:
    vlanctl --if eth0 --tx --tags 0 --filter-txif eth0.v85 --push-tag --set-vid 85 0 --rule-append
    When the interface eth0 sends data (--if eth0 --tx), if there is no VLAN tag (--tags 0), and the virtual interface sending the data is eth0.v85 (--filter-txif eth0.v85), then give the data (Ethernet frame) Add a VLAN tag (--push-tag), and set the VLAN ID to 85 (--set-vid 85 0) for the 0th (just added) tag. Add this rule to the table (--rule-append).
    Code:
    ifconfig eth0.v85 up
    Enable this virtual interface.

    Example 2

    Example 1 only dealt with eth0 (WAN port), then we do similar processing to eth1 (LAN port 4) and bridge them. In this way, VLAN 85 of WAN and LAN port 4 will be connected.
    Code:
    vlanctl --mcast --if-create eth0 85
    vlanctl --if eth0 --rx --tags 1 --filter-vid 85 0 --pop-tag --set-rxif eth0.v85 --rule-append
    vlanctl --if eth0 --tx --tags 0 --filter-txif eth0.v85 --push-tag --set-vid 85 0 --rule-append
    ifconfig eth0.v85 up
    
    vlanctl --mcast --if-create eth1 85
    vlanctl --if eth1 --rx --tags 1 --filter-vid 85 0 --pop-tag --set-rxif eth1.v85 --rule-append
    vlanctl --if eth1 --tx --tags 0 --filter-txif eth1.v85 --push-tag --set-vid 85 0 --rule-append
    ifconfig eth1.v85 up
    
    brctl addbr vlan85
    brctl addif vlan85 eth0.v85
    brctl addif vlan85 eth1.v85
    ifconfig vlan85 up

    Example 3

    In Example 2, the tag of VLAN 85 is taken off after entering the router from eth0, and then added back when going out from eth1 (the reverse is also the same). In fact, it does useless work. We can make a slight modification to allow VLAN 85 frame retention tags to be transmitted between eth0 and eth1.
    Code:
    vlanctl --mcast --if-create eth0 85
    vlanctl --if eth0 --rx --tags 1 --filter-vid 85 0 --set-rxif eth0.v85 --rule-append
    vlanctl --if eth0 --tx --tags 1 --filter-txif eth0.v85 --rule-append # 这行可删除
    ifconfig eth0.v85 up
    
    vlanctl --mcast --if-create eth1 85
    vlanctl --if eth1 --rx --tags 1 --filter-vid 85 0 --set-rxif eth1.v85 --rule-append
    vlanctl --if eth1 --tx --tags 1 --filter-txif eth1.v85 --rule-append # 这行可删除
    ifconfig eth1.v85 up
    
    brctl addbr vlan85
    brctl addif vlan85 eth0.v85
    brctl addif vlan85 eth1.v85
    ifconfig vlan85 up
    Two changes have been made:
    1. For --rx, we no longer take off the tag, so we removed --pop-tag.
    2. For --tx, because the tag was not removed before, the tag number is 1 instead of 0 (changed to --tags 1), and then no need to add tags and set vid, so remove --push-tag and- set-vid 85 0.
    After this modification, we have done nothing for --tx, so this rule can be deleted.

    Example 4

    In addition to VLAN 85, we may also want to open VLAN 51 at the same time, or we do not want to care about its VLAN ID at all, except Native VLAN (untagged) is used for Internet access (this is the case for Shanghai Telecom), all other open (similar to trunk ). This is actually very easy to implement, the command is simpler than the previous example, this is the flexibility of vlanctl.
    Code:
    vlanctl --mcast --if-create eth0 1
    vlanctl --if eth0 --rx --tags 1 --set-rxif eth0.v1 --rule-append
    ifconfig eth0.v1 up
    
    vlanctl --mcast --if-create eth1 1
    vlanctl --if eth1 --rx --tags 1 --set-rxif eth1.v1 --rule-append
    ifconfig eth1.v1 up
    
    brctl addbr br1
    brctl addif br1 eth0.v1
    brctl addif br1 eth1.v1
    ifconfig br1 up

    Example 5

    The previous examples are not complete, because once vlanctl is used to create a virtual interface, the original interface can no longer be used. The specific reason is unclear, and it may be related to the implementation mechanism of vlanctl. Therefore, in order to make the Native VLAN of WAN and LAN still usable, a virtual interface needs to be created for --tags 0.
    Code:
    #!/bin/sh
    # 该脚本需要在 services-start 中运行
    # 注:这只是 vlanctl 的用法示例,不是完整的 IPTV 配置脚本
    
    ifconfig eth0 allmulti up
    
    #####################################################################
    vlanctl --mcast --if-create eth0 0                                  #
    vlanctl --if eth0 --rx --tags 0 --set-rxif eth0.v0 --rule-append    #
    ifconfig eth0.v0 up                                                 #
                                                                        #
    brctl addbr br2                                                     #
    brctl addif br2 eth0.v0                                             #
    ifconfig br2 up                                                     #
                                                                        #
    nvram set wan_ifnames=br2                                           #
    nvram set wan_ifname=br2                                            #
    nvram set wan0_ifname=br2                                           #
    #####################################################################
    
    #####################################################################
    brctl delif br0 eth1                                                #
                                                                        #
    vlanctl --mcast --if-create eth1 0                                  #
    vlanctl --if eth1 --rx --tags 0 --set-rxif eth1.v0 --rule-append    #
    ifconfig eth1.v0 up                                                 #
                                                                        #
    brctl addif br0 eth1.v0                                             #
    #####################################################################
    
    vlanctl --mcast --if-create eth0 1
    vlanctl --if eth0 --rx --tags 1 --set-rxif eth0.v1 --rule-append
    ifconfig eth0.v1 up
    
    vlanctl --mcast --if-create eth1 1
    vlanctl --if eth1 --rx --tags 1 --set-rxif eth1.v1 --rule-append
    ifconfig eth1.v1 up
    
    brctl addbr br1
    brctl addif br1 eth0.v1
    brctl addif br1 eth1.v1
    ifconfig br1 up
    A few notes:
    • The part framed by # is to restore the support of eth0 and eth1 to Native VLAN. The following code is the same as the previous example.
    • I don't know why, the newly created virtual interface eth0.v0 cannot be directly used for dial-up Internet access, it needs to be added to a bridge.In order to let the system know that the dial-up Internet interface has changed, several related variables of nvram need to be set, and this code needs to be run before the WAN is initialized during the boot process.
    • You need to delete eht1 from the bridge corresponding to the LAN and add eth1.v0, so this code needs to be run after the LAN is initialized during the boot process.
    • services-start is the only script in the Merlin system that satisfies both of the above conditions.
    • The interface in the bridge has an initialization process. It needs to go from disabled to listening, learning to forwarding and other states to become available, so the boot dialing will be slower (but it is okay, just a little more).
    For the complete IPTV configuration script, please refer to: https://www.cnblogs.com/u128393/p/11629969.html

    Author: u128393
     
    GHammer and L&LD like this.
  3. ika

    ika Regular Contributor

    Joined:
    Nov 29, 2014
    Messages:
    80
    RT-AC86U VLAN configuration-vconfig

    There is no robocfg command for RT-AC86U, and there is no example of successful VLAN configuration online. After several explorations, I found that vlanctl or vconfig can be used to achieve. This article introduces the usage of vconfig (portal: vlanctl).

    Example 1
    Code:
    vconfig set_name_type DEV_PLUS_VID_NO_PAD
    vconfig add eth0 85
    ifconfig eth0.85 up
    We break down one by one:
    Code:
    vconfig set_name_type DEV_PLUS_VID_NO_PAD
    Set the naming rule for creating virtual interfaces as device name + VLAN ID.
    Code:
    vconfig add eth0 85
    Add a virtual interface for eth0 and bind it to VLAN 85. According to the naming rules set in the previous command, this virtual interface is named eth0.85.
    Code:
    ifconfig eth0.85 up
    Enable this virtual interface.

    Example 2
    In Example 1, we created a virtual interface for VLAN 85 for eth0 (WAN). Next, we also created a virtual interface for VLAN 85 for br0 (LAN Bridge) and bridged them. In this way, VLAN 85 of WAN and LAN are connected.
    Code:
    vconfig set_name_type DEV_PLUS_VID_NO_PAD
    
    vconfig add eth0 85
    ifconfig eth0.85 up
    
    vconfig add br0 85
    ifconfig br0.85 up
    
    brctl addbr vlan85
    brctl addif vlan85 eth0.85
    brctl addif vlan85 br0.85
    ifconfig vlan85 up
    Unlike vlanctl, after using vconfig to create a virtual interface, the original interface function is not affected, so no additional processing is required for Native LAN.

    Example 3
    Although vconfig is simpler than vlanctl, it cannot transparently transmit all tagged frames like vlanctl (only Native VLAN is excluded). But generally we need to configure at most 2 or 3 VLANs, just repeat the code.
    Code:
     注:这只是 vconfig 的用法示例,不是完整的 IPTV 配置脚本
    
    vconfig set_name_type DEV_PLUS_VID_NO_PAD
    
    vconfig add eth0 85
    ifconfig eth0.85 up
    
    vconfig add br0 85
    ifconfig br0.85 up
    
    brctl addbr vlan85
    brctl addif vlan85 eth0.85
    brctl addif vlan85 br0.85
    ifconfig vlan85 up
    
    vconfig add eth0 51
    ifconfig eth0.51 up
    
    vconfig add br0 51
    ifconfig br0.51 up
    
    brctl addbr vlan51
    brctl addif vlan51 eth0.51
    brctl addif vlan51 br0.51
    ifconfig vlan51 up
    For the complete IPTV configuration script, please refer to: https://www.cnblogs.com/u128393/p/11629969.html

    Author: u128393
     
    GHammer likes this.
  4. Martineau

    Martineau Part of the Furniture

    Joined:
    Jul 8, 2012
    Messages:
    3,331
    Location:
    UK
    Someone already posted this RT-86U - vlanctl & ethctl usage puzzle but apparently decided not to credit the original author/URLs, consequently others assumed he would answer technical queries.
     
    L&LD and Makaveli like this.
  5. ika

    ika Regular Contributor

    Joined:
    Nov 29, 2014
    Messages:
    80
    Ah I'm really sorry, I was googleing back and forth but did not see that one. What should I do now, can the mods delete or lock this thread?
     
  6. Martineau

    Martineau Part of the Furniture

    Joined:
    Jul 8, 2012
    Messages:
    3,331
    Location:
    UK
    To be honest your post is more comprehensive, and commendably you have credited the original author, so I don't believe there is a reason not to leave it open?
     
    Last edited: Apr 5, 2020
    andresmorago, L&LD and ika like this.
  7. ika

    ika Regular Contributor

    Joined:
    Nov 29, 2014
    Messages:
    80
    Thank you.
    I think the original aricles were created with care and the intention to be helpful, I only tried to be faithful to the work of the author (sadly I don't speak/read Chinese, so I decided to leave the google translation untouched).
    Perhaps information like these posts will help a creation of an amtm vlan-management script one day.
     
  8. Martineau

    Martineau Part of the Furniture

    Joined:
    Jul 8, 2012
    Messages:
    3,331
    Location:
    UK
    FYI, I believe there are other useful related articles on the Web (in English), but I personally admire your integrity...there are far too many that dishonestly pass-around the work/solutions of others as their own.
     
    L&LD and ika like this.
  9. thiggins

    thiggins Mr. Easy Staff Member

    Joined:
    May 18, 2008
    Messages:
    14,377
    @Martineau Thank you for calling out the other thread. I have deleted the post from that thread that contained content that was posted without crediting the original author.
    @ika Thank you for properly crediting the author and linking to the original content. Because there is no obvious way to contact the author, I'll let the posts remain up. But if the author contacts me and requests they be taken down, I will honor that request.
     
    L&LD and ika like this.
  10. ika

    ika Regular Contributor

    Joined:
    Nov 29, 2014
    Messages:
    80
    Thank you very much.

    ps.: I hope dony71 =! u128393
     
    L&LD likes this.
  11. Quentin Dumay

    Quentin Dumay Occasional Visitor

    Joined:
    Mar 25, 2020
    Messages:
    15
    An expert from Broadcom gave me these information on the AX88 switch :
    "Two ports VLAN group setting are:

    • Port0 ↔ Port5 : VLAN ID 100 (hex 64)
    Registers write:

    Set Reg(0x34: 0x00)=0xE3

    Set Reg(0x34: 0x10)=0x0064

    Set Reg(0x34: 0x1A)=0x0064

    Set Reg(0x05: 0x81)=0x0064

    Set Reg(0x05: 0x83)=0x00004221

    Set Reg(0x05: 0x80)=0x80
    "

    Does that mean something to you ?
     
  12. ika

    ika Regular Contributor

    Joined:
    Nov 29, 2014
    Messages:
    80
    The AX88u uses the Broadcom BCM53134 chip for its switch (unlike the ac86u, which uses its cpu - the BCM4906 chip - for the switch functions as well).
    The document below might be relevant:
    https://community.broadcom.com/High...tFileKey=59280e19-b009-4239-898d-6d1376d04c28

    Here are the data sheets for the 53134 family: 53134O, 53134P, 53143M, 53134S and for the 53134U (which is not even listed in the family product brief).
    Hope it helps.