IP Masquerading

Here’s the setup:

+---------+                   +----------+
|         |                   |          |
|   RPi   |eth0  <===>  enp0s8|  Pepcon  |enp0s3  <===> ...
|         |                   |          |
+---------+                   +----------+

Routing traffic from RPi, through Pepcon, and on to the Internet requires forwarding and masquerading to be enabled:

sudo sysctl --write net.ipv4.ip_forward=1
sudo iptables --table nat --append POSTROUTING --out-interface enp0s3 --jump MASQUERADE

Do this in a more persistent way, obviously.

The rule can be verified as follows:

(pepcon) $ sudo iptables --table nat --verbose --list POSTROUTING
Chain POSTROUTING (policy ACCEPT 46 packets, 9107 bytes)
 pkts bytes target     prot opt in     out     source               destination
   50  3643 MASQUERADE  all  --  any    enp0s3  anywhere             anywhere