Issue with direct ethernet connection RPi4 (Emteria) <> RPi3 (DietPi)
Hi All,
Currently I'm a bit struggling to get a proper ethernet connection between two raspberry pi's.
I'm new to Emteria so maybe I miss some functionality/limitation?
My set-up:
Raspberry Pi 3 B running Dietpi v8.25.1, configured LAN with static IP 10.0.0.2 255.255.255.0
Raspberry Pi 4 B running Emteria v13.4.0, configured LAN with static IP 10.0.0.1 255.255.255.0
Connected to each-other directly with an ethernetcable (no router/switch etc. inbetween)
Both connected to the same WiFi network as well (both with DHCP 192.168.1.x)
I'm trying to stream UDP data from Emteria to Dietpi over the LAN connection between the devices (So I am not depending on the WiFi).
Initially I was only able to ping from DietPi to Emteria but not the other way around.
I've added an IP route/rule to fix this:
ip route add 10.0.0.2/32 dev eth0
ip rule add to 10.0.0.2 lookup eth0
IP route gives:
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.1
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.208
IP route get 10.0.0.2 gives:
10.0.0.2 dev eth0 table eth0 src 10.0.0.1 uid 0 cache
IP rule list gives:
0: from all lookup local
9999: from all to 10.0.0.2 lookup eth0
10000: from all fwmark 0xc0000/0xd0000 lookup legacy_system
11000: from all iif lo oif dummy0 uidrange 0-0 lookup dummy0
11000: from all iif lo oif wlan0 uidrange 0-0 lookup wlan0
11000: from all iif lo oif eth0 uidrange 0-0 lookup eth0
16000: from all fwmark 0x10063/0x1ffff iif lo lookup local_network
16000: from all fwmark 0x10067/0x1ffff iif lo lookup wlan0
16000: from all fwmark 0x10c4f/0x1ffff iif lo lookup eth0
17000: from all iif lo oif dummy0 lookup dummy0
17000: from all iif lo oif wlan0 lookup wlan0
17000: from all iif lo oif eth0 lookup eth0
18000: from all fwmark 0x0/0x10000 lookup legacy_system
19000: from all fwmark 0x0/0x10000 lookup legacy_network
20000: from all fwmark 0x0/0x10000 lookup local_network
23000: from all fwmark 0x67/0x1ffff iif lo lookup wlan0
23000: from all fwmark 0xc4f/0x1ffff iif lo lookup eth0
31000: from all fwmark 0x0/0xffff iif lo lookup wlan0
32000: from all unreachable
Both ping tests back and forth are now fine, both with a stable <1ms time
But unfortunately the UDP stream of data is still not stable.
Also tested successfully:
- Disable WiFi on Emteria (which seems to force the stream over eth0 and then works fine?)
- Emteria stream to Dietpi over WiFi instead of LAN
- Windows laptop stream over WiFi to DietPi
- Windows laptop stream over LAN to DietPi (also configured with static IP 10.0.0.1, plugged ethernet from Emteria into laptop)
To be more specific on the UDP datastream:
This is a Godot "Game" to running on Emteria and also streaming the screen data to DietPi.
But the screen on the DietPi is very laggy.
The Godot code uses the PacketPeerUDP() with set_dest_address(IP_SERVER, PORT_SERVER) and put_packet(buffer) to set up the UDP stream.
Comments
Hi @Futience
Sorry, I think I don't fully comprehend the issue at hand. It seems that the connection is working. What exactly are you struggling with? Is it the screen on the DietPi which is laggy?
Hi smieschek,
Yes, the screen is indeed laggy. It looks to me that some kind of timeout is sometimes causing the screen to lag behind or completely freeze on the Dietpi, while the screen on Emteria (directly from HDMI) stays responsive.
With a working ping I would look at the Godot source to find the cause first but because different options like adding a router inbetween or using WiFi instead of the direct ethernet also solves the problem my guess is that the issue is in the direct ethernet connection, even with a working ping in both directions.
Update: I just found out I actually have a Pi 3 B+, so with an 1000 Base ethernet over USB instead of a direct 100 Base ethernet from the Pi 3 B. I rented a Pi 3 B from a friend to do a comparison and that one seems to work much better! Almost no glitches in the screen on the DietPi with the configuration as described in the intial post. I'm not really familiar with the differences/limitations of the ethernet connections but it looks like this etherenet over USB might cause my issues?
Raspberry Pi 3 B = 100 Base ethernet
Raspberry Pi 3 B+ = 1000 Base ethernet over USB
Raspberry Pi 4 B = 1000 Base ethernet
Depending on the resolution of the stream the 100 MBit Ethernet might be the bottleneck
That's the strange thing, the Pi 3 B with an 100 Mbit Ethernet works, the Pi 3 B+ with 1000 Mbit doesn't. (Tested with the exact same sd card)
Ow and the resolution is only 198x128, so that sound not be an issue at all.
Small update,
I've swapped the Pi 3 B+ for a Pi 4.
Did a clean install of Emteria v13.4.0 and ran the command:
ip rule add to 10.0.0.2 lookup eth0
After this the screen works fine, only sometimes a small glitch appears which I still need to figure out.
Altough I would like to know the issue with the Pi 3 B+ this is suitable for now.
(any thoughts on the Pi 3 B+ issue are appriciated)
But now I want to make this ip command run at startup of the Pi offcourse.
I followed this link
But unfortunately the script doesn't seem to run at startup.
I've used the following command to configure my script:
chown root:system /data/init.d/iprule
chmod 0755 /data/init.d/iprule
(seems like a similar issue as this link)
What are steps I can take to get this script to run at startup?
EDIT:
the line ending between windows and unix seemed to be the problem.
I ran 1 more comment to fix the script:
dos2unix /data/init.d/iprule