RatOS eth0 issues.

Hello. I am having this issue where the raspberry pi does not want to communicate with my dhcp for a dynamic ip address. When setting it static address i can access the gateway which is on another ip than the dhcp, but i can still not reach the dhcp server nor can i reach my network. Had IT support trying to figure out the issue, but they can also not answer anything so far. The machines are in a facility along other printers at a corporation, used in the print farm. So the network infrastructure is huge and managed. All other raspberry pies with RaspOS, 3DPrinterOS is working as they are supposed to via ethernet, the only release of *nix that will not play ball is RatOS. Is there a way to revert back to "stock" RaspOS network logic? Wifi is out of the question. Running RatOS 2.1 image from github on a raspberry pi 3b+. Machine is two RatRig Vcore 3.1
8 Replies
blacksmithforlife
eth0 wasn't changed by ratos, so that should work. Without more details of your network setup there is no way to help troubleshoot this
Qwuille
QwuilleOP3w ago
The RPi is directly connected to a managed switch. Got some feedback from the IT department, they are saying that RatOS is trying to get an IP, but drops it immediately when i gets one and then requests a new one, it does this until it has exhausted all the IP numbers. Also, how does one rename the Wifi Hotspot name? for instance "RatOS Printername" ? Found it, edit /etc/hostapd/hostapd.conf Update, so i can connect to the local machines and computers in the same subnet when o connect to the hotspot. It is like it is acting as a router, surely a company security feature. But it seems something with the hotspot is taking the ethernet port too, so i cant do what it is supposed to do or something.
blacksmithforlife
not sure why your network is messed up - but I don't have this issue. Plug in ethernet and it just works as it is supposed to
Qwuille
QwuilleOP3w ago
I think i know why now. https://github.com/km4ack/pi-scripts/blob/master/autohotspotN-setup This one is used what i can see and it shares internet when connected to hotspot, so the script will make the hotspot act as a router, at the company there is only allowed one entity through each ethernet cable. It can detect that there are multiple entities and that is why it is not working as supposed. It would be better if there is no ethernet, the hotspot shows, when there is an ethernet connection, the hotspot dies and you get access to the Pi through regular wired network.
GitHub
pi-scripts/autohotspotN-setup at master · km4ack/pi-scripts
Various scripts written for ham radio pi. Contribute to km4ack/pi-scripts development by creating an account on GitHub.
blacksmithforlife
sudo systemctl disable autohotspot then?
It would be better if there is no ethernet, the hotspot shows, when there is an ethernet connection, the hotspot dies and you get access to the Pi through regular wired network.
for your setup - I wouldn't want it that way, and it goes against the RatOS ethos of making things easier. if you have something wrong with hotspot and not ethernet, how do you recover?
Qwuille
QwuilleOP3w ago
So have been fiddling around a lot now and saw also that the autohotspotN is based on "wifi with internet on ethernet" section, did see that there is a "wifi with no internet via ethernet" setup too, that would bypass the usage of ethernet and allow it to work in our network. There are a lot of devices that when eth0/ethernet is connected, the hotspot dies, when no ethernet/internet the hotspot starts up again. Also when joining networks, just like a google/alexa home device does and so many others. But for now, how to have the hotspot left and that the hotspot does nothing with et0/ethernet?
mazas
mazas2w ago
If you feel adventurous and don't mind breaking possible future updates of RatOS, you could do what I have on my printer. I have a small service that periodically checks whether eth0 is connected and disables the AP if it is. If not, it enables the AP. Also, to make the AP not work as a router, I disabled NATting and routing. These changes have seen extremely little testing, and are more like a skeleton that you might want to try if you really need to make this work soon. Service file for the ap monitor:
root@ratos:/usr/bin# ls -l /etc/systemd/system/ap-monitor.service
-rw-r--r-- 1 root root 192 Mar 14 16:49 /etc/systemd/system/ap-monitor.service
root@ratos:/usr/bin# cat /etc/systemd/system/ap-monitor.service
[Unit]
Description=Monitor Ethernet and Control Access Point
After=network.target

[Service]
ExecStart=/usr/local/bin/ap-monitor
Restart=always
User=root

