Jump to content

BPi-R1 with new B53 switch driver (DSA)


Tido

Recommended Posts

After reading from June '16 until February '17 I think it makes sense to start at the last steps /improvements.
 

I've been using the 5.24 nightly builds for a while (now I'm back on the 5.25 main builds)  I've managed some working network configs that everyone can find on this link: https://www.dropbox.com/sh/ciiun8n56c46q2n/AACfXvu5cEoZS5jbO6Xc5L4Ha?dl=0

 

Add those into /etc/network folder and they should work ('interfaces' and 'lamobo-r1' files). I only tested the ppp router configuration since that is all I need but feel free to test the other ones as you please and reply with the needed changes or the confirmation that they work.

For those who are curious, the second archive in the dropbox share named w1-therm.tar.gz is a script that I used to patch the dtb so I wouldn't have to go at each upgrade through this process: https://forum.armbian.com/index.php/topic/993-ds18b20-temperature-sensor-in-lamobo-r1/#entry16089


 

In the 5.24 nightly the directory for networking looks like this (the network folder and the few below this branch):

Looking back to my manual I deleted the VLAN file and created my own.

Then I see here: ifenslave | ethtool | ip | several 'interfaces'

and I was wondering does it need all that for a working VLAN with DSA=Distributed Switch Architecture ?

====================================================
reto@lamobo-r1:/etc/network$ ll
total 60
drwxr-xr-x  7 root root 4096 Feb  4 18:34 ./
drwxr-xr-x 94 root root 4096 Feb  4 18:36 ../
drwxr-xr-x  2 root root 4096 Jan 18 20:29 if-down.d/
drwxr-xr-x  2 root root 4096 Feb  4 18:29 if-post-down.d/
drwxr-xr-x  2 root root 4096 Feb  4 18:29 if-pre-up.d/
drwxr-xr-x  2 root root 4096 Jan 18 20:34 if-up.d/
-rw-r--r--  1 root root  992 Jan 23 13:35 interfaces
-rw-r--r--  1 root root  525 Feb  1 08:03 interfaces.bonding
drwxr-xr-x  2 root root 4096 Jan 24  2016 interfaces.d/
-rw-r--r--  1 root root  992 Feb  1 08:03 interfaces.default
-rw-r--r--  1 root root  197 Feb  1 08:03 interfaces.hostapd
-rw-r--r--  1 root root  182 Feb  1 08:03 interfaces.network-manager
-rw-r--r--  1 root root  495 Feb  1 08:03 interfaces.r1
-rw-r--r--  1 root root  610 Feb  1 08:03 interfaces.r1router
-rw-r--r--  1 root root  359 Feb  1 08:03 interfaces.r1switch

====================================================
reto@lamobo-r1:/etc/network/if-post-down.d
total 20                                                                                                                             
drwxr-xr-x 2 root root 4096 Feb  4 18:29 ./                                                                                          
drwxr-xr-x 7 root root 4096 Feb  4 18:34 ../                                                                                         
lrwxrwxrwx 1 root root   29 Aug 20  2015 bridge -> /lib/bridge-utils/ifupdown.sh*                                                    
lrwxrwxrwx 1 root root   25 Jan 31 23:43 hostapd -> ../../hostapd/ifupdown.sh*                                                       
-rwxr-xr-x 1 root root 1819 Jul 24  2015 ifenslave*                                                                                  
-rwxr-xr-x 1 root root 1011 Oct 12 12:25 vlan*                                                                                       
-rwxr-xr-x 1 root root 1070 Apr 20  2012 wireless-tools*                                                                             
lrwxrwxrwx 1 root root   32 Jan 19  2016 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh* 

====================================================
reto@lamobo-r1:/etc/network/if-pre-up.d
total 32
drwxr-xr-x 2 root root 4096 Feb  4 18:29 ./
drwxr-xr-x 7 root root 4096 Feb  4 18:34 ../
lrwxrwxrwx 1 root root   29 Aug 20  2015 bridge -> /lib/bridge-utils/ifupdown.sh*
-rwxr-xr-x 1 root root  344 Mar 14  2016 ethtool*
lrwxrwxrwx 1 root root   25 Jan 31 23:43 hostapd -> ../../hostapd/ifupdown.sh*
-rwxr-xr-x 1 root root 8600 Jul 24  2015 ifenslave*
-rwxr-xr-x 1 root root 2716 Oct 12 12:25 vlan*
-rwxr-xr-x 1 root root 3839 May  3  2012 wireless-tools*
lrwxrwxrwx 1 root root   32 Jan 19  2016 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh*

====================================================
reto@lamobo-r1:/etc/network$ ll /etc/network/if-up.d
total 32
drwxr-xr-x 2 root root 4096 Jan 18 20:34 ./
drwxr-xr-x 7 root root 4096 Feb  4 18:34 ../
-rwxr-xr-x 1 root root  817 Jun  3  2015 000resolvconf*
-rwxr-xr-x 1 root root 1685 Mar 14  2016 ethtool*
-rwxr-xr-x 1 root root 1732 Jul 24  2015 ifenslave*
-rwxr-xr-x 1 root root  578 Oct 12 12:25 ip*
-rwxr-xr-x 1 root root  980 Jul 31  2016 openssh-server*
-rwxr-xr-x 1 root root 1483 Jun  2  2015 upstart*
lrwxrwxrwx 1 root root   32 Jan 19  2016 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh*

====================================================


 

DSA
SWITCH configuration - is necessary to create network-traffic rules.
VLANs work by applying a  tag  to each frame sent through the network.

 

This script has not been tested yet, but it is the shortest I found for "router-configurartion" in the aforementioned threads.

What do I want to do, or did i do in the past:

  • WLAN & LAN (1-4) are connected with the bridge.
  • WAN as a Gateway to the internet
nano /etc/network/if-pre-up.d/dsa

