NanoPi R4S-RK3399 is a great new OpenWrt device

	set_interface_core 4 "eth0"
	set_interface_core 8 "eth1"
	#spread the queues to cpu 4 & 5 
	find /sys/class/net/eth*/queues/[rt]x-[01]/[rx]ps_cpus -exec sh -c '[ -w {} ] && echo 30 > {} 2>/dev/null' \;
	;;

Try this also see is that makes any difference to your testing

Im trying to create a Backup of the SD card, just incase it fails.

So in ubuntu i create the image (Sandisk Extreme Pro 64GB)

This completes fine, i then try to restore the image to a Sandisk Ultra 64GB and get the below

The image has 53GB of unallocated space, so how do i get this on another 64GB?

Even if they are labeled as "64GB" two sd-cards may differ in size (amount of bytes). The error message tells you, that you're trying to restore the image of the bigger sd-card to a smaller sd-card.

Try using dd in a terminal window. Since the last 53GB is empty space, it might not bother dd a whole lot... or OpenWRT either. The dd command will fuss at the end, but the partitions with data will be written; only 34MB of empty space won't be written.

I've restored an image from a 32GB card to a slightly smaller 32GB card without issue. I've made sure I used only 29.5GB of the card, leaving a rather large empty buffer zone for slightly smaller cards.

And in the future, you could use dd to make an image of, say, the 1st 12GB of the card instead of all 64GB when only about 11GB is used.

dd if=/path/to/filename.img of=/dev/mmcblk0 bs=1M status=progress
2 Likes

cheers, yeah I originally tried with some windows software and it said write despite it been bigger, but the router wouldnt boot from SD card, i was hoping the ubuntu gui would say write anyways

image

it did show the below error but at least it boots, cheers :slight_smile:

How do i use DD to make a backup of only the space used?

So on the backup SD it booted and run fine, i went to upgrade the image

https://firmware-selector.openwrt.org/?version=23.05.2&target=rockchip%2Farmv8&id=friendlyarm_nanopi-r4s

using EXT4 version

this all upgraded fine, but the router has no internet connection, this might be because adgaurd no longer seems to be installed, along with openvpn, dynamicDNS.

ADgaurd installed is this [How-To-Updated 2021] Installing AdGuardHome on OpenWrt [Manual and opkg method] - #597 by AlanDias17

but i think theres a new verion that can be installed via opkg?

So when upgrading how do I keep all currently installed packages installed and running

thanks. At the moment I use a Draytek AP for my wifi (wired from the Linksys) and all other devices wired. So the idea of trying an R4S with a managed switch is interesting....any drawbacks to watch out for?

I don't see any issue there, if you are already fine with WRT3200ACM (in fact, I own both as well)

Here is a man page for dd. To copy only the first 12GB using 1MB blocks, you need to copy 12K blocks.
You could also use 'truncate' on the 64GB image you already have (consider making a copy first, then trying the truncated image). This should work fine since there is typically no metadata at the end of an image beyond partition boundaries. The 12G file could be written to anything at least 12G in size. And in reality, you have just over 11G. You could do the detailed math on last partition2 sector * sector size = minimum image size.

https://www.man7.org/linux/man-pages/man1/dd.1.html
https://man7.org/linux/man-pages/man1/truncate.1.html

dd if=/dev/mmcblk0 of=/path/to/file.img bs=1M count=12K status=progress

truncate -s 12G /path/to/file.img
1 Like

I've been using an R4S gateway with a GS308T managed switch, and with a security system on wired Ethernet and a couple dumb APs (RT3200 and Reyee RG-E5) on the switch - all running OpenWrt - for some time. I've had no issues at all with the R4S in this configuration. The R4S provides DHCP service and DoH for several VLANs, adblock, and SQM on the WAN interface...all works very well. My ISP service is only 500/20 down/up, so the R4S is tremendously underutilized, but I've plenty of future proofing.

2 Likes

Previously I even run LXC on R4S to make PiHole together with OpenWrt.

Silly question, but im thinking of going the same route, with the openWRT supported Netgear. Do you configure VLANs on the switch? Or the R4S?

Yes :wink: I'll PM you since this is kind of OT

