User:Jebba/NAT

NAT

This is a micro HOWTO, perhaps someday to be longer about how to turn your N900 into a wifi hotspot. In other words, you connect to the Internet via the GPRS (telephone data) connection, then share your connection via wifi with everyone within reach.  :)

#!/bin/sh
# Run this script to share your Internet connection.
# Activate your gprs0 (fone data) connection with the GUI
# Then run this  :)

set -x

# insert masquerade module
sudo modprobe ipt_MASQUERADE

# flush old rules
sudo iptables -F
sudo iptables -t nat -F

sudo iptables -t nat -A POSTROUTING -o gprs0 -j MASQUERADE

# forward IPs
echo -n 1 | sudo tee /proc/sys/net/ipv4/ip_forward

sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode ad-hoc
sudo ifconfig wlan0 up
sudo iwconfig wlan0 essid freemoe
sudo ifconfig wlan0 10.0.0.22 netmask 255.255.255.0 up