NanoPi R4S-RK3399 is a great new OpenWrt device

If it doesn't support > 1500 MTU then it will probably work until you get a full packet which will be 1500 + Vlan tag (1504?) which won't work..

Maybe promiscuous mode means you can receive larger packets but can't send them?

Hi,
could someone explain error messages in kernel log (dmesg) and what to do to fix it?

reg-fixed-voltage vcc3v3-sys: Failed to register regulator: -517
reg-fixed-voltage vcc5v0-sys: Failed to register regulator: -517
reg-fixed-voltage vcc1v8-s3: Failed to register regulator: -517
reg-fixed-voltage vcc3v0-sd: Failed to register regulator: -517
rk_gmac-dwmac fe300000.ethernet: phy regulator is not available yet, deferred probing
fan53555-regulator 0-0040: Failed to register regulator!
fan53555-regulator 0-0041: Failed to register regulator!
rk808 0-001b: failed to register 0 regulator
rk_gmac-dwmac fe300000.ethernet: cannot get clock clk_mac_speed

I tried compiling openwrt, immortalwrt ... but the result is the same.
Firmware from @mj82 with kernel 5.14 working without this errors.
Thanks in advance

Does your image not have a DHCP server enabled on LAN port? my clients are not getting an assignment.

I have the UART connected to see what's going on

root@OpenWrt:/# logread -f
Fri Jan 18 08:54:02 2013 daemon.info dnsmasq-dhcp[2927]: DHCPDISCOVER(br-lan) 40:8d:5c:52:ca:1f
Fri Jan 18 08:54:02 2013 daemon.info dnsmasq-dhcp[2927]: DHCPOFFER(br-lan) 192.168.1.116 40:8d:5c:52:ca:1f
Fri Jan 18 08:54:22 2013 daemon.info dnsmasq-dhcp[2927]: DHCPDISCOVER(br-lan) 40:8d:5c:52:ca:1f
Fri Jan 18 08:54:22 2013 daemon.info dnsmasq-dhcp[2927]: DHCPOFFER(br-lan) 192.168.1.116 40:8d:5c:52:ca:1f
Fri Jan 18 08:54:55 2013 daemon.info dnsmasq-dhcp[2927]: DHCPDISCOVER(br-lan) 40:8d:5c:52:ca:1f
Fri Jan 18 08:54:55 2013 daemon.info dnsmasq-dhcp[2927]: DHCPOFFER(br-lan) 192.168.1.116 40:8d:5c:52:ca:1f
Fri Jan 18 08:54:57 2013 daemon.info dnsmasq-dhcp[2927]: DHCPDISCOVER(br-lan) 40:8d:5c:52:ca:1f
Fri Jan 18 08:54:57 2013 daemon.info dnsmasq-dhcp[2927]: DHCPOFFER(br-lan) 192.168.1.116 40:8d:5c:52:ca:1f
Fri Jan 18 08:55:04 2013 daemon.info dnsmasq-dhcp[2927]: DHCPDISCOVER(br-lan) 40:8d:5c:52:ca:1f
Fri Jan 18 08:55:04 2013 daemon.info dnsmasq-dhcp[2927]: DHCPOFFER(br-lan) 192.168.1.116 40:8d:5c:52:ca:1f

it just iterates over and over and the client gives up with autoconfig 169.xx range. This doesn't happen on other images.

This is my take on it, because this is not yet in stable I figured I will need to be flashing the r4s often, perhaps with different builds.

I decided to convert my router configuration to infrastructure as code, with the help of ansible and https://github.com/gekmihesg/ansible-openwrt

I simply run ansible command and within a few minutes I have all my openwrt settings and packages, my openvpn and wireguard tunnels and my static_dns settings for devices, etc. It was a pain in the ass to do and learn how to debug that ansible-openwrt library without a lot of documentation - but after 3 weekends and a lot of trial and error it works.