!/bin/sh
#------------------------------------------#
# BPI-R1 DSA VLAN configuration            #
# Distributed Switch Architecture interface#
#------------------------------------------#
#
# eth0 is fully transparent, like not there from an IP view.
# We will create the following ethernet ports:
# - eth0.101 = WAN (single port)
# - eth0.102 = LAN (4 port switch) + WLAN
#

# ** create the BRIDGE **
ip link add br0 type bridge

# ** ALLOCATION **
ip link set lan1 master br0
ip link set lan2 master br0
ip link set lan3 master br0
ip link set lan4 master br0
ip link set wlan0 master br0


# ** create the native VLAN **
ip link add link eth0 name eth0.101 type vlan id 101
ip link add link eth0 name eth0.102 type vlan id 102

# ** ASSIGN IP-Address to the VLAN **
ip addr add 192.168.9.0/24 dev eth0.102


# ** ACTIVATE /Start **
ip link set lan1 up
ip link set lan2 up
ip link set lan3 up
ip link set lan4 up
ip link set wan up

ip link set eth0.101 up
ip link set eth0.102 up


Can you help to test and improve it?

 

Cheers

Tido

Link to comment
Share on other sites

he he, not a lot of feedback, maybe I get some more in the document :)

 

Anyway, I read a lot again and after an interesting chat in the company the guy suggested not to tag at all, just use the native VLAN.

And as the suggestion from badrianiulian was a bit 'too much' for me anyway I gave it a try.

So I looked how it was done before with SWconfig and the openWrt driver = no taging.

 

So I created a new Document just to setup the R1 with this new switch-driver.

 

I still face a problem, but it is not related to VLAN, but to WiFi :-(


Linux lamobo-r1 4.9.6-sunxi #22 SMP Wed Feb 1 07:43:35 CET 2017 armv7l armv7l armv7l GNU/Linux


root@lamobo-r1# hostapd -ddd /etc/hostapd/hostapd.conf
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
Line 4: invalid/unknown driver 'rtl871xdrv'
1 errors found in configuration file '/etc/hostapd/hostapd.conf'
Failed to set up interface with /etc/hostapd/hostapd.conf
hostapd_init: free iface 0x7f69a6e0
Failed to initialize interface

Link to comment
Share on other sites

No, I did not. I knew that in the past we had a hostapd-rt that I had to chose especially for R1, but I don't know what you mean by: hostapd-realtek package.
Can you give me a hint how to handle that, is it as easy like:

apt-get remove hostapd
apt-get install hostapd-realtek 
Link to comment
Share on other sites

Essentials of Hardware and Software
I decided to reduce complexity and to follow a plan. To do so I must leave aside as much as I can.

Before the network starts, the switch driver must be loaded and the connections defined.
OpenWrt first executed a 'reset' and then loaded the configuration.

  • find a way to easily reset (flush) previous settings for a clean start
  • activate eth0

Create two (2) VLANs:

  • allocate to each port of the switch a VLAN-ID  (LAN 102 | WAN 101)
  • allocate /define the connection to the SoC (A20)

I do not care about WiFi yet, because this is attached via USB and not connected to the BCM53125 switch.

The beast :)
post-18-0-93429200-1488061195_thumb.png



previous OpenWrt switch configuration:

ifconfig eth0 up

swconfig dev eth0 set reset 1 
swconfig dev eth0 set enable_vlan 1 
swconfig dev eth0 vlan 101 set ports '3 8t' 
swconfig dev eth0 vlan 102 set ports '4 0 1 2 8t' 
swconfig dev eth0 set apply 1 


Once the above works and all ports are 'up', next steps:

  • interfaces configuration file
  • DHCP-Server configuration file
  • hostapd configuration file
  • RealTek WiFi driver
  • Security = IPtables settings

So, this is my plan and if it happend, that you are an owner of an R1 and you have a spare mSDcard.. I would appreciate you join the journey.
I use this Debian image with current updates.

 

Some useful links:

iproute2

about this dsa thingy

man page

 

Link to comment
Share on other sites

from 5.25 release notes:

> changed Ethernet switch driver on Lamobo R1 to DSA based one (mainline kernel)

 

I downloaded the latest Armbian with DSA support.

Will it or should it work if I use your scripts mentioned above?

 

I'm no system programmer but I am interested in a working OS for Lamobo R1. I use this SOC as desktop switch and home server.

 

Regards,

Bernhard

 

Link to comment
Share on other sites

Hi Bernhard, it will not work. Before you run updates, disable automatic kernel updating like:

nano /etc/apt/sources.list.d/armbian.list change to:
# deb http://apt.armbian.com jessie main utils jessie-desktop

Do you have an UART (seriell connector) in case the network breaks ?

I have my connector now running (took me a while), therefore I couldn't make tests in between. This is really cool PL2303HX

 

Did you have a look into the Google Doc from posting 2 above ?

 

I am currently struggling with the correct commands to configure the switch. My latest idea looks like this and I want to test that.

Means change config, reload config see if the bridge comes up

!/bin/sh
#
#------------------------------------------#
# BPI-R1 DSA VLAN configuration            #
# Distributed Switch Architecture interface#
#------------------------------------------#
#
# eth0 is fully transparent, like not there from an IP view.
# We will create the following ethernet ports:
# - eth0.101 = WAN (single port)
# - eth0.102 = LAN (4 port switch) + WLAN
#
#
# What are the difference of TAGGED, UNTAGGED and PVID?
#    UNTAGGED is a regular ethernet data packet.
#    TAGGED is an ethernet data packet with an addition which contains a VLAN ID.
#    PVID (Port VLAN ID) is an UNTAGGED packet that enters a switch port, the PVID is attched to the untagged packet and forwarded to a VLAN specified by the ID part of the PVID.
#
#
# There is a difference between Default VLAN and Native VLAN. 
# Native VLAN can be of a value of same as Default VLAN which is 1. 
# But when a native VLAN is changed for e.g in this case it's 10, still the default VLAN remains 1.
#
# 3 = WAN port
# 4 0 1 2 = LAN ports 1-4
# 8 = CPU connected port (on-SoC Ethernet device)