[Install]
WantedBy=multi-user.target
root@ratos:/usr/bin# ls -l /etc/systemd/system/ap-monitor.service
-rw-r--r-- 1 root root 192 Mar 14 16:49 /etc/systemd/system/ap-monitor.service
root@ratos:/usr/bin# cat /etc/systemd/system/ap-monitor.service
[Unit]
Description=Monitor Ethernet and Control Access Point
After=network.target

[Service]
ExecStart=/usr/local/bin/ap-monitor
Restart=always
User=root

[Install]
WantedBy=multi-user.target
The exec file:
root@ratos:/usr/bin# ls -l /usr/local/bin/ap-monitor
-rwxr-xr-x 1 root root 388 Mar 14 17:04 /usr/local/bin/ap-monitor
root@ratos:/usr/bin# cat /usr/local/bin/ap-monitor
#!/bin/bash

while true; do
if ip a show eth0 | grep -q "inet "; then
echo "Ethernet connected, stopping access point..."
systemctl disable --now hostapd autohotspot # Stop and disable AP
else
echo "No Ethernet, enabling access point..."
systemctl enable --now autohotspot # Enable and start AP
fi
sleep 30 # Check every 30 seconds
done
root@ratos:/usr/bin# ls -l /usr/local/bin/ap-monitor
-rwxr-xr-x 1 root root 388 Mar 14 17:04 /usr/local/bin/ap-monitor
root@ratos:/usr/bin# cat /usr/local/bin/ap-monitor
#!/bin/bash

while true; do
if ip a show eth0 | grep -q "inet "; then
echo "Ethernet connected, stopping access point..."
systemctl disable --now hostapd autohotspot # Stop and disable AP
else
echo "No Ethernet, enabling access point..."
systemctl enable --now autohotspot # Enable and start AP
fi
sleep 30 # Check every 30 seconds
done
The changes for the autohospotN:
root@ratos:/usr/bin# diff autohotspotN autohotspotN.orig
48,49c48,49
< # if iptables 2>&1 | grep 'no command specified' ; then
< # iptables -t nat -A POSTROUTING -o "$ethdev" -j MASQUERADE
---
> if iptables 2>&1 | grep 'no command specified' ; then
> iptables -t nat -A POSTROUTING -o "$ethdev" -j MASQUERADE
59c59
< # fi
---
> fi
64,65c64
< # echo 1 > /proc/sys/net/ipv4/ip_forward
< echo 0 > /proc/sys/net/ipv4/ip_forward
---
> echo 1 > /proc/sys/net/ipv4/ip_forward
root@ratos:/usr/bin# diff autohotspotN autohotspotN.orig
48,49c48,49
< # if iptables 2>&1 | grep 'no command specified' ; then
< # iptables -t nat -A POSTROUTING -o "$ethdev" -j MASQUERADE
---
> if iptables 2>&1 | grep 'no command specified' ; then
> iptables -t nat -A POSTROUTING -o "$ethdev" -j MASQUERADE
59c59
< # fi
---
> fi
64,65c64
< # echo 1 > /proc/sys/net/ipv4/ip_forward
< echo 0 > /proc/sys/net/ipv4/ip_forward
---
> echo 1 > /proc/sys/net/ipv4/ip_forward
miklschmidt
miklschmidt2w ago
Sounds like you're comparing Raspberry Pi OS Bookworm to Raspberry Pi OS Bullseye (which is what RatOS is based on). The difference is Bookworm uses NetworkManager and Bullseye uses the standard Debian 11 dhcpcd config. If you have fiddled around with the klipperscreen network panel (which is broken as they dropped support for everything but network manager - which i'm still bitter about), you may have been prompted to install NetworkManager, which will screw over the dhcpcd config. That could cause the problems you're seeing. In any case, this sounds like network problems caused by the local setup at the facility you're at. There's not much i can do about that specifically. There may be more clues in the syslog on your pi. I'll echo the sentiments above and suggest you either disable the hotspot (sudo systemctl disable autohotspot) or try the service script above. You don't want that running in a corporate facility.

Did you find this page helpful?