Perhaps consider doing that? the only cool thing is that now when I want to add new networks (vlans) I simply just add a new element to my config like so:

  vars:
    wan_nic: eth1 #wan NIC in r4s = eth0
    lan_nic: eth0
    networks: #vlan 200 uses WAN for internet. 666 no internet.
    - {  
      vlanid: '666', 
      ipaddr: '172.66.6.1', 
      netmask: '255.255.255.0', 
      ip6assign: false,
      dhcp_range_start: '200',
      dhcp_range_end: '220',
      ifname: 'vpn_privacy', 
      zone: 'vpn_privacy',
      fw_input: 'ACCEPT',
      fw_output: 'ACCEPT',
      fw_fwtraffic: 'ACCEPT',
      forwarding: true,
      fw_zones: ['surfsharktun'], #do not wan to avoid leaks
      custom_route: true, #trigger configuration loop
      route_lookup_table: '30',
      route_priority: '30000'} #priority must be <32700
    - {  
      vlanid: '100', 
      ipaddr: '172.100.0.1', 
      netmask: '255.255.255.0',
      ip6assign: true, 
      dhcp_range_start: '20',
      dhcp_range_end: '50',
      ifname: 'untrusted', 
      zone: 'untrusted',
      fw_input: 'ACCEPT',
      fw_output: 'ACCEPT',
      fw_fwtraffic: 'ACCEPT',
      forwarding: true,
      fw_zones: ['vpsgw', 'surfsharktun'],
      custom_route: true,
      route_lookup_table: '20',
      route_priority: '30000'}
    - {  
      vlanid: '200', 
      ipaddr: '172.200.0.1', 
      netmask: '255.255.255.0',
      ip6assign: true, 
      dhcp_range_start: '20',
      dhcp_range_end: '50',
      ifname: 'vms', 
      zone: 'vms',
      fw_input: 'ACCEPT',
      fw_output: 'ACCEPT',
      fw_fwtraffic: 'ACCEPT',
      forwarding: true,
      fw_zones: ['lan', 'wan'],
      custom_route: false,
      route_lookup_table: '20',
      route_priority: '30000'}
    lan_devices: #todo: static_ip should be var + last octec
    - {  
      dns_name: 'myvm', 
      static_ip: '172.17.200.250', 
      mac: 'C6:6xx:66'}
    - {  
      dns_name: 'test2', 
      static_ip: '172.66.0.99', 
      mac: 'C6:xxx6'}
    cgnat_config:
    - {
      description: "x",
      interface_name: "vpsgw",
      mtu: '1350',
      allow_traffic_forwarding: false,
      forwarding_zones: ['surfshark', 'lan'],
      host_addr: 'x',
      host_port: '88',
      keep_alive: '19',
      allowed_ips: ['0.0.0.0/0', '::/0'],
      set_default_route: '0',
      host_pk: 'x=',
      preshared_key: 'yx=',
      local_tunnel_ips: ['10.100.100.10/24', '2605:x:x::10/64'],
      local_private_key: "x"}
    ovpn_client: #assumes ovpn network has been created
    - {  
      name: 'surfsharktun', 
      enabled: '1',
      device: 'tun0', 
      fw_zone: 'surfsharktun', #must already exist from prev play.
      masq: '1',
      masq6: '0',
      mtu_fix: '1',
      fw_input: 'REJECT',
      fw_output: 'ACCEPT',
      fw_fwtraffic: 'REJECT',
      ip4table: '30',
      ip6table: '30',
      ansible_auth_file: 'surfshark_udp.auth',
      auth_file_copyto: '/etc/openvpn/surfshark_udp.auth',
      ansible_vpn_cfg: 'surfshark_udp.ovpn',
      vpn_cfg_copyto: '/etc/openvpn/surfshark_udp.ovpn'
      }

1 Like

I'm back into testing mode this weekend, two questions:

  • why is "option macaddr '68:27:19:ac:a5:fa'" on both eth1 and eth0?
  • why is there no 'wireguard' package in the opkg repo? I worked around by removing the ansible task that triggers package install but this is not something one would expect?
root@meow:/# opkg install wireguard
Unknown package 'wireguard'.
Collected errors:
 * opkg_install_cmd: Cannot install package wireguard.
root@meow:/#

duplicate macs issue:

root@meow:/# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd71:7812:8018::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth1'

config device
        option name 'eth1'
        option macaddr '6a:27:19:ac:a5:fa'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.44.1'
        option ipv6 'on'
        option type 'bridge'

config device
        option name 'eth0'
        option macaddr '68:27:19:ac:a5:fa'

config interface 'wan'
        option proto 'dhcp'
        option ifname 'eth0'

config interface 'wan6'
        option proto 'dhcpv6'
        option ifname 'eth0'
        option reqaddress 'force'
        option reqprefix 'no'
        option defaultroute '1'

config interface 'docker'
        option device 'docker0'
        option proto 'none'
        option auto '0'

config device
        option type 'bridge'
        option name 'docker0'

config interface 'vpn_privacy'
        option ifname 'eth1.666'
        option netmask '255.255.255.0'
        option ipaddr '172.66.6.1'
        option proto 'static'

config interface 'untrusted'
        option ifname 'eth1.100'
        option netmask '255.255.255.0'
        option ip6assign '64'
        option ipaddr '172.100.0.1'
        option proto 'static'

config interface 'vms'
        option ifname 'eth1.200'
        option netmask '255.255.255.0'
        option ip6assign '64'
        option ipaddr '172.200.0.1'
        option proto 'static'

config rule 'vpn_privacy_routing'
        option priority '30000'
        option lookup '30'
        option in 'vpn_privacy'

config rule 'untrusted_routing'
        option priority '30000'
        option lookup '20'
        option in 'untrusted'

config interface 'surfsharktun'
        option ifname 'tun0'
        option ip4table '30'
        option ip6table '30'
        option proto 'none'

root@meow:/#

The br-lan bridge is broken and DHCPv4 is not given to clients :confused:

I was using the @anaelorlinski latest image. Going to try the openwrt SNAPSHOT image and see if the results are the same.

why is there no 'wireguard' package in the opkg repo?

It looks like the standalone wireguard package is not needed anymore as of the snapshot builds, due to wireguard being integrated into the kernel instead:
https://forum.openwrt.org/t/no-more-wireguard-package-in-snapshot/90267/3