ip link set up eth0

# ** create the BRIDGE **
ip link add name br0 type bridge
ip link set dev br0 type bridge
ip link set dev eth0 master br0

# ** ALLOCATION - Add an interface to bridge **
#ip link set wan master br0  uncomment if you use the R1 as a switch only (not router)

ip link set sw0p4 master br0
ip link set sw0p0 master br0
ip link set sw0p1 master br0
ip link set sw0p2 master br0
ip link set wlan0 master br0
bridge vlan add vid 102 dev sw0p8


# ** create the native VLAN **
ip link add link eth0 name eth0.101 type vlan id 101
ip link add link eth0 name eth0.102 type vlan id 102


# ** ASSIGN IP-Address to the VLAN **
ip addr add 192.168.9.0/24 dev eth0.102 

# If the router does not know where to send the traffic, then here
# ip route add default via 192.168.11.1


# ** ACTIVATE /Start **
ip link set up br0

ip link set up sw0p4
ip link set up sw0p0
ip link set up sw0p1
ip link set up sw0p2
ip link set up wlan0
ip link set up wan

ip link set up eth0.101
ip link set up eth0.102

 

And now test if the bridge comes up with commands like:

ip -d link show

ip -d link show eth0.101
bridge link show

 

I also want to write a little script (like the one above) for: if-post-down.d/  so that if you restart the network all links are deleted (flushed) before it restarts.

 

 

Link to comment
Share on other sites

On 26.02.2017 г. at 0:40 AM, Tido said:

previous OpenWrt switch configuration:


ifconfig eth0 up

swconfig dev eth0 set reset 1 
swconfig dev eth0 set enable_vlan 1 
swconfig dev eth0 vlan 101 set ports '3 8t' 
swconfig dev eth0 vlan 102 set ports '4 0 1 2 8t' 
swconfig dev eth0 set apply 1 

 

On 1.03.2017 г. at 11:25 PM, Tido said:
Spoiler


!/bin/sh
#
#------------------------------------------#
# BPI-R1 DSA VLAN configuration            #
# Distributed Switch Architecture interface#
#------------------------------------------#
#
# eth0 is fully transparent, like not there from an IP view.
# We will create the following ethernet ports:
# - eth0.101 = WAN (single port)
# - eth0.102 = LAN (4 port switch) + WLAN
#
#
# What are the difference of TAGGED, UNTAGGED and PVID?
#    UNTAGGED is a regular ethernet data packet.
#    TAGGED is an ethernet data packet with an addition which contains a VLAN ID.
#    PVID (Port VLAN ID) is an UNTAGGED packet that enters a switch port, the PVID is attched to the untagged packet and forwarded to a VLAN specified by the ID part of the PVID.
#
#
# There is a difference between Default VLAN and Native VLAN. 
# Native VLAN can be of a value of same as Default VLAN which is 1. 
# But when a native VLAN is changed for e.g in this case it's 10, still the default VLAN remains 1.
#
# 3 = WAN port
# 4 0 1 2 = LAN ports 1-4
# 8 = CPU connected port (on-SoC Ethernet device)

ip link set up eth0

# ** create the BRIDGE **
ip link add name br0 type bridge
ip link set dev br0 type bridge
ip link set dev eth0 master br0

# ** ALLOCATION - Add an interface to bridge **
#ip link set wan master br0  uncomment if you use the R1 as a switch only (not router)

ip link set sw0p4 master br0
ip link set sw0p0 master br0
ip link set sw0p1 master br0
ip link set sw0p2 master br0
ip link set wlan0 master br0
bridge vlan add vid 102 dev sw0p8


# ** create the native VLAN **
ip link add link eth0 name eth0.101 type vlan id 101
ip link add link eth0 name eth0.102 type vlan id 102


# ** ASSIGN IP-Address to the VLAN **
ip addr add 192.168.9.0/24 dev eth0.102 

# If the router does not know where to send the traffic, then here
# ip route add default via 192.168.11.1


# ** ACTIVATE /Start **
ip link set up br0

ip link set up sw0p4
ip link set up sw0p0
ip link set up sw0p1
ip link set up sw0p2
ip link set up wlan0
ip link set up wan

ip link set up eth0.101
ip link set up eth0.102

 

Hello. Currently i am using BPI-R1 with OpenWrt. Vlan configuration looks the same as in Armbian and your old guide. But there is this problem - LAN clients from vlan 101 (vlan 102 in your config) can't communicate between each other. Wlan clients can communicate with both lan clients and vice versa, they both can access internet through vlan 102 (vlan 101 in your config), but no communication between lan ports in vlan 101. I found a solutions for this by adding each physical port in separate vlan and then bridge them in br-lan (br0), along with wlan0. But this look ugly, although is what i need and haven't seen any affect on speed yet. I wonder if there is a way to do correct bridgind on vlan level? This second DSA config looks strange to me, but appears to be what i want. From my understanding, physical ports are added directly to br0, then to vlan 102. Can you confirm there is lan clients communication with this config? Also, probably it's not gonna happen, but is there a way to do similar configuration for previous switch configuration, like in OpenWrt?

Link to comment
Share on other sites

 

I am looking for a recommendation(s), in which Forum shall I register to ask questions in regards to DSA (Distributed Switch Architecture) ?

 

@RagnerBG

As I wrote above:  Before the network starts, the switch driver must be loaded and the connections defined (service networking status).

If I am looking at swconfig than there was far less configuration in it than I have above. Maybe I am totally far off

#!/bin/sh

ip link set up eth0

# ** create the native VLAN **
ip link add link eth0 name eth0.101 type vlan id 101
ip link add link eth0 name eth0.102 type vlan id 102

