1

I managed to install Debian on my Banana Pi R2.

This device has two physical NICs: one for WAN (1 port), one for LAN (4 ports).

  • eth0
  • eth1

if I run ip address, I can see, that there are multiple interfaces "on" the "native" interfaces, which I can identify as the individual LAN-ports on the Board:

root@bpi-r2:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::2:2ff:fe02:202/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 36:d1:02:41:61:c9 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::34d1:2ff:fe41:61c9/64 scope link
       valid_lft forever preferred_lft forever
4: wan@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 36:d1:02:41:61:c9 brd ff:ff:ff:ff:ff:ff
    inet 10.20.0.88/24 brd 10.20.0.255 scope global wan
       valid_lft forever preferred_lft forever
    inet6 fe80::34d1:2ff:fe41:61c9/64 scope link
       valid_lft forever preferred_lft forever
5: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/24 brd 192.168.0.255 scope global lan0
       valid_lft forever preferred_lft forever
6: lan1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
7: lan2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
8: lan3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
root@bpi-r2:~#

I cannot find any hints for these "lan*" and "wan" interfaces in /etc/network/interfaces... I know how to create and manage virtual interfaces, but I only know them as eth0:2 for example... When I try to assign a static IP by writing the following to /etc/network/interfaces, the networking service fails to bring up the interface:

iface lan0 inet dhcp
iface wan inet static
    ...

So where do these interfaces come from and how do I manage them (addign static IP or DHCP etc.)

EDIT 1: Output of ls /sys/class/net:

root@bpi-r2:~# ls /sys/class/net
eth0  eth1  lan0  lan1  lan2  lan3  lo  wan
root@bpi-r2:~#

Found a working configuration:

auto lan0 wan

iface wan inet static
        address 137.226.214.58
        netmask 255.255.254.0
        pre-up ip link set $IFACE up
        post-down ip link set $IFACE down
        gateway 137.226.214.1

iface lan0 inet static
        address 10.20.0.88
        netmask 255.255.255.0
        pre-up ip link set $IFACE up
        post-down ip link set $IFACE down
TheClockTwister
  • 161
  • 1
  • 8
  • 1
    It's about DSA (distributed switch architecture): https://www.kernel.org/doc/Documentation/networking/dsa/dsa.txt . The Banana Pi R2 has such device: https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts#L150 , but it's not clear if wan@eth1 is the same wan in the previous link.. Might be related to https://www.kernel.org/doc/Documentation/networking/switchdev.txt . – A.B Apr 30 '20 at 16:59
  • Thanks, now I know where this stuff originated from :) – TheClockTwister Apr 30 '20 at 17:07
  • 1
    Also: forget anything about alias interfaces (eth0:2), it's a construct made with *IP addresses*, intended to keep compatibility with the deprecated commands ifconfig and route (rather thank ip link, ip address and ip route) because their old ioctl interface can't support more than 1 IPv4 address. – A.B Apr 30 '20 at 17:08
  • Now the final question: How do I get rid of these "interfaces"? If possible, I would like to refer to all 4 LAN ports as eth0 and the one WAN port as eth1. I don't want to differentiate between the single ports of the same NIC – TheClockTwister Apr 30 '20 at 23:10

2 Answers2

0

Without seeing the actual output of ip addr it's hard to say for certain; but I suspect you'll find you just need to use the interface number after the @... So wan@eth1 would be:

iface eth1:0 inet static

EDIT Correction, based on your updated ip addr output, I'd expect your /etc/network/interfaces file would need to look like so:

 auto wan0@eth1
 iface wan0@eth1 inet static
 ...
 auto lan0@eth0
 iface lan0@eth0 inet dhcp
 auto lan1@eth0
 iface lan1@eth0 inet static
 ...
 auto lan2@eth0
 iface lan2@eth0 inet static
 ...
 auto lan3@eth0
 iface lan3@eth0 inet static

And so on. If that doesn't work, can you provide the output of ls /sys/class/net?

EDIT2 Ok, based on the contents of /sys/class/net, here's my amended reco (making sure there are no eth0 or eth1 references in the /etc/network/interfaces, first):

 auto wan0
 iface wan0 inet static
 ...
 auto lan0
 iface lan0 inet dhcp
 auto lan1
 iface lan1 inet static
 ...
 auto lan2
 iface lan2 inet static
 ...
 auto lan3
 iface lan3 inet static

TBH, if that doesn't work, my next thought would be to see what output you get from trying to run ifup against either of the lanX interfaces - see if you get more useful information from that.

Omar Buhidma
  • 358
  • 1
  • 8
0

Since the new "mdio-bus" seams to be implemented in the latest Buster releases, I fixed it by installing an older version (Debian Jessie) instead of Buster. After that, I did a manual dist upgrade to Buster and saved the image on my NAS for later usage on another Banana Pi R2...

TheClockTwister
  • 161
  • 1
  • 8