I’m a beginner, and I’d like to ask a question. I have a NAS PC using ZimaOS, which has multiple Ethernet ports. The topology is Router > NAS PC with ZimaOS > Personal PC. The NAS PC’s eth1 is connected to the router, and eth0 is connected to the Personal PC. Now, in the ZimaOS UI, there is no option for NAT Bridge Network. How can I achieve this using an SSH command?
Finally Fixed
Network Bridge in ZimaOS:
I have a topology: Router > NAS PC ZimaOS > Personal PC. My goal is to make the NAS PC a network bridge.
-
First Step: Ensure the Network Settings on Zima OS DHCP are enabled for both eth0 and eth1 ports.
-
Second Step: Ensure you have another drive partition (in my case, I have the sda1 partition as an additional hard drive).
-
Third Step: Create a script on the sda1 partition with the name
bridge-setup.sh
. I manually created this script and copied it to the sda1 partition (you can use the SMB protocol for file transfer). The script content is as follows:
#!/bin/bash
systemctl stop NetworkManager 2>/dev/null
ip addr flush dev eth1
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip route add default via 192.168.1.1 dev br0
ip link set dev eth0 up
ip link set dev eth1 up
ip link set dev br0 up
ip route add default via 192.168.1.1 dev br0
ip addr add 192.168.1.102/24 dev br0
ip route add default via 192.168.1.1
- Fourth Step: Open the terminal on ZimaOS by navigating to Settings > General > Developer Mode > View > Enable SSH Access > Open Web-Based Terminal. Login with your username and password, then execute the following commands:
sudo chmod +x /media/sda1/bridge-setup.sh
sudo sh /media/sda1/bridge-setup.sh
sudo ip route add default via 192.168.1.1 dev br0
Wait a few minutes (around 5), and voila! ZimaOS can now act as a Network Bridge for my Personal PC.
Disclaimer:
- I configured my NAS PC so that its IP remains consistent at 192.168.1.102 through DHCP Binding on my router, ensuring it doesn’t change. The configuration above also sets the ZimaOS Bridge Network IP as 192.168.1.102 on the NAS PC (you can adjust it to suit your needs).
- If the NAS PC restarts, the commands need to be manually re-executed through the Web-Based Terminal using
sudo sh /media/sda1/bridge-setup.sh
andsudo ip route add default via 192.168.1.1 dev br0
, as I have yet to find a way for the.sh
script to autorun during boot. - Hopefully, future ZimaOS updates will include a built-in network bridge feature.
Since ZimaOS doesn’t have a autorun startup built-in Bridge feature, I’ve devised a workaround using my personal Windows PC, which is connected to the same WiFi router as my NAS. When powered on, the PC runs a script to activate the ZimaOS bridge via SSH.
Steps to Set Up:
-
Create a folder anywhere on your Windows system (I placed mine at
D:\ZimaOS-Bridge
). -
Inside that folder, create a file named
run.cmd
(you can use Notepad, select Save As, set file type to All Files, and name itrun.cmd
). Edit the.cmd
file to include the following:@echo off REM // ============================================== REM // 1. Run Plink to execute the bridge script REM // ============================================== start /min plink.exe -batch -ssh yourusername@192.168.1.102 -pw "yoursshpassword" "echo 'yoursudopassword' | sudo -S sh /media/sda1/bridge-setup.sh" REM // ============================================== REM // 2. Wait 3 seconds, then close all CMD instances except this one REM // ============================================== timeout /t 3 /nobreak > nul taskkill /f /im plink.exe >nul 2>&1 taskkill /f /fi "WINDOWTITLE eq Administrator: Command Prompt*" /im cmd.exe taskkill /f /fi "WINDOWTITLE eq Administrator: run.cmd*" /im cmd.exe
-
Download
plink.exe
from putty.org and place it in the same folder asrun.cmd
(in my case,D:\ZimaOS-Bridge
, which now containsplink.exe
andrun.cmd
). -
To execute the Bridge Network script, simply run
run.cmd
. If you want it to launch automatically whenever your Personal PC boots up, create a shortcut forrun.cmd
by:- Right-clicking
run.cmd
- Selecting Send To > Desktop (create shortcut)
- Moving the shortcut to
"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp"
- Right-clicking
Notes:
- If
bridge-network.sh
has already been executed and the NAS remains powered on, rerunningbridge-setup.sh
isn’t necessary. However, since I frequently turn my NAS on and off, automation ensures that whenever both my NAS and Personal PC are powered on, the bridge activates seamlessly without manual input. - If a personal PC running Windows has never paired SSH with the NAS PC before, pairing is required to generate the fingerprint first. To do this, open PowerShell and type
"ssh username@192.168.102"
. After that, a fingerprint will appear—type"yes"
and press Enter.
Fixing Network Speed Detection in ZimaOS: Avoid Bottlenecks in File Transfers & Internet Connectivity
ZimaOS sometimes detects network speeds inaccurately, especially in mixed-speed topologies. For example, consider this setup:
Router > eth1 (1GbE) > PC NAS > eth0 (10GbE) > Personal PC
ZimaOS often defaults to recognizing the lowest available speed—in this case, 1GbE. As a result, when bridging the network, local file transfers between the Personal PC and PC NAS suffer from bottlenecks.
Solution
To ensure proper speed detection and network performance, add the following line at the beginning of your script, right after #!/bin/bash
:
ethtool -s eth0 speed 10000 duplex full
This command forces eth0
to run at 10GbE full duplex, ensuring that both the PC NAS and Personal PC are properly bridged. With this fix in place:
- The internet connection works seamlessly.
- Local file transfers happen at full speed, without bottlenecks.
Hi, why did you delete this? Are there any concerns?
In my previous comment there was a bug, I tried using the praqma/network-multitool method from docker but this method caused a bug, sometimes the host couldn’t connect to the internet so I deleted the comment, and it was still more stable using the Putty Plink and SSH method from outside ZimaOS. From ZimaOS, are there any plans to integrate the Bridge Network feature into the OS?
Not in the short term. Actually, I considered your version to be good enough the moment I saw it. Maybe you can perfect it. And community users can gain from your craft.
Yup actually I have tried several times to fix the method via the docker image praqma/network-multitool but it is still not as stable and efficient as the direct execution method of .sh. And because the ZimaOS Immutable Distro filesystem is read-only creating /etc/systemd/system/bridge-setup.service is impossible so the option to autorun can only be done via SSH using another device. Actually you can implement based on my .sh script into .service then adopted into your OS GUI, but because your priorities are certainly not only my suggestions but you certainly take care of many things. I thank you for what you have done, ZimaOS Developer Maintainer for everything you have tried. Peace from me
Anyway, I suggest you attach your work here. And if you approve, I will suggest our team, and they might merge your code and make it a feature for everyone. Remember, IceWhale is driven by the Community. Look forward to your feedback.
Of course I really agree with contributing to everyone, that’s why I only attach stable results so as not to harm people if my code contains bugs
The engineer shared one more method applied to ZimaOS to bridge the network:
Use a dedicated connected screen and keyboard instead of SSH to do the config
The configuration will persist even after the OS upgrade. But you can use the webUI to modify the NIC settings at any time.
If you destroy the network configuration, you can reset the network by referring to this tutorial:
I tried on ZimaOS 1.4.1 command nmtui but it resulted in
NetworkManager is not running.
then I tried to force NetworkManager but the same:
sudo sysctl start NetworkManager
sysctl: cannot stat /proc/sys/start: No such file or directory
sysctl: cannot stat /proc/sys/NetworkManager: No such file or directory
finally I went back to my method of using ssh command.
I think if ZimaOS can implement network configuration like openmediavault it will be good enough in implementing its configuration