ip link set up eth0.101
ip link set up eth0.102


# ** and maybe like this ?? ALLOCATION **
ip link set lan1 master eth0.102
ip link set lan2 master eth0.102
ip link set lan3 master eth0.102
ip link set lan4 master eth0.102

ip link set wan master eth0.101

ip link set lan1 up
ip link set lan2 up
ip link set lan3 up
ip link set lan4 up

ip link set wan up

chmod 0777 /etc/network/if-pre-up.d/dsa

 

 

 

 

 

Link to comment
Share on other sites

Hello,

On my lamobo_r1 I would like to use only the 5-port switch function (and later additional WLAN-Bridge).

It seems to work a little bit except the forwarding of multicasts for lldp, stp, ...

 

There is running

- Linux bpi 4.10.3-sunxi #1 SMP Wed Mar 15 17:35:56 CET 2017 armv7l armv7l armv7l GNU/Linux

- configuration like this link https://github.com/igorpecovnik/lib/issues/511

- A little change in b53_common.c: struct b53_switch_chips[], BCM53125_DEVICE_ID I have added: .arl_entries = 4

 

The lldp-Multicast 01:80:c2:00:00:0e is set by lldpd on eth0 and br0:

root@bpi:~$ bridge fdb show | grep ^01:80
01:80:c2:00:00:21 dev eth0 self permanent
01:80:c2:00:00:0e dev eth0 self permanent
01:80:c2:00:00:0e dev lan2 self static
01:80:c2:00:00:0e dev br0 master br0 permanent
root@bpi:~$

 

At lan2 I can't see any lldp frames.

At next step I have try to add static multicast to lan1 and lan2. You can see at line 3. Unfortunly we can see only last port I have set.

But no effect.

I have configured STP for testing only. Same effect, no BPDUs.

 

Maybe my concept is wrong. I have no manual found from BCM53125.

Any have an idea and can help?

 

Link to comment
Share on other sites

Now I have a little progress ( unfortunly back ).

LLDP and other local link multicasts are dropped if switch is in unmanaged mode. After reset, managed mode seems to be set. But function b53_enable_vlan(...) in b53_common.c disables switch managed mode, and I have not found any function to enable.

Maybe in DSA for BCM53125 there is no support for simple managed switch.

What may be the reason why VLAN is used for WAN and router? 

Link to comment
Share on other sites

I try now for more than a week to get things working according to Tidos manual - no chance. I can create VLAN, Devices, Bridges but I can't ping my router.

 

Directly after boot eth0 is up an running. Ping works, but switch ports are not interconnected. Then I try create VLANs, Bridges, ... everything seems to be okay regarding the output of "ip link" and "ip addr" but nothing works.

 

Here is my script including the output (bash -x):

Spoiler

+ echo '********************** status before ******************************'
********************** status before ******************************
+ uname -a
Linux lamobo-r1 4.9.7-sunxi #1 SMP Thu Feb 2 01:52:06 CET 2017 armv7l GNU/Linux
+ dmesg -C
+ ip -d link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
3: lan2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
4: lan3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
5: lan4@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
6: wan@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
7: lan1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
8: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
    link/ether ac:a2:13:5c:94:94 brd ff:ff:ff:ff:ff:ff promiscuity 0 
+ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.2/24 brd 192.168.178.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5:7ff:fe02:139c/64 scope link 
       valid_lft forever preferred_lft forever
3: lan2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
4: lan3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
5: lan4@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
6: wan@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
7: lan1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
8: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether ac:a2:13:5c:94:94 brd ff:ff:ff:ff:ff:ff
+ ping -c 1 192.168.178.1
PING 192.168.178.1 (192.168.178.1) 56(84) bytes of data.
64 bytes from 192.168.178.1: icmp_seq=1 ttl=64 time=0.521 ms

--- 192.168.178.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.521/0.521/0.521/0.000 ms
+ echo '********************** action ******************************'
********************** action ******************************
+ ip link set eth0 down
+ ip addr flush dev eth0
+ ip link set up eth0
+ ip link add name br0 type bridge
+ ip link set lan1 master br0
+ ip link set lan2 master br0
+ ip link set lan3 master br0
+ ip link set lan4 master br0
+ ip link add link eth0 name eth0.101 type vlan id 101
+ ip link add link eth0 name eth0.102 type vlan id 102
+ ip link set eth0.102 master br0
+ ip addr add 192.168.178.2/24 broadcast 192.168.178.255 dev br0
+ ip link set up br0
+ ip link set up lan1
+ ip link set up lan2
+ ip link set up lan3
+ ip link set up lan4
+ ip link set up wan
+ ip link set up eth0.101
+ ip link set up eth0.102
+ sleep 10
+ echo '********************** status after ******************************'
********************** status after ******************************
+ ip -d link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 9 
3: lan2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 1 
    bridge_slave 
4: lan3@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 1 
    bridge_slave 
5: lan4@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 1 
    bridge_slave 
6: wan@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
7: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 1 
    bridge_slave 
8: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
    link/ether ac:a2:13:5c:94:94 brd ff:ff:ff:ff:ff:ff promiscuity 0 
9: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
    bridge 
10: eth0.101@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 0 
    vlan protocol 802.1Q id 101 <REORDER_HDR> 
11: eth0.102@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff promiscuity 1 
    vlan protocol 802.1Q id 102 <REORDER_HDR> 
    bridge_slave 
+ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5:7ff:fe02:139c/64 scope link 
       valid_lft forever preferred_lft forever
3: lan2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5:7ff:fe02:139c/64 scope link 
       valid_lft forever preferred_lft forever
4: lan3@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
5: lan4@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
6: wan@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
7: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
8: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether ac:a2:13:5c:94:94 brd ff:ff:ff:ff:ff:ff
9: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.2/24 brd 192.168.178.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::5:7ff:fe02:139c/64 scope link 
       valid_lft forever preferred_lft forever