1 Like

thanks!

I was able to figure out why my ansible playbook was not working on openwrt 20.02 - the 'ifname' to 'device' migration changed the configuration syntax.

you might consider these. richb-hanover/OpenWrtScripts: A set of scripts for maintaining and testing OpenWrt (github.com)

specifically the https://github.com/richb-hanover/OpenWrtScripts#config-openwrtsh one. i used that with bit of editing to be able to auto config from clean flash to working. Add in or take away whatever you want. Also means for testing issues etc you dont miss a package or screw up a config. Its helped me go from 19.07 through all the 20 RCs.

1 Like

I found out that using the ext4 version that 'factory reset' function will not work ("firstboot && reboot now"). Trying a squashfs image instead.

Does anyone have any recommended ways to extend the partition to the rest of the microSD?

root@OpenWrt:/# fdisk -l
Disk /dev/loop0: 963.06 MiB, 1009844224 bytes, 1972352 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk0: 58.09 GiB, 62377689088 bytes, 121831424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: x

Device         Boot  Start     End Sectors Size Id Type
/dev/mmcblk0p1 *     65536  147455   81920  40M 83 Linux
/dev/mmcblk0p2      196608 2293759 2097152   1G 83 Linux

Sidebar question: does anyone have any good example github action/workflows repositories to fork that automate the building of images with all kmods and packages desired?

That is a known behaviour of images without a read-only core (squashfs rootfs), so ext4 or jffs2 images without an overlay. The factory reset technically works by deleting the writable overlay and re-creating it on the next boot (with the contents of the underlying read-only squashfs providing the defaults again), you don't have that on ext4 images, any change is final (target independent, so no r4s specific, but also happening on any other target providing ext4 or jffs2 images e.g RPi, x86, x86_64 or even ar71xx or bcm47xx in older releases).

2 Likes

Looks like RC4 has finally added the R4S!

OpenWrt 21.02.0 Fourth release candidate - Release and security announcements - OpenWrt Forum

New hardware targets

A new realtek target has been added, which is often found in managed switches. As a result, it is now possible to run OpenWrt on devices with a significant number of Ethernet ports. See supported devices for realtek.

In addition, new bcm4908 and rockchip targets have been added.

1 Like

should the R4S build be listed here? I only see R2S https://downloads.openwrt.org/releases/21.02.0-rc4/targets/rockchip/armv8/

No, r4s support has only been merged after openwrt-21.02 was branched off - unless it gets backported to this stable branch (at this point probably not too likely), it's not going to be part of the 21.02.x stable releases (but will be part of the next major stable release after that).

The commits were in june... /sigh/ and it was in patch notes that there was updated rockchip targets.
git.openwrt.org Git - openwrt/openwrt.git/commit

well balls to it. I'll keep using anaelorlinski/OpenWrt-NanoPi-R2S-R4S-Builds: OpenWRT Builds for NanoPi R2S & R4S from official Openwrt source code with minimal set of patches (github.com) once he builds off RC4.

I still have that reboot bug on the snapshot (updated yesterday). Every time I reboot, I have to pull off the power supply and plug it again. I think it's related to the MicroSD card reader/driver. Anyone also having this issue? Is it easily solvable (i.e. without patching and recompiling manually)?
I haven't had this on FriendlyWRT.

I bought one of these to tinker with due to the promising initial results in this thread, but have been unable to get mine to boot. Tried snapshot and compiling from a fresh clone of master (my x86_64 and ipq806x builds work perfectly). I have been prepping the SD card with the following:

>sudo shred -f -v -n 0 -z /dev/sde   (clear all sectors)

>sudo fdisk /dev/sde                 (to write dos disklabel then quit)

>sudo dd if=openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-squashfs-sysupgrade.img of=/dev/sde

SD card then shows the following from fdisk:

Disk /dev/sde: 30.01 GiB, 32220643328 bytes, 62930944 sectors
Disk model: USB3.0 CRW-SD/MS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5452574f

Device     Boot  Start    End Sectors  Size Id Type
/dev/sde1  *     65536  98303   32768   16M 83 Linux
/dev/sde2       131072 344063  212992  104M 83 Linux

Insert SD card into R4S and connect power. Red power light comes on but that's it. Ethernets never come up.

Can someone point out if I am doing something obviously wrong before I have to open the unit and connect to serial? Perhaps I have a bad unit?

This sounds familiar to my first tries with this device, if the microSD is not properly formatted no LEDs or anything will boot. I even purchased a UART cable to see the serial output, apparently if the microsd is also not properly formatted then serial output will also be nil.

My recommendation is to try using balenaEtcher to flash the SD card using a known image like snapshots from owrt and go from there.

Soft reboot issue is mentioned earlier in this post.

1 Like

you did untar/zip the image right?

I made that mistake when i flashed first time however i have a serial connection and once i figured it out and reflashed it booted fine.

Also try both ethernet ports. Mine got flipped on a couple of builds.

resize2fs

There is a guide here. RPi Resize Flash Partitions - eLinux.org
Its for the pi but the section you want is right at the bottom. - Manually resizing the SD card on Raspberry Pi.

1 Like