i just fresh installed openwrt on a r4s device, tried to do some SQM and found that r4s cannot reach 500mb on SQM (my ISP is 500/250).

is there anything i should do?

Hi. There are a few discussion on that in this thread.

To get full bandwidth with SQM it may be necessary to put certain processes on the faster A72 performance cores and not let them run on the slower A52 efficiency cores.

Search for SQM, IRQ, queues, cpu affinity, IRQ balance etc. in this topic.

One such post is:

Also posts in the last 9 days or so.

Enjoy!

1 Like

thanky you, i will take a look. Also should i enable packet steering and software flow offloading?

Sorry, I read about this stuff but I don't actually use these since I seldom put much load on my network.

Hopefully the experts here will give you the info you seek.

Good Luck!

Is anyone running 23.05 with the R4S? I'm asking this because I'm seeing a strange behavior of eth1. For some reason, even if it is configured as "autonegotiate on"by default, it is not enabling Ethernet Flow Control as it should. I've already tried connecting it to different switches (which have for sure flow control auto-negotiation enabled), but for some reason it is not working.

Interestingly enough with 22.03, ethtool -a eth1 resulted in an error, but I confirmed (on switch side) that it was correctly auto-negotiating the ethernet flow control.

So:

  1. With 22.03, eth1 ethernet flow control auto-negotiation was working OK, but ethtool -a eth1 resulted in an error.
  2. With 23.05, eth1 ethernet flow control auto-negotiation is not working, but ethtool -a eth1 is working now.
  3. This way there is some change from 22.03 to 23.05 that enabled ethtool to work with eth1, but it broke flow-control auto-negotiation.
  4. ``eht0``` is working fine, both with 22.03 and 23.05 (by fine I mean it is correctly auto-negotiating ethernet flow control and ethtool works fine with this interface.
 -----------------------------------------------------
 OpenWrt 23.05.2, r23630-842932a63d
 -----------------------------------------------------
root@router:~# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate:	on
RX:		off
TX:		off
RX negotiated: on
TX negotiated: on

root@router:~# ethtool -a eth1
Pause parameters for eth1:
Autonegotiate:	on
RX:		off
TX:		off
RX negotiated: off
TX negotiated: off

root@router:~#

/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 'fd34:xxxx:xxxx::/48'
	option packet_steering '1'

config device 'eth0'
        option name 'eth0'
        option macaddr 'xx:xx:xx:xx:xx:30'

config device 'eth1'
	option name 'eth1'
        option macaddr 'xx:xx:xx:xx:xx:31'

config interface 'lan'
	option device 'eth1'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	list dns_search 'home'
	option ip6assign '64'

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

config interface 'wan6'
	option device 'eth0'
	option proto 'dhcpv6'
	option peerdns '0'
	option reqaddress 'try'
	option reqprefix 'auto'

(...)
 -----------------------------------------------------
 OpenWrt 23.05.2, r23630-842932a63d
 -----------------------------------------------------

root@Gateway:~# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate:  on
RX:             off
TX:             off
RX negotiated:  on
TX negotiated:  on

root@Gateway:~# ethtool -a eth1
Pause parameters for eth1:
Autonegotiate:  on
RX:             on
TX:             on
RX negotiated:  off
TX negotiated:  off

Edit
Eth1 is connected to switch where flow control is off, and if enabled flow control on switch:

root@Gateway:~# ethtool -a eth1
Pause parameters for eth1:
Autonegotiate:  on
RX:             on
TX:             on
RX negotiated:  on
TX negotiated:  on
1 Like

Thanks. Have you manually forced eth1 TX/RX flow via ethtool? I mean this:

RX:             on
TX:             on

What I would expect is the same as eth0:

RX:             off
TX:             off
RX negotiated:  on
TX negotiated:  on

I'm asking this because I tested the default config with multiple switches (including a managed one where I've verified the flow control as enabled).

By manually enabling TX/RX via ethtool (ethtool -A eth1 autoneg on rx on tx on) I can get this (the same result as yours), but this is not the default behavior (neither seems to be ideal):

root@router:~# ethtool -a eth1
Pause parameters for eth1:
Autonegotiate:  on
RX:             on
TX:             on
RX negotiated: on
TX negotiated: on