Quantcast
Channel: Armbian news
Viewing all articles
Browse latest Browse all 486

BPi-R1 with new B53 switch driver (DSA)

$
0
0

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 #
#-------------------------------#
#
# This will create the following ethernet ports:
# - eth0.101 = WAN (single port)
# - eth0.102 = LAN (4 port switch)
#
#

# interface.as_router:
ip link add 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 set wan master br0
ip link set wlan0 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

bridge vlan add vid 101 dev wan pvid untagged
bridge vlan del vid 102 dev wan

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 addr add 192.168.9.2/24 dev eth0.101
ip addr add 192.168.9.1/24 dev eth0.102
ip link set eth0.101 up
ip link set eth0.102 up
ip route add default via 192.168.9.2 dev eth0.101

I don't know: how it now works with those 'tag'. I was used to NAT(Network Address Translation), is this now replaced or are both necessary?

 

Can you help to test and improve it?

 

Cheers

Tido


Viewing all articles
Browse latest Browse all 486

Trending Articles