wifisharing.sh:
#! /bin/bash
echo "Run as root, set up wifi sharing through ethernet port"
ip link set eno1 up
ip addr add 10.20.246.234/24 dev eno1
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o wlp3s0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eno1 -o wlp3s0 -j ACCEPT
echo "On connected machine:"
echo "copy this to resolv.conf"
cat /etc/resolv.conf
echo "& run: ip link set eth0 up / ip addr add 10.20.246.235/24 dev eth0 / ip route add default via 10.20.246.234 dev eth0"
# using Artix base iso, not sure if all this was required, first did : sudo rc-service netmount stop, & net.lo too.
# sudo ip addr flush dev DEVICE (eth0) cleared table as per netstat -nr output, so could add new addr & default route.
Run "ip link show" first and change the device names to whatever you have. You could probably turn the last commands for the connected machine into a script as well to save a bit more typing if you were doing this frequently.
Don't know if it affects this, watch out for Network Manager, it sometimes interferes with doing low level networking things if it's installed. Then again, it apparently has settings to do this itself but I haven't done that, my script method is based on the Arch Wiki:
https://wiki.archlinux.org/title/Internet_sharing
https://fedoramagazine.org/internet-connection-sharing-networkmanager/