LONEADMIN.COM
Resources for Crusty Old Sysadmins
--------------------------------------------------------

Home

UNIX Crap
- Export and Mount NFS Shares

Network Crap
- Use a Raspberry Pi as a WiFi Router

SGI/IRIX Crap
- Basic SGI hardware info
- Installing Photoshop 3.0.1
- Installing Illustrator

Classic Macintosh Crap
- Mac Plus SCSI and using a BlueSCSI
- Mac IIci repair notes

Sun/Solaris Crap
- SunPCi cards

NeXT Crap
- Basic hardware info

Abandonware Resources

Crusty old sysadmins know that pretty much any Linux box can operate as a router. Back in the day I used all sorts of computers to "share" Internet connections with other computers using simple hubs and switches, and a Linux system with multiple network interfaces to segment networks and route non-local traffic out to the Ineternet. Because a Raspberry Pi running the basic OS provided is just another Linux box (in this case Debian), it's easy to use this in the same way.

For my purposes, I needed a simple router that used NAT (Network Address Translation) to share the WiFi connection I have in my house to older systems that have no WiFi capability. Being able to get vintage systems on the Internet without running cables all over the house is convenient, and it keeps the wife from complaining too loudly. Using a small, unmanaged switch and a Raspberry Pi 3, I was able to get all sorts of computers on the network and out to the Internet.

The Switch
Nothing special, just an 8-port Netgear switch that can do 10Mb, 100Mb, and 1Gb. I used a Netgear GS308, and yes it can do 10Mb.

The Pi
Hardware
I had a Pi 3b+ hanging around with no other purpose, so that is what I used. Any Pi with wired ethernet port and WiFi radio should work fine.

Wireless config
Believe it or not, you don't need to do anything special. Follow the normal Pi setup for wireless.

Wired Ethernet config
Open /etc/dhcpcd.conf. If you have done nothing at this point, you can drop right to the end of the file and insert the lines below to configure your wired (eth0) interface.
interface eth0
static ip_address=10.0.0.2/24


Note: You will need to use an IP that is NOT on the same network as your wireless. So if you use 192.168.0.0/24 for your WiFi, use any RFC-1918 address space for eth0 that ISN'T that network. I opted for 10.0.0.0/24, but you could use 192.168.1.0/24 if you wanted.
Also note: Your wired interface needs no route, default or otherwise. Your Pi already has access to other networks via the WiFi, and eth0 already has access to anything plugged into the switch and using the correct network.

Iptables Config
Open /etc/rc.local and insert the following lines at the bottom:
#IP masquerade with iptables
iptables -t nat -P POSTROUTING DROP
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE


Setup IP Forwarding
Open /etc/sysctl.conf and edit the line
net.ipv4.ip_forward = 0
to
net.ipv4.ip_forward = 1

And you're finished with the Pi Setup. Reboot it and everything should come up, with everything directed to eth0 NATed and forwarded out wlan0 to the default route on your wireless network.

On your vintage machine
Set your default route to the IP of eth0 on your Pi (10.0.0.2 in my example above), and your DNS server to a public resolver. I use Google's 8.8.8.8, but any will do.

Plug eth0 of your Pi into the switch, and the wired interface of your vintage system into the switch, and you should be connected.



© 2022 Kurt Huhn