10: eth0.101@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5:7ff:fe02:139c/64 scope link 
       valid_lft forever preferred_lft forever
11: eth0.102@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5:7ff:fe02:139c/64 scope link 
       valid_lft forever preferred_lft forever
+ ping -c 1 192.168.178.1
PING 192.168.178.1 (192.168.178.1) 56(84) bytes of data.
From 192.168.178.2 icmp_seq=1 Destination Host Unreachable

--- 192.168.178.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

+ echo '********************** dmesg ******************************'
********************** dmesg ******************************
+ dmesg
[   94.382629]  RX IPC Checksum Offload disabled
[   94.382638]  No MAC Management Counters available
[   94.382666] sun7i-dwmac 1c50000.ethernet eth0: fail to init PTP.
[   94.382987] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   94.413901] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[   94.440069] br0: port 1(lan1) entered blocking state
[   94.440081] br0: port 1(lan1) entered disabled state
[   94.441421] device lan1 entered promiscuous mode
[   94.441426] device eth0 entered promiscuous mode
[   94.511757] br0: port 2(lan2) entered blocking state
[   94.511767] br0: port 2(lan2) entered disabled state
[   94.513240] device lan2 entered promiscuous mode
[   94.624681] br0: port 3(lan3) entered blocking state
[   94.624694] br0: port 3(lan3) entered disabled state
[   94.626464] device lan3 entered promiscuous mode
[   94.707357] br0: port 4(lan4) entered blocking state
[   94.707369] br0: port 4(lan4) entered disabled state
[   94.709455] device lan4 entered promiscuous mode
[   94.908372] br0: port 5(eth0.102) entered blocking state
[   94.908384] br0: port 5(eth0.102) entered disabled state
[   94.909115] device eth0.102 entered promiscuous mode
[   94.998417] IPv6: ADDRCONF(NETDEV_UP): lan1: link is not ready
[   95.032283] IPv6: ADDRCONF(NETDEV_UP): lan2: link is not ready
[   95.059844] IPv6: ADDRCONF(NETDEV_UP): lan3: link is not ready
[   95.080715] IPv6: ADDRCONF(NETDEV_UP): lan4: link is not ready
[   95.124933] IPv6: ADDRCONF(NETDEV_UP): wan: link is not ready
[   95.158991] IPv6: ADDRCONF(NETDEV_UP): eth0.101: link is not ready
[   95.196497] IPv6: ADDRCONF(NETDEV_UP): eth0.102: link is not ready
[   95.460509] sun7i-dwmac 1c50000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[   95.460556] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   95.461191] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.101: link becomes ready
[   95.461369] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.102: link becomes ready
[   95.461647] br0: port 5(eth0.102) entered blocking state
[   95.461661] br0: port 5(eth0.102) entered forwarding state
[   96.020660] bcm53xx stmmac-0:1e lan1: Link is Down
[   96.100672] bcm53xx stmmac-0:1e lan4: Link is Down
[   96.100968] bcm53xx stmmac-0:1e lan3: Link is Down
[   96.101255] bcm53xx stmmac-0:1e lan2: Link is Down
[   96.180670] bcm53xx stmmac-0:1e wan: Link is Down
[   99.221339] bcm53xx stmmac-0:1e lan2: Link is Up - 1Gbps/Full - flow control rx/tx
[   99.221941] IPv6: ADDRCONF(NETDEV_CHANGE): lan2: link becomes ready
[   99.222514] br0: port 2(lan2) entered blocking state
[   99.222546] br0: port 2(lan2) entered forwarding state
[  105.263195] Link is Up - 1000/Full

 

 

Edited by Tido
put the long script in a spoiler, Tido.
Link to comment
Share on other sites

8 hours ago, dumischbaenger said:

according to Tidos manual

This is not finished, this is WIP (work in progress) - sorry about that - I make a banner on the first page.

 

Concering configuration, with SWconfig we did basically:

  1. turn on eth0
  2. some sort of reset
  3. configured the ports per VLAN
  4. apply

So the configuration I had in the manual covered too much I guess. Please refer to this instead.

And building the bridge within "interfaces"

 

I face the same problem as you do: it says DOWN - I guess this means not working. I would have setup with swconfig to check how it was reported before.

Btw, swconfig is still installed: dpkg -l swconfig

3: lan2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:05:07:02:13:9c brd ff:ff:ff:ff:ff:ff

 

What I do after every change to the files:

systemctl daemon-reload
service networking restart && service networking status | less

And look at the output, you can also look at syslog.

 

Link to comment
Share on other sites

Tido wrote:

> I am looking for a recommendation(s), in which Forum shall I register to ask questions in regards to DSA (Distributed Switch Architecture) ?

 

Do you know about this thread?

 

https://github.com/igorpecovnik/lib/issues/511

 

In the audience is the user ffainelli the author of the b53 driver.

 

There is also a comment from user wiesl with a lengthy bash script from 29 Dec 2016.

 

I think I will try this one.

 

User badrianiulian seems to have a working setup on 5.25. See his statement from 5 Feb.

 

Link to comment
Share on other sites

In fact I do, as I say on the first line in this thread: After reading from June '16 until February '17 I think it makes sense to start at the last steps /improvements... So I read everything I could find inbetween these dates.

 

Within my signature you find the link to Google, there should be also a little Slide-Deck where I tried to visualize the HW and SW. Until now we didn't need br0 & br1 in those scripts it does if I am not wrong. There is no need for tagging, besides I read somewhere that tagging is not supported in this driver for B53 or just implemented. So I thought it is the same switch with the same task - how much can change ?

As I don't know about HW tweaking like @BrUser does I am just trying to get the config working. Probably you are right and it is time to ask ffainelli for his opinion.

 

Link to comment
Share on other sites

Well, I had this quite often: “RTNETLINK answers: File exists”  --  but I guess this only means that there is already a lease file.

 

