Banana PI BPI R2: Configuring LAN0, LAN1, LAN2,LAN3 at Same Static Ip address

Hello I have a BPI R2 and I use 4.14.80-bpi-r2-main kernel. I want to give the same static IP lan0,lan1,lan2,lan3 ports. I configured /etc/networking/interfaces like this but it did not work. How can I do it?

 # interfaces(5) file used by ifup(8) and ifdown(8) Include files from
#/etc/network/interfaces.d: cpu-ports (eth0+1) bring up without any
#ip-configuration

auto eth0
iface eth0 inet manual #static
  pre-up ip link set $IFACE up
#  address 192.168.10.99
#  netmask 255.255.255.0
  post-down ip link set $IFACE down

#2nd gmac (cpu-port) only in 4.14.53+
auto eth1
iface eth1 inet manual
  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down

#wan-port as dhcp-client
auto wan
allow-hotplug wan
iface wan inet dhcp
  hwaddress ether 08:15:25:00:00:01 # if you want to set MAC manually

#lan0 has fixed address
auto lan0
iface lan0 inet static
  hwaddress ether 08:15:25:00:00:00 # if you want to set MAC manually
  address 192.168.10.110
  netmask 255.255.255.0
  gateway 192.168.10.0
#  dns-nameservers 8.8.8.8
  pre-up ip link set $IFACE address 02:01:02:03:04:00 up
#  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down
#lan0 has fixed address
auto lan1
iface lan1 inet static
  hwaddress ether 08:15:25:00:00:10 # if you want to set MAC manually
  address 192.168.10.110
  netmask 255.255.255.0
  gateway 192.168.10.0
#  dns-nameservers 8.8.8.8
  pre-up ip link set $IFACE address 02:01:02:03:04:10 up
#  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down
source-directory /etc/network/interfaces.d 

Best regards

Hi!

In case You want to access your R2 through any LAN port with the same IP - you need a bridge with all lan ports attached, and then assign an ip to the bridge interface (consult your distro manual to determine the best/proper way to do it) e.g. :

bpi-r2-gentoo ~ # brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.6ac4b30fd153       no              lan0
                                                        lan1
                                                        lan2
                                                        lan3
                                                        wan

(I also use the wan port too on this device.)

bpi-r2-gentoo ~ # ip a s br0
13: br0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 6a:c4:b3:0f:d1:53 brd ff:ff:ff:ff:ff:ff
    inet 10.0.1.2/24 brd 10.0.1.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::68c4:b3ff:fe0f:d153/64 scope link 
       valid_lft forever preferred_lft forever

10.0.1.2 - is the device’s ip to access it.

Also, i’d recommend using one of the recent kernels - 5.15+ - I believe there are a lot of fixes: general and network/DSA/bridge related.

P.S. A general way to add/test a bridge (bridge-utils are requiered):

brctl addbr br0 # add a bridge

brctl addif br0 lan0  #and other if needed, eth0 and lan<x> should be  up 

then assign an ip and test.

1 Like

Brctl is only temporary and setting get lost on reboot,please see networkconfiguration in my wiki for way with /etc/network/interfaces

1 Like