
You can replace a long 10m Ethernet cable with a small tiny IoT device such as the raspberry pi or orange pi zero. We prefer the later because it has both built-in Ethernet and Wi-Fi.
We will assume here that you already know how to setup your raspberry pi or orange pi zero with your favourite distribution, so once you ssh into it get back to this guide and continue.
- Connect to the Wi-Fi automatically using Network Manager
- Disable Network Manager for the Ethernet
- Install and configure udhcpd
- Enable forwarding permanently
- adjust iptables permanently
Connect to the Wi-Fi automatically using Network Manager
nmcli d wifi connect my_wifi password
Disable Network Manager for the Ethernet
vim /etc/NetworkManager/NetworkManager.conf
# add the following:
[keyfile]
unmanaged-devices=interface-name:eth*
EOF
Install and configure udhcpd
apt install udhcpd -y
vim /etc/udhcpd.conf
# set something similiar, manually........
# subnet 10.0.0.0 netmask 255.255.255.0 {
# range 10.0.0.100 10.0.0.120;
# option routers 10.0.0.1;
# option lan 192.168.0.1 <--- this is your main router;
# }
bring up the eth0 interface where we going to connect the other end
ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up
restart udhcpd
etc/init.d/udhcpd restart
vim /etc/default/udhcpd #enable service at boot
Enable forwarding permanently
echo 1 > /proc/sys/net/ipv4/ip_forward
sysctl -w net.ipv4.ip_forward=1 #make the above permenant
adjust iptables permanently
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables-save > /root/dsl.fw
vim /etc/rc.local
# add: /sbin/iptables-restore < /root/dsl.fw