Skip to content

Configuring the Pi Network

Michael edited this page Sep 20, 2023 · 26 revisions

Networking Tips and Tricks

# Be sure, you have set correct W-Lan Country, SSID and Passphrase on the Pi.

# Enable ip forwarding by uncommenting the line in /etc/sysctl.conf that says net.ipv4.ip_forward=1.

# Find and uncomment the line where stated net.ipv4.ip_forward=1

sudo nano /etc/sysctl.conf

# Remove the"#" from that line, then save and exit by pressing <ctrl+x>, then press <y>, and hit <enter>

sudo nano /etc/rc.local

# Add the lines in pi-config/rc.local to the bottom of /etc/rc.local just before exit 0.

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE  
iptables -A FORWARD -i wlan0 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i tap0 -o wlan0 -j ACCEPT

# Save and exit by pressing <ctrl+x>, then press <y>, and hit <enter>

# This create iptables rules that forwards packets from the tap0 interface to the wlan0 interface.

# Accessing services on your Amiga from other computers on the network

The described configuration uses a method called masquerading to create a separate network for your Amiga behind the Pi. While this has the advantage of shielding it from attacks from other computers, sometimes you may want to be able to access network services on your Amiga from other computers besides the Pi.

To facilitate that access, the firewall on the Pi needs to be configured to forward incoming traffic on specific ports on the external interface to the Amiga.

rc local

# Prevent Raspi dropping WiFi

# Command to read the current power saving mode:

sudo iw wlan0 get power_save

# Command to power_save off:

sudo iw wlan0 set power_save off

# To make this permanent add the following line to /etc/rc.local (before the exit 0!):

 sudo nano /etc/rc.local

# add this before the exit 0

/sbin/iw dev wlan0 set power_save off

# Save and exit by pressing <ctrl+x>, then press <y>, and hit <enter>

# Attention! This will break pure-ftpd

# By adding these lines to /etc/rc.local directly following the other /iptables/ lines, the Pi firewall will start accepting connections to port 21 (FTP) and forwarding them to port 21 on the Amiga allowing an FTP client to connect to an FTP server running on the Amiga.

sudo nano /etc/rc.local

# Add the lines in pi-config/rc.local to the bottom of /etc/rc.local just before exit 0.

iptables -A PREROUTING -t nat -i wlan0 -p tcp --dport 21 -j DNAT --to 192.168.2.2:21
iptables -A FORWARD -p tcp -d 192.168.2.2 --dport 21 -j ACCEPT

# Save and exit by pressing <ctrl+x>, then press <y>, and hit <enter>

Please note that if the Pi is connected using wired ethernet then wlan0 should be changed to eth0.

Reboot...

sudo reboot now

next step: Install Docker

Clone this wiki locally