Forward Internet connection over ssh to remote computer

I'm struggling to access the internet from my remote computer. I'd like to access the remote computer via ssh and have there the internet connection available to install packages etc.

It looks like this:

(Internet) <--wlan0--> ((Local Computer)) <--eth0--> ((Remote Computer))

On both computers Linux with Ubuntu trusty is running.
The IPs of the computers are:

Local Computer:

wlan0:  10.2.217.213
eth0:   192.168.1.10 (fixed)

Remote Computer:

eth0: 192.168.1.13 (fixed)

Can I just forward a port where I receive the connection to the internet on my local computer? How can I determine this port?

I'm glad for your help! I'm no network expert and already googled for hours and tried forwarding, bridging, sshuttle etc. with no success.

Thank you very much,
Jonas


Solution 1:

Use this set of iptables rules to set up your local computer as a NAT router:

iptables -P INPUT DROP  # drop every INPUT
iptables -P FORWARD DROP    # drop every FORWARD
iptables -A INPUT -i lo -j ACCEPT   # accept loopback-INPUT
iptables -A INPUT -i eth0 -j ACCEPT # accept eth0 INPUT
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE   # NAT-Translation
iptables -A FORWARD -i eth0 -j ACCEPT   # accept FORWARD-Traffic from eth0
iptables -A FORWARD -i wlan0 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT # accept FORWARD-Traffic as reply for existing connections
iptables -A INPUT -i wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT # allow the local computer to access the internet
iptables -A INPUT -i wlan0 -p icmp --icmp-type echo-request -j ACCEPT # allow pings on wlan0
echo "1" > /proc/sys/net/ipv4/ip_forward

Do not copy these rules without checking them first. Use a root-Shell (e.g. sudo -s) to apply these rules to iptables.

Remember to set your local computer as gateway for the remote one.