One handy use for the Pi is to bridge an internet connection. The Monkey found a way to connect the Pi to a mobile hot-spot via WiFi and pass that internet connection to the wired interface.
And here’s one way to do that:
The following site provided A LOT of help:
# Update your /etc/wpa_supplicant/wpa_supplicant.conf file
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
# ** Be absolutely sure the ssid matches perfectly
# Set a static IP on the wired interface:
( According to: http://www.techsneeze.com/configuring-static-ip-raspberry-pi-running-raspbian/ )
# You’ll need to open the config file for editing.
sudo nano /etc/dhcpcd.conf
# ** Note the extra "c" in the name of the file
At the bottom of the file you will need to add settings such as:
# Leave static routers blank on eth0 so it does not become the default route.
static domain_name_servers=ip.address.of.pi 126.96.36.199 188.8.131.52
# First DNS server to check is the Pi, then OpenNIC, with OpenDNS as a last attempt
This sets your desired static IP, and the appropriate settings for your resolv.conf You’ll notice it uses your local DNS, OpenNIC (184.108.40.206), and OpenDNS (220.127.116.11, Level 3 DNS servers are also an option (18.104.22.168). You will also want to change ‘example.com’ to be your local domain.
You should now reboot to test all of your changes.
3. Now we need to route the traffic from the wireless interface to the wired interface:
sudo iptables -A FORWARD -o wlan0 -i eth0 -s ip-address.of-network.behind.pi/24 -m conntrack --ctstate NEW -j ACCEPT sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT sudo iptables -t nat -F POSTROUTING sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables-save | sudo tee /etc/iptables.sav
Place the following line in your /etc/rc.local file (just before "exit 0" line): iptables-restore < /etc/iptables.sav
edit /etc/sysctl.conf and uncomment:
Reboot the Pi
For more info about IPtables:
A useful tutorial is here on how to Set up a DHCP server using dnsmasq.