And like this in combination with my 'interfaces'  but NO bridge configuration:

#!/bin/sh

ip link set eth0 up

#ip addr flush dev wlan0
#ip addr flush dev eth0
#ip addr flush dev br0

# ** create the native VLAN **
ip link add link eth0 name eth0.101 type vlan id 101
ip link add link eth0 name eth0.102 type vlan id 102

# ** create the BRIDGE **
ip link add br0 type bridge
ip link set dev br0 up

# ** ALLOCATION - Add an interface to bridge **
ip link set lan1 master br0
ip link set lan2 master br0
ip link set lan3 master br0
ip link set lan4 master br0

#ip link set wan master eth0.101
#ip link set wan master eth0


# ** ACTIVATE /Start **
ip link set lan1 up
ip link set lan2 up
ip link set lan3 up
ip link set lan4 up

ip link set wan up

ip link set eth0.101 up
ip link set eth0.102 up

chmod 0777 /etc/network/if-pre-up.d/dsa

chmod 0777 /etc/network/interfaces

 

systemctl daemon-reload
service networking restart && service networking status | less

 

 

Link to comment
Share on other sites

On 25.2.2017 at 9:27 AM, zador.blood.stained said:

Did you install hostapd-realtek package instead

I have done apt-get --purge remove, not a good idea. The hostapd-realtek does not come with config files.

Now I try to find them somewhere

Link to comment
Share on other sites

3 minutes ago, Tido said:

The hostapd-realtek does not come with config files.

It should have a config file installed with standard apt config handling mechanism.

 

4 minutes ago, Tido said:

Now I try to find them somewhere

You can grab it from here: https://github.com/igorpecovnik/lib/blob/master/extras-buildpkgs/hostapd-realtek/debian/config/hostapd.conf

Link to comment
Share on other sites

Thank you for your prompt reply.

I did: apt-get --purge remove hostapd  (was pretty good cleaning :) )

I have that one, but I am now restoring my backup to the SDcard to get:

/etc/default/hostapd

/etc/init.d/hostapd

Geeks would mount the .img on their Linux box - but I don't know what I need for that.

Link to comment
Share on other sites

3 minutes ago, Tido said:

Geeks would mount the .img on their Linux box - but I don't know what I need for that.

losetup, partprobe and mount

 

3 minutes ago, Tido said:

/etc/default/hostapd

https://github.com/igorpecovnik/lib/blob/master/extras-buildpkgs/hostapd-realtek/debian/hostapd-realtek.default

 

4 minutes ago, Tido said:

/etc/init.d/hostapd

https://github.com/igorpecovnik/lib/blob/master/extras-buildpkgs/hostapd-realtek/debian/hostapd-realtek.init

 

 

Though I would try to reset the configuration to restore these files natively - something like this: https://askubuntu.com/questions/66533/how-can-i-restore-configuration-files

Link to comment
Share on other sites

With swconfig I could list all the ports of the B53125 - so I could see what name belongs to each port to address it

swconfig dev switch0 show (see what you have)

How can this be done with DSA=Distributed Switch Architecture ?

 

Link to comment
Share on other sites

I made some progress, the dsa file now looks like this I added: bridge vlan add vid 102 dev lan1

 

#!/bin/sh
#
#------------------------------------------#
# BPI-R1 DSA VLAN configuration            #
# Distributed Switch Architecture interface#
#------------------------------------------#
#

ip link set eth0 up

ip addr flush dev eth0
ip addr flush dev wlan0
ip addr flush dev br0


# ** create the native VLAN **
ip link add link eth0 name eth0.101 type vlan id 101
ip link add link eth0 name eth0.102 type vlan id 102


# ** create the BRIDGE **
ip link add name br0 type bridge
ip link set dev br0 up

# ** ALLOCATION - Add an interface to bridge **
ip link set lan1 master br0
bridge vlan add vid 102 dev lan1
ip link set lan2 master br0
bridge vlan add vid 102 dev lan2
ip link set lan3 master br0
bridge vlan add vid 102 dev lan3
ip link set lan4 master br0
bridge vlan add vid 102 dev lan4

ip link set wlan0 master br0
bridge vlan add vid 102 dev wlan0


#ip link set wan master eth0.101
#ip link set wan master eth0


# ** ACTIVATE /Start **
ip link set lan1 up
ip link set lan2 up
ip link set lan3 up
ip link set lan4 up
ip link set up wlan0

ip link set wan up

ip link set eth0.101 up
ip link set eth0.102 up

 

Currently it feels like I can do what I want - the error message stays: Failed to bring up br0

root@lamobo-r1:~# ifup -v br0 | less
Configuring interface br0=br0 (inet)
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/dsa
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: Operation not supported
RTNETLINK answers: Operation not supported
RTNETLINK answers: Operation not supported
RTNETLINK answers: Operation not supported
RTNETLINK answers: Operation not supported
run-parts: executing /etc/network/if-pre-up.d/ethtool
run-parts: executing /etc/network/if-pre-up.d/hostapd
run-parts: executing /etc/network/if-pre-up.d/ifenslave
+ [ inet = meta ]
+ IF_BOND_SLAVES=
+ [  ]
+ [  ]
+ [ -z  ]
+ exit
run-parts: executing /etc/network/if-pre-up.d/iptablesload
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
ip addr add 192.168.9.2/255.255.255.0 broadcast 192.168.9.255     dev br0 label br0
ip link set dev br0   up
 ip route add default via 192.168.11.1  dev br0 
RTNETLINK answers: Network is unreachable
Failed to bring up br0.

 

Link to comment
Share on other sites

since I removed the 'gateway' the interfaces file, this message:

ip route add default via 192.168.11.1  dev br0

is gone.

I have also done this according to my manual: chmod 0444 /etc/network/if-post-down.d/vlan

And uninstalled the network-manager.

Some handy commands to check what is going on:

