I've configured a Pi 3B+ to act as a WiFi access point using the excellent instructions here. When the Pi's ethernet is connected it gives WiFi clients access to the internet, and when the ethernet cable is unplugged WiFi clients access the local network only.
Everything works great until I enable Overlay Filesystem via raspi-config. The Pi itself still has access to the internet, which I can verify with
ping www.google.com, but routed internet access no longer works for WiFi clients. I believe the problem is related to a changed network interface name.
When Overlay Filesystem is disabled the ethernet interface is called
eth0 in the output from
ifconfig. The access point documentation expects
eth0 in the command
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE.
However, when Overlay Filesystem is enabled the network interface is called
enxb827eb064f2f. If I execute
sudo iptables -t nat -A POSTROUTING -o enxb827eb064f2f -j MASQUERADE while in Overlay Filesystem the internet is correctly routed to WiFi clients, but that change is obviously lost on reboot. I tried executing this command with Overlay Filesystem disabled, and then re-enabled Overlay, but it did not work - presumably because the network interface
enxb827eb064f2f was not known at the time the command was executed. The name
enxb827eb064f2f appears stable across reboots in Overlay Filesystem, so the problem was not that the interface name changed. If I disable Overlay Filesystem again the internet name returns to
eth0 and routing works as expected.
Is there any way I can ensure the ethernet interface retains the name
eth0 in Overlay Filesystem, or some other way I can pre-emptively configure routing via the alternate interface name?