Updating a fresh Ubuntu 22.04 image - BananaPi BPI-R3 router

Hi, I just logged in for the first time on an Ubuntu 22.04 image found here and provided by the user @frank-w.

I want to update the system and install some linux utilities. I would like to plug an ethernet cable into the bpi-r3 and connect the board to my home router and use my internet connection to update the system.

I first tried plugging the ethernet cable into the LAN0 socket and checked the network configuration and the routing table.

root@bpi-r3:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1504
        ether 9a:13:4a:5a:ea:d1  txqueuelen 1000  (Ethernet)
        RX packets 5576  bytes 477486 (477.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6109  bytes 668677 (668.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 121  

he-ipv6: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1480
        sit  txqueuelen 1000  (IPv6-in-IPv4)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 9a:13:4a:5a:ea:d1  txqueuelen 1000  (Ethernet)
        RX packets 306  bytes 36831 (36.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1171  bytes 51374 (51.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 9a:13:4a:5a:ea:d1  txqueuelen 1000  (Ethernet)
        RX packets 2194  bytes 176917 (176.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2163  bytes 143399 (143.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 9a:13:4a:5a:ea:d1  txqueuelen 1000  (Ethernet)
        RX packets 3071  bytes 162556 (162.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2690  bytes 366042 (366.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 9a:13:4a:5a:ea:d1  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lanbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.19  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 5471  bytes 356050 (356.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3525  bytes 451121 (451.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3065  bytes 247267 (247.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3065  bytes 247267 (247.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vlan500: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.50.19  netmask 255.255.255.0  broadcast 192.168.50.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 1376 (1.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vlan600: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.19  netmask 255.255.255.0  broadcast 192.168.60.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 1376 (1.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.19  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::9813:4aff:fe5a:ead1  prefixlen 64  scopeid 0x20<link>
        ether 9a:13:4a:5a:ea:d1  txqueuelen 1000  (Ethernet)
        RX packets 5  bytes 814 (814.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 53  bytes 3974 (3.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan.110: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.110.1  netmask 255.255.255.0  broadcast 192.168.110.255
        inet6 fe80::11:2ff:fe03:110  prefixlen 64  scopeid 0x20<link>
        ether 02:11:02:03:01:10  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11  bytes 1026 (1.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan.140: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.140.1  netmask 255.255.255.0  broadcast 192.168.140.255
        inet6 fe80::11:2ff:fe03:140  prefixlen 64  scopeid 0x20<link>
        ether 02:11:02:03:01:40  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11  bytes 1026 (1.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

And the routing table:

root@bpi-r3:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.10    0.0.0.0         UG    0      0        0 lanbr0
0.0.0.0         192.168.0.10    0.0.0.0         UG    0      0        0 wan
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 lanbr0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wan
192.168.50.0    0.0.0.0         255.255.255.0   U     0      0        0 vlan500
192.168.60.0    0.0.0.0         255.255.255.0   U     0      0        0 vlan600
192.168.110.0   0.0.0.0         255.255.255.0   U     0      0        0 wan.110
192.168.140.0   0.0.0.0         255.255.255.0   U     0      0        0 wan.140

Do you have any advice on how to configure the network in order to connect to the internet and update the system? Thank you

it looks your lan-segment for existing router (wan) is same as lan from r3, it needs to be different…and i see i have not disabled my gateway :stuck_out_tongue:

so basicly:

  • if your existing lan uses 192.168.0.0/24, change lanbr0 config to another subnet (e.g. 192.168.1.0/24). you have config-files in /etc/systemd/network and you need to pick the lanbr network file (e.g. using 192.168.1.1 as static ip for the bridge and use your route ip as gateway+dns)
  • then if your r3 get ip on wan, you should be able to ping your router and the internet from R3 itself
  • to get your client on lan-port (which should get an ip from newly subnet 192.168.1.0/24) an internet connection you can either configure masqerading (NAT so all lan-clients are “hidden” behind r3s wan ip) on wan-port or adding a static route to your main-router (it has to know where to send packets for your r3 lan subnet)

Thanks for your reply @frank-w

This is my current lanbr network file

root@bpi-r3:~# cat  /etc/systemd/network/25-lanbr.network 
[Match]
Name=lanbr0

#[Link]
# Override MAC address (spoof MAC address)
#MACAddress=08:22:33:44:55:66

[Network]
BindCarrier=eth0
#ConfigureWithoutCarrier=true

#DHCP=ipv4

#static setup
Address=192.168.0.19/24
Gateway=192.168.0.10
DNS=192.168.0.10

VLAN=vlan500
VLAN=vlan600

IPForward=yes
#needs iptables to be installed
#IPMasquerade=yes

Tunnel=he-ipv6

DHCPServer=yes
#IPv6SendRA=yes
#DHCPv6PrefixDelegation=yes

[DHCPServer]
PoolOffset=100
PoolSize=150

#[IPv6SendRA]
#Managed=true

#[IPv6Prefix]
#Prefix=fd00:A::/64

#[Route]
#Gateway=192.168.0.10
#Destination=10.0.3.0/24
#GatewayOnLink=yes

Just to fully understand what I am doing, I used another laptop, connected it to my home router using an ethernet cable and checked the details of the wired network.

This is the laptop network configuration:

userk@dopamine:~$ ifconfig
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.5  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::ef3f:13c8:2912:166a  prefixlen 64  scopeid 0x20<link>
        ether 52:be:f7:61:e7:85  txqueuelen 1000  (Ethernet)
        RX packets 182  bytes 51246 (51.2 KB)
        RX errors 0  dropped 15  overruns 0  frame 0
        TX packets 648  bytes 78633 (78.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  

and routing table:

userk@dopamine:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 enp4s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 enp4s0
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 enp4s0

So my existing lan uses 192.168.1.0/24, and the IP address of my home router if 192.168.1.1.

if your existing lan uses 192.168.0.0/24, change lanbr0 config to another subnet (e.g. 192.168.1.0/24). you have config-files in /etc/systemd/network and you need to pick the lanbr network file (e.g. using 192.168.1.1 as static ip for the bridge and use your route ip as gateway+dns)

Back the rpi-r3, I changed the following lines in the lanbr network config file and rebooted. Not sure if I got it right…

Address=192.168.0.1/24
Gateway=192.168.1.1
DNS=192.168.1.1

Here is the network configuration after a reboot:

root@bpi-r3:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1504
        ether 66:10:23:c5:d3:6f  txqueuelen 1000  (Ethernet)
        RX packets 1219  bytes 113717 (113.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 809  bytes 83964 (83.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 121  

he-ipv6: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1480
        sit  txqueuelen 1000  (IPv6-in-IPv4)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 66:10:23:c5:d3:6f  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 66:10:23:c5:d3:6f  txqueuelen 1000  (Ethernet)
        RX packets 197  bytes 30544 (30.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 275  bytes 20095 (20.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 66:10:23:c5:d3:6f  txqueuelen 1000  (Ethernet)
        RX packets 1002  bytes 58213 (58.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 381  bytes 43553 (43.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 66:10:23:c5:d3:6f  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lanbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.1  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 1196  bytes 88601 (88.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 478  bytes 53816 (53.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 368  bytes 29866 (29.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 368  bytes 29866 (29.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vlan500: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.50.19  netmask 255.255.255.0  broadcast 192.168.50.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1166 (1.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vlan600: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.19  netmask 255.255.255.0  broadcast 192.168.60.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1166 (1.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.19  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::6410:23ff:fec5:d36f  prefixlen 64  scopeid 0x20<link>
        ether 66:10:23:c5:d3:6f  txqueuelen 1000  (Ethernet)
        RX packets 20  bytes 3018 (3.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 151  bytes 8218 (8.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan.110: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.110.1  netmask 255.255.255.0  broadcast 192.168.110.255
        inet6 fe80::11:2ff:fe03:110  prefixlen 64  scopeid 0x20<link>
        ether 02:11:02:03:01:10  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1166 (1.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan.140: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.140.1  netmask 255.255.255.0  broadcast 192.168.140.255
        inet6 fe80::11:2ff:fe03:140  prefixlen 64  scopeid 0x20<link>
        ether 02:11:02:03:01:40  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1166 (1.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

And the routing table:

root@bpi-r3:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.10    0.0.0.0         UG    0      0        0 wan
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 lanbr0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wan
192.168.50.0    0.0.0.0         255.255.255.0   U     0      0        0 vlan500
192.168.60.0    0.0.0.0         255.255.255.0   U     0      0        0 vlan600
192.168.110.0   0.0.0.0         255.255.255.0   U     0      0        0 wan.110
192.168.140.0   0.0.0.0         255.255.255.0   U     0      0        0 wan.140

Looks like the route is still not correct. Tried adding a static route as you suggested using:

root@bpi-r3:~# route add -net 192.168.0.0/24 gw 192.168.1.1 wan
SIOCADDRT: Network is unreachable
root@bpi-r3:~# ip route add 192.168.0.0/24 via 192.168.1.1 dev wan
Error: Nexthop has invalid gateway.

But I get these errors. Any advice?

Your wan has same ip as lanbr…i thought wan has dhcp and should get an ip from your main-router…so please look into the wan.network file to disable static setup and activate dhcp

Edit: Looked into my image description: 192.168.0.19 on wan-port, 192.168.1.1 on lan-ports,so it seems you have changed lanbr to 192.168.0.19/24 and have not changed wan…

When changing wan it is better to have static ip…e.g. 192.168.1.19 because static route needs a fixed ip.

Your laptop should get an 192.168.0.0/24 ip from r3 lan-port

Thank you very much for your support.

I set DHCP=yes in the wan network file and it worked.

I appreciate your help in this matter.

You ended up in a setup with WAN connected to your router. Is this what you want, or do you want to have a setup where you connect a LAN port to your router? It needs a different network setup, but it is possible also. I use one BPI-router as router and another BPI-router connected LAN-LAN to the real actual router. This setup allows for fast wifi roaming.

Hi Eric!

You ended up in a setup with WAN connected to your router. Is this what you want, […] I just wanted to update the system and install some utilities on my brand new bpi r3.

“I use one BPI-router as router and another BPI-router connected LAN-LAN to the real actual router. This setup allows for fast wifi roaming.” Sorry too many routers, so how many normal routers do you have in your network?

My setup is like this:


          wan
      ROUTER-R64                            ACCESSPOINT-R64
   lan1 lan2 lan3 lan4                  lan1 lan2 lan3 lan4 lan
                   |                     |
                   -----------------------
                  tagged traffic vid 2 & 3

Or in more detail:

ROUTER

                wan  -------------------------------------
                 |                                       |
              IPforward                               IPforward
                 |                                       |
          192.168.1.1                               192.168.2.1
            BRLAN vid 2                               BRGUEST                                         
lan1 lan2 lan3  lan4  wlan0 veth3a                veth3b  wlan0guest
  2    2    2  vid2&3    2   vid 3                  |
                   |          |                     |
                   |          -----------------------
                   |             untagged traffic
                   |
                 To AP

ACCESSPOINT

          192.168.1.2                               192.168.2.2
            BRLAN vid 2                               BRGUEST                                         
 lan1  lan2 lan3 lan4 wlan0 veth3a                veth3b  wlan0guest
vid2&3   2    2    2    2    vid 3                   |
     |                         |                     |
     |                         -----------------------
     |                                 untagged traffic
     |
   To Router

So my BPI-R64 router is my main router, no other router.