cat /var/lib/NetworkManager/NetworkManager.state
cat /etc/NetworkManager/NetworkManager.conf 

cat /proc/net/vlan/config
cat /run/network/ifstate

ifup -v br0
bridge link show

 

What I still have a problem I cannot get an IP-Address from my router. eth0 does not receive an IP-Address, nor does VLAN eth0.101

 

Link to comment
Share on other sites

Now the simple 5-port switch function works with this initialization below.

My understandig for the switch function is: The BCM53125 can only distinguish the source port of an incoming telegram using different VLAN IDs, added by the ports. It is important for LLDP, RSTP, ...  and Router. In this initialization sequence the VID 101, 102, 103, 104, 105 are assigned the ports lan1, lan2, lan3, lan4, wan and stored in the ports own PVID Register.

The forwarding of the incoming frames to other ports and cpu port is controlled by entries in VLAN table. Each entry is indexed by VID, here the PVID. Each VLAN table  entry has a bit mask with one bit for each port to forward.

 

rfkill unblock 0

ip link set eth0 up

ip link add link eth0 name eth0.101 type vlan id 101
ip link set eth0.101 up
ip link add link eth0 name eth0.102 type vlan id 102
ip link set eth0.102 up
ip link add link eth0 name eth0.103 type vlan id 103
ip link set eth0.103 up
ip link add link eth0 name eth0.104 type vlan id 104
ip link set eth0.104 up
ip link add link eth0 name eth0.105 type vlan id 105
ip link set eth0.105 up

 

ip link add br0 type bridge
ip link set dev br0 type bridge stp_state 0

# BCM53125 ports 4, 0, 1, 2, 3
ip link set lan1 master br0
ip link set lan2 master br0
ip link set lan3 master br0
ip link set lan4 master br0
ip link set wan master br0


bridge vlan add vid 101 dev lan1 pvid untagged
bridge vlan del dev lan1 vid 1 self
bridge vlan add vid 102 dev lan2 pvid untagged
bridge vlan del dev lan2 vid 1 self
bridge vlan add vid 103 dev lan3 pvid untagged
bridge vlan del dev lan3 vid 1 self
bridge vlan add vid 104 dev lan4 pvid untagged
bridge vlan del dev lan4 vid 1 self
bridge vlan add vid 105 dev wan pvid untagged
bridge vlan del dev wan vid 1 self

ip link set eth0.101 master br0
ip link set eth0.102 master br0
ip link set eth0.103 master br0
ip link set eth0.104 master br0
ip link set eth0.105 master br0

 

ip link set br0 up
ip link set lan1 up
ip link set lan4 up
ip link set lan2 up
ip link set lan3 up
ip link set wan up

 

ifup br0

 

hostapd -dd /etc/hostapd/hostapd.conf

 

The Image I have build with https://github.com/igorpecovnik/lib , complete including Desktop

root@bpi:~# uname -a
Linux bpi 4.10.6-sunxi #2 SMP Tue Mar 28 10:47:42 CEST 2017 armv7l armv7l armv7l GNU/Linux
root@bpi:~#

 

But some problems pending:

- For LLDP in driver B53_common.c there must be reset the Bit 1 in page 0 Register 0x2F.

- lldpd is not able to watch at eth0.101...eth01.105, only receives frames from eth0. Wireshark works with all ports.

 

- WLAN bridge does not work, hostapd fails:

root@bpi:~# hostapd -dd /etc/hostapd/hostapd.conf
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
ctrl_interface_group=0
drv->ifindex=8
Configure bridge br0 for EAPOL traffic.
ioctl[SIOCSIWMODE]: Invalid argument
Could not set interface to mode(3)!
Could not set interface to master mode!
rtl871xdrv driver initialization failed.
...
root@bpi:~#

 

Edited by BrUser
All lines with wlan canceled, not necessary, for WLAN bridge.
Link to comment
Share on other sites

Me again.

Wifi-Problem found:

- Wifi network must be deactivated in Network Manager. In case of BPI Ubuntu Xenial Desktop click on Network Icon right top corner and remove select of "Funknetzwerke aktivieren"

- sudo rfkill list

- sudo rfkill unblock 0

to unblock Soft blocked

phy0: Wireless LAN

 

Before I have tried some hostapd, maybe they works. At least I had installed this: https://github.com/igorpecovnik/hostapd

using root:

apt install pkg-config

cd ~
git clone https://github.com/igorpecovnik/hostapd
chmod +x ./hostapd/go.sh
cd hostapd

# Now it takes 15 minutes:

./go.sh

 

# hostapd.conf taken from

# ~/hostapd/hostapd.conf/hostapd.conf 

 

Regards,

Albrecht 

 

Link to comment
Share on other sites

On 29.3.2017 at 10:24 AM, BrUser said:

My understandig for the switch function is: The BCM53125 can only distinguish the source port of an incoming telegram using different VLAN IDs, added by the ports. It is important for LLDP, RSTP, ...  and Router. In this initialization sequence the VID 101, 102, 103, 104, 105 are assigned the ports lan1, lan2, lan3, lan4, wan and stored in the ports own PVID Register.

 

Are you sure that it's necessary to create five different VLANs? User badrianiulian posted here https://github.com/igorpecovnik/lib/issues/511 on the 5 of February a configuration with one VLAN.

 

# =======================================
# Setup interfaces and VLANs 
# =======================================
ip link set eth0 up
# Create VLAN 101 on interface eth0: eth0.101
ip link add link eth0 name eth0.101 type vlan id 101
# Create bridge br0 with STP(0) on VLAN 101 with interfaces/tagged: lan1 untag lan2 untag lan3 untag lan4 untag wan untag wlan0 untag eth0.101 tag
ip link add br0 type bridge
ip link set dev br0 type bridge stp_state 0
ip link set lan1 master br0
bridge vlan add vid 101 dev lan1 pvid untagged
bridge vlan add vid 101 dev lan1 pvid untagged self
ip link set lan1 up
ip link set lan2 master br0
bridge vlan add vid 101 dev lan2 pvid untagged
bridge vlan add vid 101 dev lan2 pvid untagged self
ip link set lan2 up
ip link set lan3 master br0
bridge vlan add vid 101 dev lan3 pvid untagged
bridge vlan add vid 101 dev lan3 pvid untagged self
ip link set lan3 up
ip link set lan4 master br0
bridge vlan add vid 101 dev lan4 pvid untagged
bridge vlan add vid 101 dev lan4 pvid untagged self
ip link set lan4 up
ip link set wan master br0
bridge vlan add vid 101 dev wan pvid untagged
bridge vlan add vid 101 dev wan pvid untagged self
ip link set wan up
ip link set wlan0 master br0
bridge vlan add vid 101 dev wlan0 pvid untagged
bridge vlan add vid 101 dev wlan0 pvid untagged self
ip link set wlan0 up
ip link set eth0.101 master br0
bridge vlan add vid 101 dev eth0.101 pvid untagged
bridge vlan add vid 101 dev eth0.101 pvid untagged self
ip link set eth0.101 up

 

I tested it on 5.26. It is possible to get the interfaces up and acquire a IP address but the network is not reliable. If I ping a host I have lots of packets lost. So I extinguished my bonfire.

 

I've read a lot during the last two or three weeks on bridges and switches. Here are some of my favorites:

https://www.kernel.org/doc/Documentation/networking/dsa/dsa.txt

https://www.kernel.org/doc/Documentation/networking/switchdev.txt

https://github.com/Mellanox/mlxsw/wiki/Switch-Port-Configuration

https://github.com/Mellanox/mlxsw/wiki/Bridge

http://events.linuxfoundation.org/sites/events/files/slides/LinuxConJapan2014_makita_0.pdf

 

Some Questions come to my mind:

-Is it really obligatory to use VLANs  if I use the R1 just as switch?

At the beginning of my research I tried to get it working without VLANs. I turned off VLAN filtering, set ports to untagged, ... It was a complete fail. The earlier mentioned bridge article from Mellanox stated "Port netdevs can only be enslaved to a VLAN-aware bridge." Ok - but why?

-The R1 configurations use some form of "bridge vlan add ..."  command but so far I can see vlan_filtering is not enabled on this bridges?

-How can I better trace network traffic. I use tcpdump to monitor interfaces but sometimes I wonder why a packet does not arrive at the bridge I created. Is there a simple to use tool to follow network packet through the network stack?

-The "bridge vlan" command shows there exists a VID 1. Can't I use this default VLAN to enables switching?

 

The complete bridging and switching topic on bc53 is opaque and confusing to me. Perhaps I have next weekend time to do some further research.

 

By the way is your network configuration reliable? No problems with packet loss?

 

 

 

Link to comment
Share on other sites

- If you only want forward all frames from one port to each other (controled by BCM53125 dynamic MAC table) like a unmanaged switch you do not need VLAN. If you want to have a switch for LLDP or other local link layer protocol, the cpu-port need the information, from which port a telegram is coming. The BCM53125 only have the VLAN tag to insert the port information in a frame. If you give all ports the unique VLAN 1, they have all the same source tag.

Same problem with router over wan port. This needs different port VLAN ID too, to address the frames from cpu port to wan port and lan to cpu port and so on.

- Chips VLAN filtering is enabled, maybe in U-Boot not, because I have seen, all packets are forwarded to all ports for some seconds. 

- Loss of telegrams inside Linux you can try to watch with snmp statistic over all layers.

- VID 1 is set initial by driver, I think to avoid forwarding from each port to other. I have removed VID 1 all times because I was not able to read back all switch internal settings ( VLAN table entries forward map, ... ).

 

Loss of packets I will check here too. If I put my init commands in DSA-file, then switch starts strange. Can you try to put all after startup in root shell to compare?

 

Link to comment
Share on other sites

12 hours ago, BrUser said:

- If you only want forward all frames from one port to each other (controled by BCM53125 dynamic MAC table) like a unmanaged switch you do not need VLAN.

 

I tried it, but I can't get it to work. I wrote this script:

 

set -xue

dmesg -C

#BD remove default settings
ip link set eth0 down
ip addr flush eth0 
ip link set eth0 up

#show status
ip link
ip addr

#create bridge without vlan filter
ip link add br0 type bridge
echo 0 > /sys/class/net/br0/bridge/vlan_filtering
bridge vlan del vid 1 dev br0 self

#attach ports to bridge and del VID 1 filtering rules
for i in {1..4} ; do
  ip link set lan$i master br0
  ip link set lan$i up
  bridge vlan del vid 1 dev lan$i
  bridge vlan del vid 1 dev lan$i self
done


#set ip
ip addr add 192.168.178.2/24 broadcast 192.168.178.255 dev br0

sleep 10

#show status
cat /sys/class/net/br0/bridge/vlan_filtering
ip link
ip addr
bridge vlan
dmesg

 

At the end the bridge is up and running, the connected port is up too, IP address is assigned, route is added, but I can't ping hosts on the network. I also can't see ethernet packets with tcpdump on eth0, lan2 (connected port) and br0.

Link to comment
Share on other sites

I have checked packed loss.

- No packed loss at my BPiR1 board over two ports. PC--- wan BPiR1 lan4---RaspPi3. SMB-protocol, 1 GB file. ~11MB/s. In this mode there is no CPU interaction, only switch.

- No packed loss over CPU. PC--- wan BPiR1---SATA. SMB-protocol, 1 GB file. ~16MB/s.

 

- The R1 should work without VLAN in switch mode, but I dont know, how to do this over DSA or other way.

 

- WLAN is not stable at my R1. And is not stable on RaspPi3 and not stable on Wandboard Quad (NXP).

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines